Skip to main content

Installation

pip install decart

Quick Start

The SDK is fully async and uses standard Python async/await patterns:

What can you build?

The SDK provides two main APIs for different use cases:

Client Setup

Both APIs share the same client initialization:
import os
from decart import DecartClient

# Option 1: Context manager (recommended - automatic cleanup)
async with DecartClient(
    api_key=os.getenv("DECART_API_KEY"),
    base_url="https://custom-endpoint.com",  # optional
) as client:
    result = await client.process({...})
    # Session automatically closed when done

# Option 2: Manual initialization
client = DecartClient(
    api_key=os.getenv("DECART_API_KEY"),
    base_url="https://custom-endpoint.com",  # optional
)
# Remember to call await client.close() when done
Parameters:
  • api_key (required) - Your Decart API key from the platform
  • base_url (optional) - Custom API endpoint (defaults to Decart’s production API)
Use the context manager (async with) for automatic cleanup of HTTP connections.

Available Models

Import models from the SDK to use with either API:
from decart import models

# Video models
models.video("lucy-pro-t2v")         # Text-to-video
models.video("lucy-pro-i2v")         # Image-to-video
models.video("lucy-dev-i2v")         # Image-to-video
models.video("lucy-pro-v2v")         # Video-to-video
models.video("lucy-dev-v2v")         # Video-to-video
models.video("lucy-motion")          # Motion control

# Image models
models.image("lucy-pro-t2i")         # Text-to-image
models.image("lucy-pro-i2i")         # Image-to-image

# Realtime models
models.realtime("mirage")            # Realtime video transformation
models.realtime("mirage_v2")         # Realtime video transformation (v2)
models.realtime("lucy_v2v_720p_rt")  # Realtime video editing

Async/Await

All SDK methods are asynchronous and must be called with await. If you’re new to async Python:
  • Use async def for functions that call SDK methods
  • Call async functions with await
  • Run async code with asyncio.run(main())
  • For scripts or notebooks, you can use the sync wrapper pattern shown above

Type Hints Support

The SDK includes full type hints for better IDE support and type checking. Each model enforces its own required inputs, so you’ll get autocomplete and helpful errors if something is missing.
# Image-to-video requires 'data' field
await client.process({
    "model": models.video("lucy-pro-i2v"),
    "prompt": "Make it cinematic",
    "data": image_file,  # ✅ Required
})

# Text-to-video doesn't need 'data'
await client.process({
    "model": models.video("lucy-pro-t2v"),
    "prompt": "A cat walking",
    "data": image_file,  # ❌ Type error
})

Ready to start building?