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():
string
API key for authentication. Defaults to the
DECART_API_KEY environment variable.string
Custom URL prefix for API calls. Defaults to
https://api.decart.ai.Record<string, string>
Custom headers to include in requests.
(input: RequestInfo, init?: RequestInit) => Promise<Response>
Custom fetch implementation for intercepting requests or testing.
Image generation
Generate images withgenerateImage():
Image models
Image settings
string
Aspect ratio of the generated image. Supported values:
16:9 (landscape) and 9:16 (portrait).number
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
Video models
Video settings
string
Aspect ratio of the generated video. Supported values:
16:9 (landscape) and 9:16 (portrait).number
Seed value for reproducible results.
string
Video resolution. Supported values:
1280x720 (720p) and 854x480 (480p).Provider options
Pass Decart-specific options viaproviderOptions.decart:
"landscape" | "portrait"
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.