Kling 视频生成
Kling 支持文生视频、图生视频、首尾帧和高级提示词控制。通过公共模型 ID 选择标准或 Pro 档,以及静音或带音频输出。
支持模型
| 模型 | 档位 | 音频 |
|---|---|---|
kling-v3-std-silent | 标准 | 静音输出。 |
kling-v3-std-audio | 标准 | 带音频输出。 |
kling-v3-pro-silent | Pro | 静音输出。 |
kling-v3-pro-audio | Pro | 带音频输出。 |
Endpoint
POST /v1/video/generations
GET /v1/videos/{task_id}
Authentication
Authorization: Bearer sk-***
Content-Type: application/json
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | Kling v3 模型 ID。 |
prompt | string | 是 | 主提示词。图生模式下不要与 extra_body.multi_prompt 同时传。 |
image | string | 条件必填 | 参考图 URL;如果存在 last_image,该字段表示首帧。 |
last_image | string | 条件必填 | 结束帧图 URL。 |
aspect_ratio | string | 否 | 16:9、9:16 或 1:1;图生模式不保证一定生效。 |
duration | integer | 否 | 来源范围为 3 到 15 秒。 |
extra_body.negative_prompt | string | 否 | 不希望出现的内容。 |
extra_body.cfg_scale | number | 否 | 提示词贴合强度,通常越高越贴近提示词。 |
extra_body.multi_prompt | array | 否 | 高级图生模式的多镜头提示词列表。 |
extra_body.element_list | array | 否 | 元素参考列表。 |
extra_body.shot_type | string | 否 | customize 或 intelligent。 |
文生视频示例
curl -X POST "{BASE_URL}/v1/video/generations" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-v3-std-silent",
"prompt": "A wide cinematic shot of a traveler walking through dusty desert ruins, cloak moving in the wind, slow pullback, natural motion.",
"aspect_ratio": "16:9",
"duration": 5,
"extra_body": {
"cfg_scale": 0.5,
"shot_type": "customize",
"negative_prompt": "blur, low detail"
}
}'
图生视频示例
curl -X POST "{BASE_URL}/v1/video/generations" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-v3-pro-audio",
"prompt": "The person writes naturally in a notebook, subtle hand detail, small thoughtful pauses, soft classroom depth of field.",
"image": "https://example.com/start-frame.png",
"aspect_ratio": "16:9",
"duration": 6,
"extra_body": {
"cfg_scale": 0.6,
"shot_type": "intelligent",
"negative_prompt": "artifacts, distortion"
}
}'
首尾帧示例
curl -X POST "{BASE_URL}/v1/video/generations" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-v3-pro-silent",
"prompt": "The portrait subject slowly turns toward the camera while keeping identity stable and motion natural.",
"image": "https://example.com/first-frame.png",
"last_image": "https://example.com/last-frame.png",
"duration": 8
}'
查询任务状态
curl "{BASE_URL}/v1/videos/task_xxx" \
-H "Authorization: Bearer sk-***"
{
"id": "task_xxx",
"task_id": "task_xxx",
"object": "video.generation.job",
"model": "kling-v3-pro-audio",
"status": "completed",
"progress": 100,
"video_url": "https://example.com/output.mp4"
}
计费说明
Kling 计费与模型档位、音频模式、输出秒数和生成模式有关。任务结算记录和当前产品价格是最终计费来源。
常见错误
- 图生模式下同时传
prompt和extra_body.multi_prompt。 - 请求
3到15以外的时长。 - 认为图生模式一定遵循
aspect_ratio。 - 需要静音输出却使用带音频模型。
- 传入私有媒体 URL。