Skip to main content

Installation

npm install @decartai/sdk
# or
pnpm add @decartai/sdk
# or
yarn add @decartai/sdk

Quick Start

  • Browser
  • Node.js
import { createDecartClient, models } from "@decartai/sdk";

const client = createDecartClient({
  apiKey: process.env.DECART_API_KEY,
});

// Generate a video from text
const result = await client.process({
  model: models.video("lucy-pro-t2v"),
  prompt: "A cat walking in a lego world",
});

// Display in browser
const video = document.querySelector("video");
video.src = URL.createObjectURL(result);

What can you build?

The SDK provides two main APIs for different use cases:

Client Setup

Both APIs share the same client initialization:
import { createDecartClient } from "@decartai/sdk";

const client = createDecartClient({
  apiKey: process.env.DECART_API_KEY,
  baseUrl: "https://custom-endpoint.com", // optional
});
Parameters:
  • apiKey (required) - Your Decart API key from the platform
  • baseUrl (optional) - Custom API endpoint (defaults to Decart’s production API)
Store your API key in environment variables. Never commit API keys to version control.

Available Models

Import models from the SDK to use with either API:
import { models } from "@decartai/sdk";

// Video models
models.video("lucy-pro-t2v");         // Text-to-video
models.video("lucy-pro-i2v");         // Image-to-video
models.video("lucy-dev-i2v");         // Image-to-video
models.video("lucy-pro-v2v");         // Video-to-video
models.video("lucy-dev-v2v");         // Video-to-Video
models.video("lucy-pro-flf2v");       // First-last frame video

// Image models
models.image("lucy-pro-t2i");         // Text-to-image
models.image("lucy-pro-i2i");         // Image-to-image

// Realtime models
models.realtime("mirage");            // Realtime video transformation
models.realtime("lucy_v2v_720p_rt");  // Realtime video editing

TypeScript Support

The SDK is written in TypeScript with full type definitions. Each model enforces its own required inputs, so you’ll get autocomplete and helpful errors if something is missing.
// Image-to-video requires 'data' field
await client.process({
  model: models.video("lucy-pro-i2v"),
  prompt: "Make it cinematic",
  data: imageFile, // ✅ Required
});

// Text-to-video doesn't need 'data'
await client.process({
  model: models.video("lucy-pro-t2v"),
  prompt: "A cat walking",
  data: imageFile, // ❌ Type error
});

Ready to start building?

I