Skip to main content

Quickstart Guide

Get up and running quickly with the Decart AI SDK Provider. This guide will walk you through generating your first image and video.

Prerequisites

Make sure you’ve completed the Installation steps:
  • Installed @decartai/ai-sdk-provider and ai packages
  • Set up your DECART_API_KEY environment variable
  • Using Node.js 18 or higher

Generate Your First Image

Let’s create a simple image from a text prompt:
1

Import the required functions

2

Generate an image

3

Save the image

Complete Example

image-generation.ts
The image.uint8Array property contains the raw image data in PNG format.

Generate Your First Video

Now let’s create a video from a text prompt:
1

Import the required functions

2

Generate a video

3

Save the video

Complete Example

video-generation.ts
The experimental_generateVideo function is part of the AI SDK’s experimental API for video generation.

Customizing Generation

Control Aspect Ratio

Both image and video generation support aspect ratio customization:

Reproducible Results with Seeds

Use a seed value to get consistent outputs:

Video Resolution

Control video quality with the resolution parameter:
Supported resolutions:
  • 1280x720 (720p, default)
  • 854x480 (480p)

Next Steps

Now that you’ve generated your first image and video, explore more advanced features:

Image Generation

Deep dive into text-to-image generation with lucy-pro-t2i

Video Generation

Learn about text-to-video and image-to-video generation

Motion Control

Control camera movement with trajectory-based generation

API Reference

Explore all available models and settings

Common Issues

API Key Not FoundIf you see an error about missing API key:
  • Verify DECART_API_KEY is set in your environment
  • Check your .env file is in the correct directory
  • Restart your development server after setting environment variables
Module Not FoundIf you encounter import errors:
  • Ensure both @decartai/ai-sdk-provider and ai are installed
  • Check you’re using Node.js 18 or higher
  • Try clearing your node_modules and reinstalling