跳转到主要内容
POST
cURL
将源图像发送至 POST /image-to-video/{model} 以创建视频任务。你可以添加 Prompt 来描述运动效果。响应中包含一个 id,可用于获取结果。

选择模型

将模型 ID 放在 URL 中,不要在 JSON 请求体中添加 model 字段。 kling-4.0 支持 first_frame、middle_frame 和 last_frame;需提供 first_frame 才能使用 last_frame。kling-3.0-turbo 仅支持 first_frame。kling-2.5-turbo、 kling-3.0和 kling-2.6 也支持 last_frame;请同时提供 first_frame 。对于 kling-2.5-turbo 和 kling-2.6, 首尾帧组合需要 1080p。

请求参数

将每个输入放入 contents 中。prompt 条目使用 text;帧条目使用 url。对于图像,请提供可公开访问的 URL 或 Base64 编码的 JPG 或 PNG 数据。 kling-4.0 不提供 settings.audio 开关。其视频包含音轨;请省略该字段,而不是发送模型会忽略的值。 以下请求将一张源图像制作成五秒的视频:
使用其他图像时,请将图像 URL 替换为源图像的公开 URL 或 Base64 编码的 JPG/PNG 数据。使用您的 CometAPI API 密钥将此请求体发送至 https://api.cometapi.com/image-to-video/kling-3.0-turbo。OpenAPI 代码面板提供使用相同请求体的 Shell、Python 和 JavaScript 请求。

获取视频

创建任务的响应格式如下:
保存 data.id。使用 获取 Kling 任务 接口,凭该 ID 查询任务,直到任务达到终止状态。从任务的 outputs 数组中读取视频 URL。

授权

Authorization
string
header
必填

Authenticate with your CometAPI API key.

路径参数

model
enum<string>
默认值:kling-3.0-turbo
必填

Kling model ID. kling-4.0 accepts 3-30 second durations and middle_frame inputs. kling-3.0 supports 4k resolution. The 2.x models accept 5- or 10-second duration.

可用选项:
kling-4.0,
kling-3.0-turbo,
kling-3.0,
kling-2.6,
kling-2.5-turbo

请求体

application/json

Image-to-video request fields exposed by the CometAPI route. The model ID is a path parameter, not a body field.

contents
object[]
必填

Image and text inputs exposed by the CometAPI route. Include a first_frame image. Add a prompt entry or a model-supported last_frame image when needed.

Minimum array length: 1
settings
object

Video generation settings exposed by the CometAPI route. The model ID in the URL determines which values are accepted.

options
object

Optional task fields exposed by the CometAPI route.

响应

200 - application/json

The task was created. Use data.id to retrieve its status and video output.

code
必填

Request result code. 0 or success indicates acceptance.

message
string
必填

Result message.

data
object
必填

Task identifier and submission status.

msg
string

Additional result message when included in the response.

最后修改于 2026年11月13日