For video processing (video editing, motion control), use the Queue API which provides asynchronous job-based processing.
Image
Image Editing
Transform and restyle existing images:prompt(required) - Text description of the style transformationdata(required) - Input image (file object, bytes, or URL)reference_image(optional) - Reference image to guide the edit (file object, bytes, or URL)seed(optional) - Random seed for reproducible resultsresolution(optional) - Output resolutionenhance_prompt(optional) - Auto-enhance the prompt for better results
lucy-image-2
Input Types
Thedata and reference_image parameters accept flexible input types:
The SDK automatically detects whether a string is a file path or URL. Use
Path objects for explicit file paths.Cancellation
Cancel long-running operations using asyncio.Event:Error Handling
The SDK raises specific exception classes for different failure scenarios:InvalidAPIKeyError- API key is invalid or missingInvalidBaseURLError- Base URL is malformedInvalidInputError- Invalid input parameters or validation failedProcessingError- Server-side processing errorModelNotFoundError- Specified model doesn’t existDecartSDKError- Base class for all SDK errors
API Reference
client.process(options)
Generate or transform images.
Parameters:
options: dict- Configuration dictionary with model and inputs:model- Model frommodels.image()cancel_token: asyncio.Event- Optional event for cancellation- Additional fields depend on the model (see below)
bytes - The generated/transformed image
Inputs by Model:
Image Editing (lucy-image-2)
Image Editing (lucy-image-2)
prompt: str- Style description (required)data: FileInput- Input image (required)reference_image: FileInput- Reference image to guide the editseed: int- Random seedresolution: str- Output resolutionenhance_prompt: bool- Auto-enhance prompt
Next Steps
Queue API
Asynchronous video processing with job-based queue
Realtime API
Transform video streams in realtime with WebRTC