Skip to main content
POST
cURL
使用此端点在你的会话和选择都准备就绪后提交最终的多模态视频编辑任务。

完整工作流

1

初始化编辑会话

先从 初始化待编辑视频 开始,以获取你想编辑的片段对应的 session_id
2

构建选区

使用 添加视频选区,并在需要时使用 预览已选视频区域 来优化编辑区域。
3

提交最终任务

通过此端点发送 session_idedit_mode、最终 prompt 以及任何可选生成设置,然后保存返回的任务 id 以便检查状态。

调用前须知

  • 确保选区会话已经初始化
  • 在消耗一次生成调用前,确认你的区域选择是正确的
  • 在同一账号下,并使用初始化返回的准确 session_id,执行与选区相关的后续调用
  • edit_mode 设置为 additionswapremoval
  • 对于 additionswap,提供 image_list;对于 removal,不要传 image_list
  • duration 作为字符串发送,例如 "5""10";示例中明确传入 "5"
  • 将此路由视为最终生成步骤,而不是准备步骤
  • 仅在编辑工作流需要时添加 image_listnegative_promptmodedurationcallback_urlexternal_task_id
完整参数说明请参阅 Kling API 文档

授权

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

请求体

application/json
session_id
string
必填

Selection session id returned by init-selection. Follow-up calls must use the same account and exact session id.

edit_mode
enum<string>
必填

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
prompt
string
必填

Instruction describing the desired edit. Reference the source video as <<<video_1>>> and any reference image as <<<image_1>>>.

model_name
enum<string>
默认值:kling-v1-6

Kling model variant for the final edit task. Omit to use kling-v1-6.

可用选项:
kling-v1-6
image_list
object[]

Image references used by addition and swap tasks. Omit this field for removal tasks.

Minimum array length: 1
negative_prompt
string

Elements to avoid in the edited result.

mode
enum<string>

Generation mode. Use std or pro.

可用选项:
std,
pro
duration
string

Requested output duration in seconds.

callback_url
string

Webhook URL to receive task status updates.

external_task_id
string

Custom task id for your own tracking. Must be unique per account.

响应

200 - application/json

Task accepted.

code
integer
必填
message
string
必填
data
object
必填