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:
| Format | Submit | Query | Notes |
|---|---|---|---|
| OpenAI Sora format | POST /v1/videos | GET /v1/videos/{video_id} | Standard Sora API shape |
| Generic task format | POST /v1/video/generations | GET /v1/video/generations/{task_id} | NewAPI generic video task |
Sora Format
Submit a Task
POST /v1/videoscurl 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"
}'
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Video model, e.g. sora-2, sora-2-pro |
prompt | string | Yes | Scene description |
seconds | string | No | Duration (e.g. "4" / "8" / "12", model-dependent) |
size | string | No | Resolution, e.g. 1280x720 / 720x1280 |
input_reference | file | No | Reference 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}/contentOnce 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/generationscurl 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
}'
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Video model name (see the model list) |
prompt | string | Yes | Scene description |
image_url | string | No | First-frame image for image-to-video |
duration / size etc. | - | No | Other 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%"
}
| Field | Description |
|---|---|
status | Task status (SUBMITTED / IN_PROGRESS / SUCCESS / FAILURE, channel-dependent) |
video_url / url | Result URL (field name varies by channel) |
progress | Progress |
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.