createDecart() function.
Default Provider Instance
The simplest way to use the Decart provider is with the default instance:DECART_API_KEY environment variable.
Custom Provider Configuration
For advanced use cases, you can create a custom provider instance withcreateDecart():
Configuration Options
All configuration options are optional and passed as properties of the settings object.apiKey
string
API key for authenticating with the Decart API. If not provided, the provider will attempt to read from the
DECART_API_KEY environment variable.The API key is sent using the
X-API-KEY header in all requests.baseURL
string
default:"https://api.decart.ai"
Custom base URL for API requests. Useful for routing requests through a proxy server or using a different API endpoint.
Trailing slashes are automatically removed from the base URL.
headers
Record<string, string>
Additional HTTP headers to include in all API requests. These headers are merged with the default headers.
fetch
FetchFunction
Custom fetch implementation to use for HTTP requests. This allows you to intercept requests, add middleware, or provide a custom fetch implementation for testing.
Complete Configuration Example
Here’s a complete example showing all configuration options together:Environment Variables
The Decart provider automatically reads from environment variables:
Example
.env file:
User Agent
The provider automatically adds a User-Agent header to all requests with the format:Related Resources
- Provider Options - Learn about video-specific provider options
- Error Handling - Learn how to handle errors from the Decart API