Skip to main content
POST
cURL
使用此端点可应用 Kling 的某个预设特效场景,并将输入素材转换为一个新的短视频。

选择特效场景

  • 单图特效使用 effect_scene,并搭配 input.imageinput.duration
  • 双人互动特效使用 effect_scene,并搭配 input.images,其中必须正好包含两张图片
  • 输入图片必须满足 Kling 的像素要求;过小的缩略图会被生成任务拒绝
  • 具体素材结构取决于所选特效,但请求始终将特效设置封装在 input
  • 使用当前在 Kling 中可用的特效场景;CometAPI 会拒绝未知的 effect_scene
  • 不要依赖固定的公开枚举列表;特效可用性会因模型通道和场景系列而变化

任务流程

1

提交特效请求

发送 effect_scene 以及匹配的 input 对象,并保存返回的任务 id。
2

轮询任务

继续使用获取 Kling 任务,直到特效任务完成。
3

持久化最终资源

如果你需要稳定保留结果,请下载或镜像已完成的特效视频。
完整参数参考请见官方 Kling 文档

授权

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

请求体

application/json
effect_scene
string
必填

Kling preset effect scene. Single-image effects use input.image; two-person interaction effects use input.images with exactly two images.

input
Single-image effect input · object
必填

Effect-specific input payload. Single-image scenes require image and duration; two-person interaction scenes require exactly two images and duration.

callback_url
string

Webhook URL for task status notifications. The server sends a callback when the task status changes.

external_task_id
string

Optional user-defined task ID for your own tracking. Does not replace the system-generated task ID. Must be unique per account.

响应

200 - application/json

Task accepted.

code
integer
必填

Error code; specific error code definition

message
string
必填

Error message

data
object
必填