Skip to main content
POST
cURL
使用此端点将一张源图片制作成动画 Kling 视频。

调用前准备

  • 提供一个公开图片 URL 或一个 base64 图片字符串
  • 使用符合 Kling 像素要求的图片;过小的缩略图会被生成任务拒绝
  • 先从默认的 kling-v2-6 示例开始,然后在需要不同模型路线时,从 OpenAPI 枚举中选择另一个 model_name
  • 首次请求尽量保持简单:一张输入图片、一个 prompt、无尾帧、无运动蒙版
  • 当你需要可控的局部运动时,使用 dynamic_masks 作为由蒙版和轨迹对象组成的数组
  • 对于支持生成声音的模型路线,首次请求可使用 sound: off 以获得确定性的无音频结果

模型命名

在此端点上使用常规的 Kling 视频 model ID。Omni model ID 请保留给 Omni Video

任务流程

1

提交图生视频请求

创建任务并保存返回的 Kling task_id
2

轮询任务

继续使用 获取一个 Kling 任务 跟踪任务状态,直到输出就绪。
3

保存结果

如果你需要超出提供商交付 URL 保留期限的存储,请持久化保存已完成的资源。
完整参数参考请参见官方 Kling 文档

授权

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

请求体

application/json
image
string
必填

Source image URL or base64 image string. Use an image that meets Kling pixel requirements; very small thumbnails are rejected. For base64 input, send the encoded image string as the field value.

prompt
string

Text prompt describing the desired motion. Maximum 500 characters.

negative_prompt
string

Elements to exclude from the video. Maximum 200 characters.

callback_url
string

Webhook URL to receive task status updates when the task completes.

mode
enum<string>
默认值:std

Generation mode. std for standard (faster), pro for professional (higher quality).

可用选项:
std,
pro
model_name
enum<string>
默认值:kling-v1

Model ID for this image-to-video request. Use kling-v3 for new requests. Use Omni model IDs only with the Omni Video endpoint.

可用选项:
kling-v1,
kling-v1-5,
kling-v1-6,
kling-v2-master,
kling-v2-1,
kling-v2-1-master,
kling-v2-5-turbo,
kling-v2-6,
kling-v3
image_tail
string

Tail-frame reference image as a Base64 string or public URL. Same format requirements as image. Controls the last frame of the generated video.

cfg_scale
number

Prompt adherence strength. Higher values follow the prompt more closely. Range: 0–1.

duration
string
默认值:5

Output video length in seconds. Use 5 or 10; omit to use 5.

static_mask
string

Static brush mask image as a Base64 string or public URL. White areas are frozen in place during video generation. Must match the aspect ratio and resolution of the input image.

dynamic_masks
object[]

Optional motion masks. Each entry contains a mask image and an ordered trajectory list.

external_task_id
string

Custom task id for your own tracking. Does not replace the system-generated task id but can be used to query tasks. Must be unique per user.

sound
enum<string>

Optional generated-audio switch for models that support video sound. Use on or off, or omit the field for the model default.

可用选项:
on,
off

响应

200 - application/json

Task accepted.

code
integer
必填

Error code; specifically define the error code

message
string
必填

error message

data
object
必填