跳转到主要内容
POST
cURL
向 POST /text-to-video/{model} 发送 Prompt 以创建视频任务。响应中包含用于获取结果的 id。

选择模型

在 URL 中指定模型 ID。不要在 JSON 请求体中添加模型字段。

请求参数

kling-4.0 不提供 settings.audio 开关。其视频包含音轨;请省略该字段,不要发送模型会忽略的值。 以下请求使用 kling-3.0-turbo 创建一个五秒的视频:
使用 CometAPI API 密钥将此请求体发送到 https://api.cometapi.com/text-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 the 21:9 ratio. 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

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

prompt
string
必填

Text description of the video to generate.

Minimum string 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日