import { readFileSync, writeFileSync } from "fs";
import { createDecartClient, models } from "@decartai/sdk";
const client = createDecartClient({
apiKey: "--your-api-key--"
});
const videoBuffer = readFileSync("/path/to/input.mp4");
const videoBlob = new Blob([videoBuffer], { type: "video/mp4" });
const result = await client.queue.submitAndPoll({
model: models.video("lucy-2-v2v"),
prompt: "Change the person's outfit to a red dress",
data: videoBlob,
onStatusChange: (job) => console.log(`Status: ${job.status}`),
});
if (result.status === "completed") {
const buffer = Buffer.from(await result.data.arrayBuffer());
writeFileSync("output.mp4", buffer);
}Available Endpoints
Request Parameters
promptOptionalType:string
Describe the edits you want to apply to the video.
reference_imageOptionalType:File
Upload a reference image to guide the edit.
dataRequiredType:File
The video you want to edit. Supports MP4, WebM, and QuickTime formats up to 300MB.
resolutionOptionalType:string
Output video resolution. (default: 720p) (options: 720p)
Parameter
Type
Required
Description
promptstringNoDescribe the edits you want to apply to the video.reference_imageFileNoUpload a reference image to guide the edit.dataFileYesThe video you want to edit. Supports MP4, WebM, and QuickTime formats up to 300MB.resolutionstringNoOutput video resolution. (default: 720p) (options: 720p)Lucy Edit 2
Long-Form Video Editing
Edit entire videos with text prompts and optional reference images. Lucy Edit 2 supports videos up to 30 minutes, making it easy to edit full videos from start to finish in a single workflow.
Pricing
Model
pro
720p
4 Creditsper 1s
Video models are charged per second of generated video. Final cost depends on video duration and selected resolution.