Skip to main content

Video Generation

Video generation is asynchronous: submit a task to get a task ID, poll for status, then download the result. The gateway supports two formats:

FormatSubmitQueryNotes
OpenAI Sora formatPOST /v1/videosGET /v1/videos/{video_id}Standard Sora API shape
Generic task formatPOST /v1/video/generationsGET /v1/video/generations/{task_id}NewAPI generic video task

Sora Format​

Submit a Task​

POST /v1/videos
curl https://test.kailin.com.cn/v1/videos \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-token" \
-d '{
"model": "sora-2",
"prompt": "An orange cat rolling in the snow, slow motion",
"seconds": "10",
"size": "1280x720"
}'
ParameterTypeRequiredDescription
modelstringYesVideo model, e.g. sora-2, sora-2-pro
promptstringYesScene description
secondsstringNoDuration (e.g. "4" / "8" / "12", model-dependent)
sizestringNoResolution, e.g. 1280x720 / 720x1280
input_referencefileNoReference image/first frame (multipart only)

Response (Video Object)​

{
"id": "video_abc123",
"object": "video",
"created_at": 1730000000,
"status": "queued",
"model": "sora-2",
"prompt": "An orange cat rolling in the snow, slow motion",
"size": "1280x720",
"seconds": "10",
"progress": 0
}

Query the Task​

GET /v1/videos/{video_id}
curl https://test.kailin.com.cn/v1/videos/video_abc123 \
-H "Authorization: Bearer sk-your-token"

status transitions: queued → in_progress → completed / failed, with progress 0–100 while running.

Download the Video​

GET /v1/videos/{video_id}/content

Once completed, download the MP4 binary:

curl "https://test.kailin.com.cn/v1/videos/video_abc123/content" \
-H "Authorization: Bearer sk-your-token" \
--output result.mp4

Generic Task Format​

Submit a Task​

POST /v1/video/generations
curl https://test.kailin.com.cn/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-token" \
-d '{
"model": "kling-v1",
"prompt": "Shuttles flying over a cyberpunk city",
"duration": 5
}'
ParameterTypeRequiredDescription
modelstringYesVideo model name (see the model list)
promptstringYesScene description
image_urlstringNoFirst-frame image for image-to-video
duration / size etc.-NoOther parameters pass through per model (duration, resolution, aspect ratio…)

Response​

{ "task_id": "4f6a2b1c-xxxx-xxxx-xxxx" }

Query the Task​

GET /v1/video/generations/{task_id}
curl https://test.kailin.com.cn/v1/video/generations/4f6a2b1c-xxxx \
-H "Authorization: Bearer sk-your-token"
{
"task_id": "4f6a2b1c-xxxx",
"status": "SUCCESS",
"video_url": "https://oss.example.com/video/xxx.mp4",
"progress": "100%"
}
FieldDescription
statusTask status (SUBMITTED / IN_PROGRESS / SUCCESS / FAILURE, channel-dependent)
video_url / urlResult URL (field name varies by channel)
progressProgress
caution

Video generation takes anywhere from tens of seconds to several minutes. Poll at 10–30 second intervals and persist the task ID (gateway task records have a retention window). The video_url is temporary — re-host the file promptly after completion.