Installation
Get started with the Decart AI SDK Provider by installing the package and configuring your API credentials.Prerequisites
Before you begin, ensure you have:- Node.js 18 or higher installed on your system
- npm, yarn, or pnpm package manager
- A Decart API key (see Getting Your API Key below)
Install the Package
Install the Decart AI SDK Provider using your preferred package manager:The
ai package is a peer dependency that provides the core AI SDK functionality like generateImage() and experimental_generateVideo().Getting Your API Key
To use the Decart AI SDK Provider, you’ll need an API key from Decart:1
Visit Decart
Go to decart.ai and create an account if you don’t have one
2
Access API Settings
Navigate to your account settings or API section
3
Generate API Key
Create a new API key for your application
4
Save Securely
Store your API key securely - you’ll need it for configuration
Configure Your API Key
There are two ways to provide your API key to the Decart provider:Environment Variable (Recommended)
Set theDECART_API_KEY environment variable:
.env file:
.env
Programmatic Configuration
Alternatively, pass the API key directly when creating a custom provider instance:Advanced Configuration
For advanced use cases, you can customize the provider with additional options:Configuration Options
-
apiKey
stringYour Decart API key. Defaults to theDECART_API_KEYenvironment variable. -
baseURL
stringCustom API endpoint URL. Defaults tohttps://api.decart.ai. Useful for proxy servers or testing. -
headers
Record<string, string>Additional HTTP headers to include in every request. -
fetch
FetchFunctionCustom fetch implementation. Useful for middleware, request interception, or testing.
Verification
Verify your installation by running a simple test:Next Steps
Quickstart Guide
Learn how to generate your first images and videos with practical examples