All video generation is asynchronous. After creating a task, poll GET /video/v1/tasks/:task_id to get results.

Create task response

{
  "task_id": "a1b2c3d4-e5f6-..."
}

task_id is used for subsequent queries and tracing.

Query task status

curl https://51kik.com/video/v1/tasks/a1b2c3d4-e5f6-... \
  -H 'Authorization: Bearer sk-xxxxxxxx'

While pending / running

{
  "task_id": "a1b2c3d4-e5f6-...",
  "task_status": "running",
  "model": "wan2.1-t2v-turbo",
  "created": 1719000000000,
  "updated": 1719000005000,
  "completed": null,
  "data": [],
  "error": null
}

On success

{
  "task_id": "a1b2c3d4-e5f6-...",
  "task_status": "success",
  "model": "wan2.1-t2v-turbo",
  "created": 1719000000000,
  "updated": 1719000050000,
  "completed": 1719000050000,
  "data": [{ "url": "https://..." }],
  "error": null
}

On failure or cancellation

{
  "task_id": "a1b2c3d4-e5f6-...",
  "task_status": "failed",
  "model": "wan2.1-t2v-turbo",
  "created": 1719000000000,
  "updated": 1719000050000,
  "completed": 1719000050000,
  "data": [],
  "error": { "code": "upstream_task_failed", "message": "upstream video generation task failed" }
}

Response fields

FieldTypeDescription
task_idstringTask ID
task_status'pending' | 'running' | 'success' | 'failed' | 'cancelled'Task status
modelstringRequested model
creatednumber | nullTask creation timestamp (ms)
updatednumber | nullLast update timestamp (ms)
completednumber | nullCompletion timestamp (ms)
dataArray<{ url?: string; [key: string]: unknown }>Video URL and driver-specific fields on success
error{ code: string; message: string } | nullError info on failure or cancellation

Status flow

pending -> running -> success
                  -> failed
                  -> cancelled

SDK polling

The SDK .task() method handles polling automatically:

const result = await rb.video({
  model: 'wan2.1-t2v-turbo',
  prompt: '...',
}).task({ pollInterval: 3000 });  // poll every 3s, default 2s

// Cancel polling
const controller = new AbortController();
setTimeout(() => controller.abort(), 120000);
const result2 = await rb.video({ model: '...', prompt: '...' })
  .task({ signal: controller.signal });

Timeouts

  • Create task (POST): Suggested curl --max-time 30.
  • Query task (GET): Poll as needed, recommended interval 2–5s. The SDK defaults to pollInterval: 2000.