图生视频 API
以图像为起点并描述动作,模型即可将其动态生成为视频片段。许多模型还支持首尾帧控制,或使用多张参考图来引导生成。
模型
以下所有模型均在 POST /v1/videos/generations 中使用 mode "image_to_video" 并传入 image_url。价格按默认路由下的每秒视频计算(在所示分辨率下);Seedance 价格基于其 token 计费估算。
| 模型与 API 模型 ID | 选项 | official-cheap 价格(默认) |
|---|---|---|
Seedance 2.5bytedance/seedance-2.5 | 尺寸:480p, 720p, 1080p4–30 秒片段 | 720p 每秒 $0.213official:$0.231 |
Seedance 2.0bytedance/seedance-2.0 | 尺寸:480p, 720p, 1080p, 4K4–15 秒片段 | 720p 每秒 $0.139official:$0.151 |
Seedance 2.0 Fastbytedance/seedance-2.0-fast | 尺寸:480p, 720p4–15 秒片段 | 720p 每秒 $0.111official:$0.121 |
Seedance 2.0 Minibytedance/seedance-2.0-mini | 尺寸:480p, 720p4–15 秒片段 | 720p 每秒 $0.07official:$0.076 |
Wan 3.0alibaba/wan-3.0 | 尺寸:480p, 720p, 1080p2–15 秒片段 | 720p 每秒 $0.083official:$0.092 |
Wan 3.0 Primealibaba/wan-3.0-prime | 尺寸:480p, 720p, 1080p2–15 秒片段 | 720p 每秒 $0.125official:$0.138 |
HappyHorse 1.1alibaba/happyhorse-1.1 | 尺寸:480p, 720p, 1080p3–15 秒片段 | 720p 每秒 $0.125official:$0.138 |
HappyHorse 1.0alibaba/happyhorse-1.0 | 尺寸:720p, 1080p3–15 秒片段 | 720p 每秒 $0.125official:$0.138 |
Grok Imagine Video 1.5xai/grok-imagine-video-1.5 | 尺寸:480p, 720p, 1080p1–15 秒片段 | 720p 每秒 $0.126official:$0.14 |
Grok Imagine Video 1.5 Litexai/grok-imagine-video-1.5-lite | 尺寸:480p, 720p, 1080p1–15 秒片段 | 720p 每秒 $0.027official:$0.03 |
Kling 4.0kwaivgi/kling-4.0 | 尺寸:720p, 1080p3–30 秒片段 | 720p 每秒 $0.138official:$0.154 |
MiniMax H3minimax/h3 | 尺寸:480p, 768p, 2K5–15 秒片段 | 768p 每秒 $0.072official:$0.08 |
MiniMax H3 Maxminimax/h3-max | 尺寸:480p, 768p5–15 秒片段 | 768p 每秒 $0.072official:$0.08 |
MiniMax H3 Max Turbominimax/h3-max-turbo | 尺寸:480p, 768p5–15 秒片段 | 768p 每秒 $0.036official:$0.04 |
快速开始
- 创建 API 密钥
在控制台中创建密钥并将其保存为 MLMUX_API_KEY 环境变量。
创建 API 密钥 - 发送请求
该示例将 Seedance 2.0(bytedance/seedance-2.0)发送至 https://api.mlmux.com/v1/videos/generations。你可以将模型 ID 更改为上表中的任意模型。
- 获取结果
响应为一个任务。每隔几秒轮询一次其 poll_url 直至 status 为 succeeded,然后下载视频,或配置 webhook 以接收通知。
视频 API 参考文档
curl https://api.mlmux.com/v1/videos/generations \
-H "Authorization: Bearer $MLMUX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "bytedance/seedance-2.0",
"route_mode": "official-cheap",
"prompt": "The camera slowly pushes in while steam rises from the cup",
"mode": "image_to_video",
"image_url": "https://your-cdn.example/start-frame.jpg",
"ratio": "16:9",
"resolution": "720p",
"duration": 5,
"generate_audio": true
}'
# The response is a task. Poll it until "status" is "succeeded", then read "video".
curl https://api.mlmux.com/v1/videos/generations/TASK_ID \
-H "Authorization: Bearer $MLMUX_API_KEY"常见问题
图生视频应该使用哪个模型?
Seedance 2.0 是不错的默认选择。Seedance 2.5 和 Wan 3.0 Prime 能呈现最丰富的动态效果,Kling 4.0 支持生成长达 30 秒的片段,而 Grok Imagine Video 1.5 Lite 是成本最低的选择。
图生视频 API 如何计费?
在默认路由下,每秒视频低至约 $0.027(Grok Imagine Video 1.5 Lite)。Seedance 将起始图像视为参考图像而非参考视频,因此适用较低费率;其他模型无论是否包含起始图像,每秒费用均相同。
如何传入起始图片?
在 image_url 中传入公开 URL,或通过 POST /v1/uploads 上传文件并使用返回的 URL。请求会返回一个任务;您可以轮询该任务,或在视频就绪时接收 webhook 通知。
请求失败会被扣费吗?是否有并发限制?
失败的请求不会扣费,为其预扣的积分将退还至您的账户余额。每个账号最多可同时运行 60 个任务;如需更高配额,请发送邮件至 support@mlmux.com。