文生视频
POST /kling/text-to-video/kling-3.0-turbo
概览
| Method | POST |
|---|---|
| Path | /kling/text-to-video/kling-3.0-turbo |
| Type | http |
| Status | -2 |
| Module | 2102810 |
| Folder | 89080955 |
参数
{ "header": [ { "required": false, "description": "", "type": "string", "id": "5Ug8kiHXeT", "enable": true, "name": "Content-Type", "sampleValue": "application/json" }, { "required": false, "description": "", "type": "string", "id": "m8yqMaItRX", "enable": true, "name": "Accept", "sampleValue": "application/json" }, { "required": false, "description": "", "type": "string", "id": "fy0FnvuvQR", "enable": true, "name": "Authorization", "sampleValue": "Bearer {{YOUR_API_KEY}}" } ] }
请求体
{ "type": "application/json", "parameters": [], "jsonSchema": { "type": "object", "description": "可灵 3.0 Turbo 文生视频请求体。prompt 与 contents[] 二选一提供提示词,顶层 prompt 优先级高于 contents[]。", "additionalProperties": true, "properties": { "prompt": { "type": "string", "description": "【推荐】顶层提示词。最多 3072 字符。全角标点(,;:)由网关自动转为半角。与 contents[] 二选一,同时传入时 contents[] 被忽略。", "minLength": 1, "maxLength": 3072 }, "contents": { "type": "array", "description": "【替代】提示词数组写法,与顶层 prompt 二选一。每项 type 必须为 \"prompt\"(文生不支持 first_frame)。网关会提取 contents[].text 转为顶层 prompt 后转发上游。", "minItems": 1, "items": { "type": "object", "required": [ "type", "text" ], "additionalProperties": false, "properties": { "type": { "type": "string", "const": "prompt", "description": "文生视频固定为 \"prompt\",传入 \"first_frame\" 会报 400。" }, "text": { "type": "string", "description": "提示词文本,最多 3072 字符。", "minLength": 1, "maxLength": 3072 } }, "x-apifox-orders": [ "type", "text" ] } }, "settings": { "type": "object", "description": "生成参数,全部可选。缺失时网关自动补默认值:resolution=720p, aspect_ratio=16:9, duration=5。", "additionalProperties": false, "properties": { "resolution": { "type": "string", "description": "输出分辨率,默认 720p。1080p 计费约 1.5×。", "default": "720p", "enum": [ "720p", "1080p" ], "x-apifox-enum": [ { "value": "720p", "name": "标清 720p", "description": "默认值;基准计费倍率" }, { "value": "1080p", "name": "高清 1080p", "description": "计费倍率约 1.5×,画质更高" } ] }, "aspect_ratio": { "type": "string", "description": "画面宽高比,默认 16:9。", "default": "16:9", "enum": [ "16:9", "9:16", "1:1" ], "x-apifox-enum": [ { "value": "16:9", "name": "横屏 16:9", "description": "默认值,适合横屏/桌面端" }, { "value": "9:16", "name": "竖屏 9:16", "description": "适合短视频/手机竖屏" }, { "value": "1:1", "name": "方形 1:1", "description": "适合社交媒体方形封面" } ] }, "duration": { "type": "integer", "description": "视频时长(秒),范围 3–15,默认 5。计费金额与时长线性正相关。", "minimum": 3, "maximum": 15, "default": 5 } }, "x-apifox-orders": [ "resolution", "aspect_ratio", "duration" ] }, "options": { "type": "object", "description": "任务控制参数,全部可选。", "additionalProperties": false, "properties": { "callback_url": { "type": "string", "format": "uri", "description": "任务完成后上游回调的 URL(需公网可访问)。" }, "external_task_id": { "type": "string", "description": "业务侧自定义任务 ID,便于幂等查询和对账。" }, "watermark_info": { "type": "object", "description": "水印配置,结构由上游定义,原样透传。", "properties": {}, "x-apifox-orders": [] } }, "x-apifox-orders": [ "callback_url", "external_task_id", "watermark_info" ] } }, "$comment": "必须提供 prompt 或 contents[](至少一个)。两者都为空时网关返回 400: prompt is required。", "x-apifox-orders": [ "prompt", "contents", "settings", "options" ] }, "required": true, "mediaType": "", "examples": [ { "mediaType": "application/json", "value": "{\r\n \"contents\": [\r\n {\r\n \"type\": \"prompt\",\r\n \"text\": \"A cat running\"\r\n }\r\n ],\r\n \"settings\": {\r\n \"resolution\": \"720p\",\r\n \"duration\": 5\r\n }\r\n}", "name": "新手推荐:文生视频 · 最简请求" }, { "name": "新手推荐:文生视频 · 竖屏短视频", "value": "{\r\n \"prompt\": \"Young woman walking through neon-lit Tokyo street at night, slow motion\",\r\n \"settings\": {\r\n \"resolution\": \"720p\",\r\n \"aspect_ratio\": \"9:16\",\r\n \"duration\": 5\r\n }\r\n}", "mediaType": "application/json" }, { "name": "新手推荐:文生视频 · 方形画面", "value": "{\r\n \"prompt\": \"Coffee being poured into a glass cup, macro shot, warm tones\",\r\n \"settings\": {\r\n \"resolution\": \"720p\",\r\n \"aspect_ratio\": \"1:1\",\r\n \"duration\": 5\r\n }\r\n}", "mediaType": "application/json" }, { "name": "进阶推荐:文生视频 · 1080p 高清长视频", "value": "{\r\n \"prompt\": \"Epic aerial view of Zhangjiajie mountains emerging from clouds, golden hour, cinematic drone footage\",\r\n \"settings\": {\r\n \"resolution\": \"1080p\",\r\n \"aspect_ratio\": \"16:9\",\r\n \"duration\": 10\r\n }\r\n}", "mediaType": "application/json" }, { "name": "进阶推荐:文生视频 · 1080p 竖屏最长视频", "value": "{\r\n \"prompt\": \"Fashion model walking on runway, dynamic lighting, high fashion editorial style\",\r\n \"settings\": {\r\n \"resolution\": \"1080p\",\r\n \"aspect_ratio\": \"9:16\",\r\n \"duration\": 15\r\n }\r\n}", "mediaType": "application/json" }, { "name": "进阶推荐:文生视频 · contents 数组写法 + 回调", "value": "{\r\n \"contents\": [\r\n {\r\n \"type\": \"prompt\",\r\n \"text\": \"Autumn leaves falling in a Japanese garden, koi pond reflections, peaceful atmosphere\"\r\n }\r\n ],\r\n \"settings\": {\r\n \"resolution\": \"720p\",\r\n \"aspect_ratio\": \"16:9\",\r\n \"duration\": 8\r\n },\r\n \"options\": {\r\n \"external_task_id\": \"biz-order-20240623-001\",\r\n \"callback_url\": \"https://your-server.com/webhook/kling\"\r\n }\r\n}", "mediaType": "application/json" }, { "name": "进阶推荐:文生视频 · 多镜头故事板(Multi-Shot Storyboard)", "value": "{\r\n \"prompt\": \"Shot 1,2,a young woman stands at window looking outside, morning light filters in;Shot 2,3,she turns around with a smile, coffee cup in hand;Shot 3,5,she walks to the balcony, city skyline in background, golden hour;\",\r\n \"settings\": {\r\n \"resolution\": \"1080p\",\r\n \"aspect_ratio\": \"16:9\",\r\n \"duration\": 10\r\n }\r\n}", "mediaType": "application/json" } ], "oasExtensions": "" }
响应
[ { "id": 170886795, "name": "成功", "code": 200, "contentType": "json", "jsonSchema": { "type": "object", "required": [ "code", "message", "data" ], "properties": { "code": { "type": "integer", "description": "0 = 成功;非 0 = 失败,详见 message 字段" }, "message": { "type": "string" }, "request_id": { "type": "string", "description": "上游请求 ID,排查问题时提供给上游支持" }, "data": { "type": "object", "description": "任务信息。id 与 task_id 均可能携带任务 ID,优先取 id。", "properties": { "id": { "type": "string", "description": "任务 ID(优先)" }, "task_id": { "type": "string", "description": "任务 ID(备用,部分上游返回此字段)" }, "status": { "type": "string", "description": "初始任务状态,如 submitted / queued" }, "task_status": { "type": "string", "description": "同 status,字段名因上游而异" } }, "x-apifox-orders": [ "id", "task_id", "status", "task_status" ] } }, "x-apifox-orders": [ "code", "message", "request_id", "data" ] }, "itemSchema": {}, "description": "", "mediaType": "", "headers": [] } ]