Video Generation API Reference
| Field | Value |
|---|---|
| Base URL | https://api.gate.ai |
| Auth | Authorization: Bearer <API_KEY> |
Submit Video Task
POST
/api/v1/videosSubmit an async video generation job. Returns 202 Accepted with job_id for polling. Pass Idempotency-Key for safe retries.
Request Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Authorization | header | string | Yes | Gate.AI API Key. Format: Bearer <API_KEY> |
| Content-Type | header | string | Yes | Request body format |
| Idempotency-Key | header | string | No | Idempotency key for safe retries — same key returns the existing job |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model ID |
| prompt | string | Yes | Video prompt; describe subject, motion, scene, camera, and style. Limits vary by model: Sora 500 characters, Hailuo 2000 characters, Wan T2V 1500 characters, and Wan I2V 800 characters. Gate.AI does not enforce a hard limit; over-limit prompts are rejected upstream and surfaced as 502 / 503. |
| duration | integer | No | Duration in seconds; the allowed range varies by model |
| resolution | string | No | Output resolution: 480p, 720p, or 1080p |
| aspect_ratio | string | No | Aspect ratio: 16:9, 4:3, 1:1, 3:4, 9:16, 21:9, or adaptive |
| generate_audio | boolean | No | Whether to generate audio |
| seed | integer | No | Random seed, -1 to 4294967295; same seed does not guarantee identical output |
| size | string | No | Exact output size, e.g. 1280x720 |
| input_references | array | No | Optional reference media array for image-to-video, first/last frame driving, video style transfer, or audio-driven generation |
| input_references\\\.type | string | Yes | Reference media type: image, video, or audio. Must match the selected role |
| input_references\\\.url | string | Yes | HTTPS URL of the reference media |
| input_references\\\.role | string | Yes | Reference media purpose. Allowed values: first_frame (first-frame image), last_frame (last-frame image), reference (appearance reference image; influences generation without serving as the first frame or locking its position in the frame), reference_video (reference video), or reference_audio (reference audio) |
| metadata | object | No | Business pass-through fields for auditing or source tagging |
| webhook_url | string | No | Callback URL invoked when the task completes or fails |
Example
json
1 {2 "model": "bytedance/seedance-2.0",3 "prompt": "A golden retriever running on a sunny beach, cinematic camera movement",4 "duration": 6,5 "resolution": "720p",6 "aspect_ratio": "16:9",7 "generate_audio": false,8 "seed": -1,9 "input_references": [10 {11 "type": "image",12 "url": "https://cdn.example.com/portrait.jpg",13 "role": "first_frame"14 }15 ],16 "metadata": {17 "source": "playground"18 },19 "webhook_url": "https://example.com/webhooks/gateai-video"20 }Response Fields
| Name | Type | Description |
|---|---|---|
| job_id | string | Unique job ID |
| status | string | Task status: pending / in_progress / completed / failed |
| model | string | Model used |
| status_url | string | URL to poll task status |
| message | string | Server message |
| current_balance | string | Current account balance (USD) |
| estimated_cost | string | Estimated cost |
| pre_deduct_amount | string | Pre-deducted display amount |
| balance_after_estimate | string | Balance after applying estimated cost |
| currency | string | Currency, currently USD |
| billing_notice | string | Billing notice |
Response Example
json
1 {2 "code": 200,3 "msg": "",4 "data": {5 "job_id": "video_abc123",6 "status": "in_progress",7 "model": "bytedance/seedance-2.0",8 "status_url": "https://api.gate.ai/api/v1/videos/video_abc123",9 "message": "视频任务已提交,请调用 status_url 查询生成进度。",10 "current_balance": "100.0000000000",11 "estimated_cost": "1.0800000000",12 "pre_deduct_amount": "1.0800000000",13 "balance_after_estimate": "98.9200000000",14 "currency": "USDT",15 "billing_notice": "视频生成完成后按实际任务结果扣款,提交后请保持余额充足。"16 }17 }Response
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 202 | Accepted | Task accepted and queued. Returns job_id for status polling. | VideoSubmitResponse |
| 400 | Bad Request | Parameter error | ErrorResponse |
| 401 | Unauthorized | Not logged in or token invalid | ErrorResponse |
| 402 | Payment Required | Insufficient balance. Response includes estimated cost and current balance. | ErrorResponse |
| 429 | Too Many Requests | Too many requests. Please slow down. | ErrorResponse |
| 500 | Internal Server Error | Internal server error | ErrorResponse |
Query Task Status
GET
/api/v1/videos/{job_id}Poll job status, progress, and billing info. Returns download_url when status is completed.
Request Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| job_id | path | string | Yes | Video task ID |
| Authorization | header | string | Yes | Gate.AI API Key. Format: Bearer <API_KEY> |
Response Fields
| Name | Type | Description |
|---|---|---|
| job_id | string | Unique job ID |
| status | string | Task status: pending / in_progress / completed / failed |
| model | string | Model used |
| status_url | string | URL to poll task status |
| download_url | string | Video download URL (appears when status is completed) |
| duration | integer | Video duration in seconds |
| resolution | string | Output resolution |
| aspect_ratio | string | Aspect ratio |
| generate_audio | boolean | Whether audio is included |
| estimated_cost | string | Estimated cost |
| billed_cost | string | Actual billed amount |
| billing_status | string | Billing status: pre_deducted or settled |
| expires_at | string(ISO 8601) | Video file expiration time |
| created_at | string(ISO 8601) | Task creation time |
| completed_at | string(ISO 8601) | Task completion time |
Response Example
json
1 {2 "code": 200,3 "msg": "",4 "data": {5 "job_id": "video_abc123",6 "status": "completed",7 "model": "bytedance/seedance-2.0",8 "status_url": "https://api.gate.ai/api/v1/videos/video_abc123",9 "download_url": "https://api.gate.ai/api/v1/videos/video_abc123/content",10 "duration": 6,11 "resolution": "720p",12 "aspect_ratio": "16:9",13 "generate_audio": false,14 "estimated_cost": "1.0800000000",15 "billed_cost": "1.0800000000",16 "billing_status": "settled",17 "expires_at": "2026-06-26T05:00:00Z",18 "created_at": "2026-05-27T05:00:00Z",19 "completed_at": "2026-05-27T05:03:00Z"20 }21 }Response
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Success | VideoStatusResponse |
| 401 | Unauthorized | Not logged in or token invalid | ErrorResponse |
| 404 | Not Found | Job not found, or job does not belong to this API key. | ErrorResponse |
| 500 | Internal Server Error | Internal server error | ErrorResponse |
Download Video
GET
/api/v1/videos/{job_id}/contentAuthenticate and redirect (302) to the temporary video file URL.
Request Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| job_id | path | string | Yes | Video task ID |
| Authorization | header | string | Yes | Gate.AI API Key. Format: Bearer <API_KEY> |
Response Example
json
1 HTTP/1.1 302 Found2 Location: https://cdn.example.com/videos/video_abc123.mp4?expires=1780000000Response
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 302 | Found | Redirects to temporary video download URL. | |
| 401 | Unauthorized | Not logged in or token invalid | ErrorResponse |
| 404 | Not Found | Job not found, or job does not belong to this API key. | ErrorResponse |
| 409 | Conflict | Task not yet completed; video is not available for download. | ErrorResponse |
| 410 | Gone | Video content has expired and is no longer available. | ErrorResponse |
| 500 | Internal Server Error | Internal server error | ErrorResponse |