Prerequisites
- A Decart API key
- Node.js 18+
- The
aipackage (npm i ai)
Installation
Setup
Import the default provider instance:DECART_API_KEY environment variable by default.
Set your Decart API key as an environment variable:
createDecart():
API key for authentication. Defaults to the
DECART_API_KEY environment variable.Custom URL prefix for API calls. Defaults to
https://api.decart.ai.Custom headers to include in requests.
Custom fetch implementation for intercepting requests or testing.
Image generation
Generate images withgenerateImage():
Image models
| Model | Description |
|---|---|
lucy-pro-t2i | High-quality text-to-image generation |
Image settings
Aspect ratio of the generated image. Supported values:
16:9 (landscape) and 9:16 (portrait).Seed value for reproducible results.
Unsupported aspect ratios generate a warning and fall back to the default behavior.
Video generation
Generate videos withexperimental_generateVideo():
experimental_generateVideo is an experimental AI SDK API. The function signature may change in future releases.Text-to-video
Image-to-video
Animate a static image into a video:Motion control
Uselucy-motion with a trajectory to control camera or subject movement:
Video models
| Model | Description |
|---|---|
lucy-pro-t2v | Text-to-video generation |
lucy-pro-i2v | Image-to-video generation |
lucy-dev-i2v | Image-to-video generation (dev) |
lucy-motion | Image-to-video with trajectory-based motion control |
Video settings
Aspect ratio of the generated video. Supported values:
16:9 (landscape) and 9:16 (portrait).Seed value for reproducible results.
Video resolution. Supported values:
1280x720 (720p) and 854x480 (480p).Provider options
Pass Decart-specific options viaproviderOptions.decart:
Motion path for
lucy-motion. Each point specifies a frame number and normalized x/y coordinates (0–1).Override orientation directly instead of deriving it from
aspectRatio.Next steps
Models overview
Explore all available Decart models.
JavaScript SDK
Use Decart’s native SDK for full API access.
GitHub
View source code and contribute.