鉴权与连接
- Base URL
https://backend:8000- Authorization
Authorization: Bearer YOUR_API_KEY- Content-Type
application/json- 模型名 (model)
kling-k3.0-std
接入协议
为什么选这个协议
适合需要提交任务并轮询状态的图像、视频、音频生成工作流。
接口地址
POST/v1/jobs
Authorization: Bearer YOUR_API_KEYContent-Type: application/json请求 / 响应 JSON
// REQUEST
{
"model": "kling-k3.0-std",
"input": {
"prompt": "人物向镜头挥手,背景轻微虚化",
"image_url": "https://example.com/person.png",
"video_url": "https://example.com/input.mp4",
"audio_url": "https://example.com/audio.mp3",
"duration": 5,
"resolution": "720p",
"generate_audio": false,
"fixed_lens": false,
"callback_url": "https://example.com/webhook",
"negative_prompt": "blurry, low quality",
"aspect_ratio": "16:9",
"mode": "std",
"cfg_scale": 0.5,
"static_mask": "https://...mask.png",
"dynamic_masks": [
{
"mask": "https://...mask.png",
"trajectories": [
{
"x": 100,
"y": 200
}
]
}
],
"camera_control": {
"config": {
"horizontal": 5,
"zoom": 0.5
},
"type": "simple"
},
"external_task_id": "my-task-123"
}
}// RESPONSE
{
"id": "job_example",
"object": "job",
"status": "processing",
"model": "kling-k3.0-std",
"created": 1710000000,
"request_id": "req_example"
}请求字段 / 响应字段
// INPUT SCHEMA
| 字段 | 类型 | 必填 |
|---|---|---|
| prompt | string | Y |
| image_url | image | N |
| video_url | video | N |
| audio_url | audio | N |
| duration | number | N |
| resolution | enum | N |
| generate_audio | boolean | N |
| fixed_lens | boolean | N |
| callback_url | string | N |
| negative_prompt | string | N |
| aspect_ratio | enum | N |
| mode | enum | N |
| cfg_scale | number | N |
| static_mask | string | N |
| dynamic_masks | array | N |
| camera_control | object | N |
| external_task_id | string | N |
// RESPONSE SCHEMA
| 字段 | 类型 | 必填 |
|---|---|---|
| id | string | N |
| status | enum | N |
| model | string | N |
| output.videos[].url | video | N |
| output.videos[].duration | number | N |
代码示例
cURLrequest.sh
curl -X POST "https://backend:8000/v1/jobs" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "kling-k3.0-std",
"input": {
"prompt": "人物向镜头挥手,背景轻微虚化",
"image_url": "https://example.com/person.png",
"video_url": "https://example.com/input.mp4",
"audio_url": "https://example.com/audio.mp3",
"duration": 5,
"resolution": "720p",
"generate_audio": false,
"fixed_lens": false,
"callback_url": "https://example.com/webhook",
"negative_prompt": "blurry, low quality",
"aspect_ratio": "16:9",
"mode": "std",
"cfg_scale": 0.5,
"static_mask": "https://...mask.png",
"dynamic_masks": [
{
"mask": "https://...mask.png",
"trajectories": [
{
"x": 100,
"y": 200
}
]
}
],
"camera_control": {
"config": {
"horizontal": 5,
"zoom": 0.5
},
"type": "simple"
},
"external_task_id": "my-task-123"
}
}'
# 上传参考文件 cURL
curl -X POST "https://backend:8000/v1/files/upload" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "kind=video" \
-F "purpose=reference" \
-F "file=@demo.mp4"
# 查询任务状态 cURL
# 将 job_example 替换为提交任务返回的 task_id
curl -X GET "https://backend:8000/v1/jobs/job_example" \
-H "Authorization: Bearer YOUR_API_KEY"