Kling 2.6 Motion Control API
快手 Kling 2.6 Motion Control 视频生成的完整 API 参考文档。
模型版本
此 API 支持一个模型版本:
Kling 2.6 Motion Control
接口端点
POST /api/v1/video/task
请求参数
必填
可选
输出时长与源视频一致。不支持 duration 参数。输出宽高比由输入媒体决定,不支持 aspect_ratio。上游服务商尚未说明由哪项输入决定输出宽高比,也未说明具体的选择规则。
计费依据为源视频时长四舍五入后的整数秒数和所选的输出分辨率。例如,5.4 秒按 5 秒计费,5.5 秒按 6 秒计费。
请求示例
请将示例媒体 URL 替换为您自己的文件 URL,文件须满足上述要求。
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model_name: 'kling-2.6-motion-control',
prompt: 'Animate the character in the reference image using the dance movements from the reference video',
images: ['https://example.com/character.jpg'],
videos: ['https://example.com/dance-reference.mp4'],
character_orientation: 'video',
resolution: '720p',
keep_original_sound: true
})
});
const { data } = await response.json();
const taskId = data.task_id;
响应格式
初始响应
返回用于轮询的 task_id:
{
"code": 0,
"message": "success",
"data": {
"task_id": "{task_id}",
"response_url": "https://api.flaq.ai/api/v1/video/{task_id}",
"task_status": "submitted"
}
}
使用 GET /api/v1/video/{task_id} 轮询,以检查状态并获取生成的视频。
状态值
submitted:任务已受理,等待处理
processing:视频生成中
succeed:视频生成完成
failed:视频生成失败
最佳实践
- 参考媒体:必须且只能提供一张图片和一个视频,提交前请检查其格式、文件大小和宽高尺寸
- 朝向:切换
character_orientation 时,请重新检查参考视频的时长,尤其是在选择 "image" 时
- 原声:将
keep_original_sound 设为 false 可关闭参考视频原声的保留;省略此参数则会保留原声