创建视频任务
Endpoint
POST /v1/video/generations
Header 参数
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
Authorization | string | No | Bearer {your_token} |
请求体参数
| Field | Type | Required | Title | Description |
|---|---|---|---|---|
model | string | Yes | 模型名称 | kling-v3-std-silent, kling-v3-std-audio, kling-v3-pro-silent, kling-v3-pro-audio |
prompt | string | Yes | 主提示词 | 图生模式下不能与 extra_body.multi_prompt 同时传 |
image | string | Yes | 参考图URL | 传/图生视频, 不传/文生视频(注:若有last_image,则是首帧图) |
last_image | string | Yes | 结束帧图 URL | |
aspect_ratio | string | Yes | 输出画幅比例 | 允许值:16:9、9:16、1:1,(注:图生视频模式下不保证有效,以输出视频为准) |
duration | string | Yes | 视频时长(秒) | 允许值:3 到 15 |
extra_body | object | Yes |
请求示例
文生视频
{
"model": "kling-v3-std-silent",
"prompt": "广角电影感镜头,一个旅行者独自穿过满是尘土的沙漠废墟,披风被风吹动,镜头缓慢拉远,动作真实自然,氛围感强。",
"aspect_ratio": "16:9",
"duration": 5,
"extra_body": {
"cfg_scale": 0.5,
"shot_type": "customize",
"negative_prompt": "模糊, 低细节"
}
}
curl -X POST "{BASE_URL}/v1/video/generations" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-v3-std-silent",
"prompt": "广角电影感镜头,一个旅行者独自穿过满是尘土的沙漠废墟,披风被风吹动,镜头缓慢拉远,动作真实自然,氛围感强。",
"aspect_ratio": "16:9",
"duration": 5,
"extra_body": {
"cfg_scale": 0.5,
"shot_type": "customize",
"negative_prompt": "模糊, 低细节"
}
}'
图生视频
{
"model": "kling-v3-pro-audio",
"prompt": "人物自然地在笔记本上书写,手部动作细腻,头部有轻微思考停顿,景深柔和,课堂环境真实。",
"image": "https://example.com/start-frame.png",
"aspect_ratio": "16:9",
"duration": 6,
"extra_body": {
"cfg_scale": 0.6,
"shot_type": "intelligent",
"negative_prompt": "伪影, 畸变"
}
}
curl -X POST "{BASE_URL}/v1/video/generations" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-v3-pro-audio",
"prompt": "人物自然地在笔记本上书写,手部动作细腻,头部有轻微思考停顿,景深柔和,课堂环境真实。",
"image": "https://example.com/start-frame.png",
"aspect_ratio": "16:9",
"duration": 6,
"extra_body": {
"cfg_scale": 0.6,
"shot_type": "intelligent",
"negative_prompt": "伪影, 畸变"
}
}'
首尾帧图生视频
{
"model": "kling-v3-pro-silent",
"prompt": "肖像人物逐渐转向镜头,身份保持稳定,动作自然。",
"image": "https://example.com/first-frame.png",
"last_image": "https://example.com/last-frame.png",
"duration": 8,
"extra_body": {
"cfg_scale": 0.5,
"shot_type": "customize"
}
}
curl -X POST "{BASE_URL}/v1/video/generations" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-v3-pro-silent",
"prompt": "肖像人物逐渐转向镜头,身份保持稳定,动作自然。",
"image": "https://example.com/first-frame.png",
"last_image": "https://example.com/last-frame.png",
"duration": 8,
"extra_body": {
"cfg_scale": 0.5,
"shot_type": "customize"
}
}'
使用multi_prompt的图生视频
{
"model": "kling-v3-std-audio",
"image": "https://example.com/source-image.png",
"duration": 10,
"extra_body": {
"multi_prompt": [
{
"prompt": "镜头先以中近景开始,人物低头。"
},
{
"prompt": "人物抬头并看向镜头。"
}
],
"shot_type": "customize"
}
}
curl -X POST "{BASE_URL}/v1/video/generations" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-v3-std-audio",
"image": "https://example.com/source-image.png",
"duration": 10,
"extra_body": {
"multi_prompt": [
{
"prompt": "镜头先以中近景开始,人物低头。"
},
{
"prompt": "人物抬头并看向镜头。"
}
],
"shot_type": "customize"
}
}'
响应字段
| Field | Type | Required | Title | Description |
|---|
响应示例
示例 1
{}