Node.js / TypeScript SDK

Generate videos from text, images, and URLs using the VCursor SDK for JavaScript and TypeScript.

Installation

bash
1npm install vcursor-sdk

Quick Start

Initialize the client and submit your first video generation task.

index.ts
1import { VCursor } from "vcursor-sdk";
2
3const client = new VCursor({ apiKey: "your_api_key" });
4
5// Submit a video generation task
6const resp = await client.submit("a cat playing piano in a jazz club");
7
8// Wait for completion with progress callback
9const result = await client.waitForCompletion(resp.task_id!, {
10 onProgress: (p) => console.log(`${p.data.progress}%`),
11});
12
13console.log(result.data.products.url);

Agent Mode

For more complex requirements, use Agent Mode to let VCursor plan and execute multi-step video creation.

agent.ts
1const agent = await client.submitAgent(
2 "create a 30s commercial for a coffee brand",
3 { duration: "30s", aspect_ratio: "16:9" },
4);
5
6const result = await client.waitForAgentCompletion(agent.task_id, {
7 onProgress: (p) => console.log(`${p.progress}% - ${p.current_stage}`),
8});
9
10console.log(result.video_url);

Concurrency Limiting

Manage efficient usage of your API quota.

typescript
1// Check current rate limit status
2const status = await client.checkConcurrency("standard");
3console.log(`Used: ${status.used}/${status.limit}`);
4
5// Client-side limit (capped at server limit)
6const limited = new VCursor({ apiKey: "...", maxConcurrency: 10 });