创建一个 Kling 文生视频任务
通过 CometAPI POST /kling/v1/videos/text2video 使用 Kling 根据文本 Prompt 生成视频,然后按任务 ID 跟踪任务状态并获取结果。
首个可用请求
- 先发送一个简短的 Prompt
- 先从
kling-v3示例开始,然后在需要不同模型路线时,从 OpenAPI 枚举中选择另一个model_name - 仅在基础流程可用后再添加
aspect_ratio、duration、mode或sound - 如果你希望使用推送交付而不是纯轮询,请设置
callback_url - 当你希望在支持生成音频的模型上发起一个确定性的无音频首个请求时,使用
sound: off
模型命名
在此端点上使用常规的 Kling 视频 model ID。将 Omni 模型 ID 保留给 Omni Video。时长和宽高比
size 字段。请求的宽高比会控制输出帧的形状。
任务流程
提交生成请求
轮询任务状态
持久化结果
授权
Bearer token authentication. Use your CometAPI key.
请求头
Must be application/json.
请求体
Text prompt describing the video to generate. Maximum 500 characters.
Elements to exclude from the video. Maximum 200 characters.
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 Webhook URL to receive task status updates when the task completes.
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 Prompt adherence strength. Higher values follow the prompt more closely. Range: 0–1.
Generation mode. std for standard (faster), pro for professional (higher quality). The default is std.
std, pro Output video length in seconds. Use 5 or 10; omit to use 5.
Camera motion preset or manual configuration. Omit for automatic camera movement.
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.
Optional generated-audio switch for models that support video sound. Use on or off, or omit the field for the model default.
on, off