文档

文生视频

更新时间:2026-11-04

POST
/v3/aigc/kl/videos/text2video

根据文本生成视频,支持单镜头 / 多镜头和指定音色(<<<voice_1>>>,最多 2 个,需 sound 为 on)。

请求头带 X-Response-Format: orion 时按原厂报文返回,任务通过原生查询接口查询;否则返回统一结构。

使用 TE 北京地域 API Key 鉴权。模型能力、调用约定见 Kling 接口概览。

身份验证

BearerAuth
headerAuthorizationBearer <token>

TE 北京地域 API Key,填写后自动添加 Bearer 前缀。

请求头参数

X-Response-Format?string

传 orion 时按原厂报文返回

请求体

application/json
  1. body
model_name?string

kling-v3

prompt?string

≤ 2500 字符;multi_shot 为 false 或 shot_type 为 intelligence 时必填

multi_shot?boolean

是否多镜头,默认 false;true 时 prompt 无效

shot_type?string

分镜方式,multi_shot 为 true 时必填

multi_prompt?array<>

分镜 [{index, prompt, duration}],1~6 个,单个 ≤ 512 字符,时长之和等于总时长

negative_prompt?string

≤ 2500 字符

sound?string

on / off(默认);仅 V2.6 及后续模型

cfg_scale?number

[0,1],默认 0.5;kling-v2.x 不支持

mode?string

std(标准)、pro(高品质)、4k(同 pro,输出 4K),默认 std

aspect_ratio?string

16:9(默认)、9:16、1:1

duration?string

3~15,默认 5;范围见能力地图

watermark_info?

{"enabled": true} 同时生成含水印结果;不支持自定义水印

响应体

成功;具体状态及结果见响应字段。

application/json
  1. response
taskId?string

任务 ID

requestId?string

请求 ID,用于排查

code?string

错误码,异常时返回

message?string

错误信息,异常时返回

请求示例
curl -X POST 'https://vod.bj.baidubce.com/v3/aigc/kl/videos/text2video' \  -H 'X-Response-Format: orion' \  -H 'Content-Type: application/json' \  -d '{  "model_name": "kling-v3",  "multi_shot": true,  "shot_type": "customize",  "multi_prompt": [    {      "index": 1,      "prompt": "一只猫缓缓出现在镜头中",      "duration": "2"    },    {      "index": 2,      "prompt": "猫稳稳往前走",      "duration": "3"    }  ],  "duration": "5",  "mode": "std",  "sound": "on",  "watermark_info": {    "enabled": true  },  "aspect_ratio": "9:16"}'
响应示例200
{  "taskId": "tsk-xxxxxxxxxxxxxxxx",  "requestId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}