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 可停用參考影片原始聲音的保留;省略此參數則會保留原始聲音