Skip to main content
POST
cURL
使用此端点根据 Prompt 创建一个 Kling 文生视频任务。它会启动一个异步作业,而不是立即返回已完成的视频。

首个可用请求

  • 先发送一个简短的 Prompt
  • 先从 kling-v3 示例开始,然后在需要不同模型路线时,从 OpenAPI 枚举中选择另一个 model_name
  • 仅在基础流程可用后再添加 aspect_ratiodurationmodesound
  • 如果你希望使用推送交付而不是纯轮询,请设置 callback_url
  • 当你希望在支持生成音频的模型上发起一个确定性的无音频首个请求时,使用 sound: off

模型命名

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

时长和宽高比

此端点不提供单独的分辨率参数,也不提供精确的 size 字段。请求的宽高比会控制输出帧的形状。

任务流程

1

提交生成请求

通过此端点创建任务,并保存返回的 Kling 任务 id。
2

轮询任务状态

通过 获取一个 Kling 任务 检查进度,直到任务进入终态。
3

持久化结果

一旦 Kling 返回已完成资源的元数据,如果你需要长期保留,请将结果转移到你自己的存储中。
有关完整的参数矩阵和模型路线详情,请参阅官方 Kling 文档

授权

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

请求头

Content-Type
string

Must be application/json.

请求体

application/json
prompt
string
必填

Text prompt describing the video to generate. Maximum 500 characters.

negative_prompt
string

Elements to exclude from the video. Maximum 200 characters.

aspect_ratio
enum<string>

Aspect ratio request. Typical rendered sizes are 1280x720 for 16:9, 720x1280 for 9:16, and 960x960 for 1:1. This endpoint does not expose an exact size field.

可用选项:
16:9,
9:16,
1:1
callback_url
string

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

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

Model ID for this text-to-video request. Use an ordinary Kling video model ID; use Omni model IDs only with the Omni Video endpoint.

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

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

mode
enum<string>
默认值:std

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

可用选项:
std,
pro
duration
string
默认值:5

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

camera_control
object

Camera motion preset or manual configuration. Omit for automatic camera movement.

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

Successful Response

code
integer

Error code; specifically define the error code

message
string

error message

request_id
string

Request ID, system-generated, for tracking requests, troubleshooting issues

data
object