创建一个 Kling 多模态编辑任务
通过 CometAPI 创建一个 Kling 多模态视频编辑任务:POST /kling/v1/videos/multi-elements,以组合多个元素并异步生成视频。
完整工作流
初始化编辑会话
session_id。提交最终任务
session_id、edit_mode、最终 prompt 以及任何可选生成设置,然后保存返回的任务 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.