建立 Kling 多模態編輯任務
透過 CometAPI 建立 Kling 多模態影片編輯任務:POST /kling/v1/videos/multi-elements,以組合多個元素並非同步產生影片。
完整流程
初始化編輯工作階段
session_id。建立選取區域
提交最終任務
session_id、edit_mode、最終 prompt,以及任何可選的產生設定,然後儲存回傳的 task id 以供狀態查詢。呼叫前請先確認
- 確保選取工作階段已完成初始化
- 在耗用一次產生呼叫之前,確認您的區域選取正確無誤
- 在同一個帳戶下,並使用初始化時回傳的確切
session_id,執行選取後續呼叫 - 將
edit_mode設為addition、swap或removal addition和swap需提供image_list;removal則省略image_list- 將
duration以字串傳送,例如"5"或"10";範例會明確傳入"5" - 將此路由視為最終產生步驟,而不是設定步驟
- 僅在編輯流程需要時才加入
image_list、negative_prompt、mode、duration、callback_url或external_task_id
授權
Bearer token authentication. Use your CometAPI key.
主體
Selection session id returned by init-selection. Follow-up calls must use the same account and exact session id.
Editing operation for the selected video region. Use addition to add an element, swap to replace a selected element, or removal to remove it.
addition, swap, removal Instruction describing the desired edit. Reference the source video as <<<video_1>>> and any reference image as <<<image_1>>>.
Kling model variant for the final edit task. Omit to use kling-v1-6.
kling-v1-6 Image references used by addition and swap tasks. Omit this field for removal tasks.
1Elements to avoid in the edited result.
Generation mode. Use std or pro.
std, pro Requested output duration in seconds.
Webhook URL to receive task status updates.
Custom task id for your own tracking. Must be unique per account.