Kling 3.0 API
快手 Kling 3.0 视频生成模型的完整 API 参考文档。
模型变体
此 API 支持四种模型变体:
快速对比
支持的宽高比
Kling 3.0 文本生成视频(标准版 & 专业版)
接口地址
POST /api/v1/video/task
请求参数
必填
可选
请求示例
标准版:
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-v3.0-std-text-to-video',
prompt: 'A fox running through a snowy forest at dusk',
duration: 5,
aspect_ratio: '16:9'
})
});
const { data } = await response.json();
const taskId = data.task_id;
专业版:
{
model_name: 'kling-v3.0-pro-text-to-video',
prompt: 'A fox running through a snowy forest at dusk',
duration: 5,
aspect_ratio: '16:9'
}
Kling 3.0 图像转视频(标准版 & 专业版)
请求参数
必填
可选
请求示例
标准版:
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-v3.0-std-image-to-video',
image_url: 'https://example.com/image.jpg',
prompt: 'Gentle breeze, leaves rustling, slow camera pull back',
duration: 5,
aspect_ratio: '16:9'
})
});
const { data } = await response.json();
const taskId = data.task_id;
专业版:
{
model_name: 'kling-v3.0-pro-image-to-video',
image_url: 'https://example.com/image.jpg',
prompt: 'Gentle breeze, leaves rustling, slow camera pull back',
duration: 5,
aspect_ratio: '16:9'
}
响应格式
初始响应
{
"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/{taskId} 以查询状态:
{
"code": 0,
"message": "success",
"data": {
"task_id": "{task_id}",
"response_url": "https://api.flaq.ai/api/v1/video/{task_id}",
"task_status": "succeed",
"task_status_msg": null,
"task_result": {
"videos": [
{
"url": "https://example.com/generated-video.mp4"
}
]
}
}
}
状态值
submitted:任务已接受,等待处理
processing:视频生成中
succeed:视频生成完成
failed:视频生成失败
处理时间
- 标准版:约 2-4 分钟,具体取决于时长
- 专业版:约 3-6 分钟,具体取决于时长
每 5-10 秒轮询一次。较长的视频(10-15 秒)可能需要额外时间。
最佳实践
- 清晰描述动作:在提示词中加入镜头运动和主体动作,以获得更具动感的效果
- 使用负向提示词:排除不需要的元素(例如
"blurry, low quality, watermark")以提升输出质量
- 引导强度:较低的值(0.3-0.5)允许更多创意自由度;较高的值(0.7-1.0)会更严格地遵循提示词
- 图像质量:图像转视频时,使用清晰、光线良好的输入图像以获得最佳动态效果
- 时长选择:先用较短时长(3-5 秒)快速迭代,确认效果后再增加时长用于最终输出
- 版本选择:标准版适合快速迭代,专业版适合最终生产级质量的视频