MiniMax 生视频 API
MiniMax-H3 视频生成接口,支持多模态 content 数组输入,可传入文本、图片、视频,覆盖文生视频、图生视频(首尾帧)与多模态参考生视频场景;平台提供 MiniMax-H3 与 MiniMax-H3-Max 两个模型,最高输出 2K 分辨率视频。
模型简介
| 模型 ID | 说明 |
|---|---|
| minimax-h3 | 多模态输入(文本 / 图片 / 视频),输出分辨率 480P / 768P / 2K |
| minimax-h3-max | 同上,另一档定价与画质取向(480P / 720P) |
调用流程
接口采用异步任务模式,分两步:
- step1:调用创建任务接口,成功返回
task_id - step2:用
task_id轮询查询任务接口,直到status为succeeded,从content.url取生成视频地址
创建任务接口详情
请求地址
POST https://ai.jw-info.com/v1/videos/generations
请求头
| 参数 | 必填 | 说明 |
|---|---|---|
| Content-Type | 是 | 固定 application/json |
| Authorization | 是 | Bearer <你的 API Key> |
请求参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| model | string | 是 | 模型调用名称,如 minimax-h3、minimax-h3-max |
| content | array | 是 | 多模态输入数组;必须包含至少 1 条 text 类型内容。图生视频与多模态参考角色不可混用 |
| content[].type | string | 是 | 输入内容类型,可用:text、image_url、video_url、audio_url |
| content[].text | string | 是 | 文本提示词(prompt);所有场景都要有一个非空 text |
| content[].image_url.url | string | 否 | type=image_url 时的图片地址(首帧 / 尾帧 / 参考图) |
| content[].video_url.url | string | 否 | type=video_url 时的参考视频地址 |
| content[].audio_url.url | string | 否 | type=audio_url 时的参考音频地址 |
| resolution | string | 是 | 输出分辨率,枚举:480P、768P、2K |
| duration | integer | 是 | 生成时长(秒),H3 取值 4~15 |
| ratio | string | 否 | 视频宽高比,枚举:adaptive、21:9、16:9、4:3、1:1、3:4、9:16。文生视频不可用 adaptive,必须显式指定比例(沿用默认值会报参数错误);图生视频强制 adaptive,传其他值会被忽略 |
| aigc_watermark | boolean | 否 | 是否添加 AIGC 水印标识,默认 false |
| callback_url | string | 否 | 任务状态回调地址:任务状态变更后以 POST 推送,结构与「查询任务接口」响应一致(地址需公网可达) |
请求示例
文生视频(注意 ratio 必须显式给):
curl -X POST https://ai.jw-info.com/v1/videos/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <你的 API Key>" \
-d '{
"model": "minimax-h3",
"content": [
{"type": "text", "text": "复古 70 年代地铁站,街头音乐家弹奏吉他,路人匆匆走过,镜头缓慢右移"}
],
"resolution": "768P",
"duration": 5,
"ratio": "16:9"
}'
图生视频(首帧):
{
"model": "minimax-h3",
"content": [
{"type": "text", "text": "镜头缓慢推近,人物转头看向镜头"},
{"type": "image_url", "image_url": {"url": "https://example.com/first.jpg"}}
],
"resolution": "768P",
"duration": 5
}
响应参数
| 参数 | 类型 | 说明 |
|---|---|---|
| task_id | string | 查询任务用的任务 ID(提交响应里的 id) |
{"id": "442699662561545"}
查询任务接口详情
请求地址
GET https://ai.jw-info.com/v1/videos/generations/task/{task_id}
请求头
| 参数 | 类型 | 说明 |
|---|---|---|
| Authorization | string | Bearer <你的 API Key> |
响应参数
与平台其它视频模型一致(方舟 schema,完整字段表见视频生成页):
| 参数 | 类型 | 说明 |
|---|---|---|
| id | string | 任务 ID |
| model | string | 模型名称 |
| status | string | 任务状态:queued 排队中、running 运行中、succeeded 成功、failed 失败、cancelled 已取消 |
| created_at | integer | 任务创建 Unix 时间戳(秒) |
| updated_at | integer | 状态更新时间戳(秒) |
| content.video_url | string | 仅成功时返回:视频限时下载地址(请及时转存) |
| resolution | string | 输出分辨率:480P、768P、2K |
| duration | integer | 生成视频时长(秒) |
| ratio | string | 视频宽高比,不适用时为空字符串 |
| usage.completion_tokens | integer | 输出 Token 数(计费对账依据) |
| usage.total_tokens | integer | 总 Token 数 |
| error | object | 仅失败时返回:error.code / error.message |
计费口径(平台按下列用量结算,响应里只回 usage.completion_tokens / usage.total_tokens):
| 参数 | 类型 | 说明 |
|---|---|---|
| total_seconds | integer | 本次计量总秒数 = input_seconds + output_seconds |
| input_seconds | integer | 输入参考视频总秒数(无参考视频时为 0) |
| output_seconds | integer | 输出视频秒数 |
| input_image_count | integer | 输入图片总张数(首帧 + 尾帧 + 参考图合计) |
| input_audio_seconds | integer | 输入参考音频总秒数(无参考音频时不返回) |
| total_tokens | integer | 总 Token 数 |
| prompt_tokens | integer | 输入 Token 数 |
| completion_tokens | integer | 输出 Token 数 |
响应示例
{
"id": "442699662561545",
"model": "MiniMax-H3",
"status": "succeeded",
"created_at": 1789632761,
"updated_at": 1789632877,
"content": {"video_url": "https://…/output_aigc.mp4?Expires=…"},
"resolution": "768P",
"duration": 5,
"ratio": "16:9",
"usage": {
"completion_tokens": 162745,
"total_tokens": 162745
}
}
用量与计费
- 按秒计费,人民币计价(精确到 0.000001 元,无最低消费):
total_seconds(输入参考视频秒数 + 输出视频秒数)× 分辨率档单价,单价见模型广场对应卡片。 - 输入图片按张计费(
input_image_count)。 - 费用不进响应,到控制台「费用中心」查看明细。
- 任务失败时已扣费用原路退回,无需申请。
错误响应
错误体统一为方舟形状 {"error":{"code","message","param","type"}}(完整表格见视频生成页):
| 情况 | HTTP / code | 说明 |
|---|---|---|
参数错误(缺 model/content,文生视频未显式指定 ratio) | 400 MissingParameter | 缺必填参数 |
参数错误(如文生视频传了 adaptive) | 502 InternalError | 模型服务拒绝,message 里带原因 |
task_id 不存在或不属于当前密钥 | 404 ResourceNotFound | 两者不区分 |
{
"error": {
"code": "ResourceNotFound",
"message": "The specified resource `442699662561545` is not found. Request id: 1f0c5b8e9a2d4c6f8b0e1a3d5c7f9b2e",
"param": "",
"type": "NotFound"
}
}
完整状态码与处理方式见「错误码」页。
可用模型
见上文「模型简介」;更多视频模型见模型广场(筛选「文生视频」)。
代码示例(Python)
import time
import requests
BASE = "https://ai.jw-info.com"
API_KEY = "sk-你的密钥"
headers = {"Content-Type": "application/json",
"Authorization": f"Bearer {API_KEY}"}
# 1. 创建任务
resp = requests.post(f"{BASE}/v1/videos/generations", headers=headers, json={
"model": "minimax-h3",
"content": [{"type": "text", "text": "海边日落,镜头缓慢推进"}],
"resolution": "768P",
"duration": 5,
"ratio": "16:9",
}, timeout=60)
task_id = resp.json()["id"]
print("task_id:", task_id)
# 2. 轮询直到 succeeded(通常数十秒到几分钟)
while True:
task = requests.get(f"{BASE}/v1/videos/generations/task/{task_id}",
headers={"Authorization": f"Bearer {API_KEY}"},
timeout=60).json()
if task["status"] in ("succeeded", "failed", "cancelled"):
break
time.sleep(5)
if task["status"] == "succeeded":
print("视频地址:", task["content"]["video_url"])
print("用量:", task["usage"])
else:
print("任务未成功:", task["status"], task.get("error"))