Skip to main content
The Process API enables you to transform existing images with style transfer and edits. Perfect for building content creation tools, media processing pipelines, batch transformations, and creative applications.
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:
You can also provide a reference image to guide the edit — for example, to add a specific item:
Parameters:
  • prompt (required) - Text description of the style transformation
  • data (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 results
  • resolution (optional) - Output resolution
  • enhance_prompt (optional) - Auto-enhance the prompt for better results
Model: lucy-image-2

Input Types

The data and reference_image parameters accept flexible input types:
Examples:
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:
You can use this to implement cancel buttons in your UI:

Error Handling

The SDK raises specific exception classes for different failure scenarios:
Exception Types:
  • InvalidAPIKeyError - API key is invalid or missing
  • InvalidBaseURLError - Base URL is malformed
  • InvalidInputError - Invalid input parameters or validation failed
  • ProcessingError - Server-side processing error
  • ModelNotFoundError - Specified model doesn’t exist
  • DecartSDKError - Base class for all SDK errors
If you provide invalid inputs, you’ll get clear error messages:
Import specific exception types for better error handling and type safety.

API Reference

client.process(options)

Generate or transform images. Parameters:
  • options: dict - Configuration dictionary with model and inputs:
    • model - Model from models.image()
    • cancel_token: asyncio.Event - Optional event for cancellation
    • Additional fields depend on the model (see below)
Returns: bytes - The generated/transformed image Inputs by Model:
  • prompt: str - Style description (required)
  • data: FileInput - Input image (required)
  • reference_image: FileInput - Reference image to guide the edit
  • seed: int - Random seed
  • resolution: str - Output resolution
  • enhance_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