视频生成:Kling、Hailuo、Vidu
Kling、Hailuo、Vidu 异步视频生成:各模型的时长、分辨率、画幅与声音支持,POST /v1/videos 参数与示例,任务查询、下载和计费注意事项。
这三个系列为异步视频生成模型,都使用 /v1/videos。提交任务后返回 id,轮询任务状态,完成后下载视频。
模型
| 模型 | 时长(秒) | 分辨率 | 画幅 | 声音 |
|---|---|---|---|---|
video-kling-2.5 | 5(默认)、10 | 720P(默认)、1080P | 16:9、9:16、1:1 | 不支持 |
video-kling-2.6 | 5(默认)、10 | 720P(默认)、1080P | 16:9、9:16、1:1 | 默认无声,1080P 可开启 |
video-kling-3.0 | 3~10,默认 5。1080P 无声最长 9 秒 | 720P(默认)、1080P | 16:9、9:16、1:1 | 默认无声,可开启 |
video-kling-3.0-Omni | 1~15,默认 5 | 720P(默认)、1080P | 16:9、9:16、1:1 | 默认无声,720P 可开启 |
video-hailuo-02、video-hailuo-2.3、video-hailuo-2.3-fast(仅图生视频,须传 image) | 6(默认)、10 | 768P(默认)、1080P | 不支持设置 | 不支持 |
video-vidu-q2、video-vidu-q2-turbo | 2~10,默认 5 | 720P(默认)、1080P | 16:9、9:16、1:1、4:3、3:4 | 不支持 |
video-vidu-q2-pro | 1~10,默认 5 | 720P(默认)、1080P | 16:9、9:16、1:1、4:3、3:4 | 不支持 |
video-vidu-q3-pro | 2~10,默认 5 | 720P(默认)、1080P | 16:9、9:16、1:1 | 默认有声,可关闭 |
创建任务
POST https://run.fluxlane.ai/v1/videos
请求体为 JSON。
| 参数 | 类型 | 必选 | 说明 |
|---|---|---|---|
model | string | 必选 | 模型名,见上表 |
prompt | string | 必选 | 文本提示词 |
seconds | integer 或 string | 可选 | 视频时长(秒)。也可用 duration,同时传时以 seconds 为准 |
size | string | 可选 | 分辨率,见上表。也接受 1280x720、720x1280、1920x1080、1080x1920,会同时确定画幅 |
aspect_ratio | string | 可选 | 画幅,见上表 |
image | string | 可选 | 图生视频的首帧图片,须是可公开下载的 http 或 https 地址。不支持上传文件。传图时成片比例随图片 |
audio | boolean | 可选 | Kling 传 true 开启声音,video-vidu-q3-pro 传 false 关闭声音。不支持声音的模型或分辨率传 true 返回 400 |
negative_prompt | string | 可选 | 不希望出现的内容 |
不支持的时长、分辨率、画幅或声音设置会返回 400,不创建任务,也不扣费。
- 文生视频
- 图生视频
- 开启 Kling 声音
- 关闭 Vidu Q3 声音
curl https://run.fluxlane.ai/v1/videos \
-H "Authorization: Bearer $FLUXLANE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "video-kling-3.0",
"prompt": "A red ball rolls slowly across a wooden table",
"seconds": 8,
"size": "1080P",
"aspect_ratio": "9:16"
}'
curl https://run.fluxlane.ai/v1/videos \
-H "Authorization: Bearer $FLUXLANE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "video-hailuo-2.3-fast",
"prompt": "The cat turns its head",
"seconds": 6,
"size": "768P",
"image": "https://example.com/first-frame.jpg"
}'
curl https://run.fluxlane.ai/v1/videos \
-H "Authorization: Bearer $FLUXLANE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "video-kling-3.0",
"prompt": "A red ball rolls slowly across a wooden table",
"seconds": 5,
"size": "720P",
"aspect_ratio": "16:9",
"audio": true
}'
curl https://run.fluxlane.ai/v1/videos \
-H "Authorization: Bearer $FLUXLANE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "video-vidu-q3-pro",
"prompt": "A red ball rolls slowly across a wooden table",
"seconds": 5,
"size": "720P",
"aspect_ratio": "16:9",
"audio": false
}'
响应:
{
"id": "task_xxx",
"object": "video",
"model": "video-kling-3.0",
"status": "queued",
"progress": 0,
"created_at": 1793793983
}
查询任务
GET https://run.fluxlane.ai/v1/videos/{id}
建议每 5~10 秒轮询一次。status 取值为 queued、in_progress、completed、failed。
curl https://run.fluxlane.ai/v1/videos/task_xxx \
-H "Authorization: Bearer $FLUXLANE_API_KEY"
下载视频
GET https://run.fluxlane.ai/v1/videos/{id}/content
任务完成后下载视频:
curl -L https://run.fluxlane.ai/v1/videos/task_xxx/content \
-H "Authorization: Bearer $FLUXLANE_API_KEY" \
-o video.mp4
注意事项
- 按请求的时长计费,单价随模型和分辨率不同,见模型价格页。Kling 开启声音后单价更高。
- 成片时长与请求有细微差异,例如 5 秒约 5.04 秒,Hailuo 6 秒约 5.88 秒。
- 像素尺寸随模型和画幅变化。例如 720P 的 1:1 为 960×960,Vidu 的 720P 4:3 为 1104×816,Hailuo 的 768P 文生视频为 1366×768。
- 个别时长与分辨率组合可能被拒绝,被拒绝时不扣费。
- 图片地址无法下载时任务状态为 failed,不扣费。请换一个可公开访问的地址重试。
- 视频地址保留 7 天,请及时下载转存。