Kling 3.0
接口
POST /videos/generations
完整 URL: https://modelfold.ai/v1/videos/generations
鉴权:所有请求都需要
Authorization: Bearer <API_KEY>请求头。
模型参数直接放在 JSON 请求体中,不要套 input。请求等待生成完成后返回 data[].url;支持的媒体模型也可使用 异步创建、轮询及回调。示例素材地址须替换为自己的公开可访问文件。计费及错误说明见 API 网关。
生成任务的输入参数
请求参数
请求体 (application/json)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 用于生成任务的模型名称。必填字段。 - 该接口必须使用 kling-3.0/video 模型 默认值:"kling-3.0/video"。 可选值:kling-3.0/video。 示例:kling-3.0/video。 |
prompt | string | 是 | 本站网关要求传入 prompt,最长 2000 字。multi_shots 为 false 时必填,最长 2500 字符。 maxLength: 2000. 示例:In a bright rehearsal room, sunlight streams through the window@element_dog。 |
image_urls | array<string> | 否 | 首尾帧图片链接。可选。当 multi_shots 为 false 时:长度为 2 时,索引 0 为首帧,索引 1 为尾帧;长度为 1 时,数组项作为首帧。当 multi_shots 为 true 时:只支持首帧。 |
sound | boolean | 是 | 必填。是否同时生成音频(对白、音效、环境声),影响价格。 示例:true。 |
duration | string | 是 | 必填。视频时长(秒),3–15(字符串,如 "5")。多镜头模式下实际时长与计费按各镜头时长之和(3–15 秒),duration 请填同一合计值。 可选值:3 / 4 / 5 / 6 / 7 / 8 / 9 / 10 / 11 / 12 / 13 / 14 / 15。 示例:5。 |
aspect_ratio | string | 否 | 传了 image_urls 时可省略(输出比例跟随首帧)。文生视频请显式传入:16:9、9:16 或 1:1。 可选值:16:9 / 9:16 / 1:1。 示例:16:9。 |
mode | string | 是 | 必填。生成模式。std 为标准分辨率,pro 为高分辨率,4K 为 4K 分辨率。 分辨率映射: - std 模式:16:9 (1280×720), 9:16 (720×1280), 1:1 (720×720) - pro 模式:16:9 (1920×1080), 9:16 (1080×1920), 1:1 (1080×1080) - 4K 模式:16:9 (3840×2160), 9:16 (2160×3840), 1:1 (2160×2160) 可选值: std / pro / 4K。 示例:pro。 |
multi_shots | boolean | 是 | 必填。是否多镜头。true 时为多镜头,false 为单镜头。 示例:false。 |
multi_prompt | array<object> | 否 | 镜头提示词。multi_shots 为 true 时生效。用来描述每一段镜头的文案和时长,最多支持 5 段,每段时长 1-12 秒,如果需要使用 element,则需加在 prompt 后。 |
multi_prompt[].prompt | string | 是 | 该镜头的提示词文本,单个镜头最多500字符,每个@element会占37个字符。 maxLength: 500. 示例:a happy dog in running@element_cat。 |
multi_prompt[].duration | integer | 是 | 该镜头的时长(单位:秒)。范围:1-12。 minimum: 1. maximum: 12. 示例:3。 |
kling_elements | array<object> | 否 | 引用元素。prompt 中引用元素的详细信息。单个任务最多引用三个元素。 maxItems: 3. |
kling_elements[].name | string | 是 | 元素名称,在 prompt 中使用 @ 前缀引用(如 @element_dog) 示例:element_dog。 |
kling_elements[].description | string | 是 | 元素描述 示例:dog。 |
kling_elements[].element_input_urls | array<string> | 是 | 2–4 张图片(JPG/PNG,单张不超过 10MB),或 1 个视频(MP4/MOV)。 |
kling_elements[].element_input_audio_urls | array<string> | 否 | 可选。角色音频素材 URL 列表。音频时长必须为 5-30 秒 |
kling_elements[].start_time | integer | 否 | 视频角色素材截取开始时间,单位毫秒。仅 element_input_urls 上传视频时生效。未传时默认 0。 默认值:0。 示例:0。 |
kling_elements[].end_time | integer | 否 | 视频角色素材截取结束时间,单位毫秒。仅 element_input_urls 上传视频时生效。必须大于 start_time,且 end_time - start_time 必须在 3000-8000ms。 默认值:8000。 示例:8000。 |
请求示例
bash
curl -X POST "https://modelfold.ai/v1/videos/generations" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-3.0/video",
"sound": true,
"duration": "5",
"mode": "pro",
"multi_shots": false,
"prompt": "In a bright rehearsal room, sunlight streams through the window@element_dog"
}'json
{
"model": "kling-3.0/video",
"sound": true,
"duration": "5",
"mode": "pro",
"multi_shots": false,
"prompt": "In a bright rehearsal room, sunlight streams through the window@element_dog"
}响应
200 — 生成完成。usage 返回实际计费明细;结果地址仅作结构示例。
json
{
"ok": true,
"created": 1792134000,
"data": [
{
"url": "https://modelfold.ai/uploads/outputs/result.mp4"
}
],
"usage": {}
}