Edit video with controlled, targeted prompts
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" });
// Optional: provide a reference image to guide the edit
const imageBuffer = readFileSync("/path/to/reference.jpg");
const imageBlob = new Blob([imageBuffer], { type: "image/jpeg" });
const result = await client.queue.submitAndPoll({
model: models.video("lucy-2.5"),
prompt: "Change the person's outfit to a red dress",
data: videoBlob,
reference_image: imageBlob, // Optional
onStatusChange: (job) => console.log(`Status: ${job.status}`),
});
if (result.status === "completed") {
const buffer = Buffer.from(await result.data.arrayBuffer());
writeFileSync("output.mp4", buffer);
}promptOptionalDescribe the edits you want to apply to the video.
reference_imageOptionalUpload a reference image to guide the edit.
dataRequiredThe video you want to edit. Supports MP4, WebM, and QuickTime formats up to 300MB.
resolutionOptionalOutput video resolution. (default: 720p) (options: 720p)
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)Long-Form Video Editing
Edit entire videos with text prompts and optional reference images. Lucy supports videos up to 30 minutes, making it easy to edit full videos from start to finish in a single workflow.
Video models are charged per second of generated video. Final cost depends on video duration and selected resolution.