外观
MiniMax H3 视频
H3 走 POST /v1/videos,支持 content 数组或扁平字段两种写法,二选一。模型 ID 以 GET /v1/models 返回为准,不要按家族名猜。
H3 的各模型能力不完全相同。下面按当前 H3 接口实际支持的范围说明。
接口一览
| 方法 | 路径 | 说明 |
|---|---|---|
POST | /v1/videos | 创建视频任务 |
GET | /v1/videos/{id} | 查询任务状态与结果 |
GET | /v1/videos/{id}/content | 下载视频 |
DELETE | /v1/videos/{id} | 取消任务 |
POST | /v1/videos/{id}/continue | 续接视频(部分模型) |
POST | /v1/videos/{id}/second-sampling | 二次采样(部分模型) |
POST | /v1/prompts/optimize | 仅优化提示词,不创建任务 |
模型能力
| 能力 | 说明 |
|---|---|
duration | 4–15 秒 |
ratio | 16:9、9:16、4:3、3:4 |
resolution | 480P / 768P |
| 参考素材 | 图片最多 9、视频最多 3、音频最多 3 |
| 取消 | 排队中或生成中的任务可取消;已结束返回 409 |
| 续接 / 二次采样 | 支持,见下文 |
| 提示词优化 | 需要该模型配置了优化器 |
不确定模型支持哪些参数
先用最小请求(model + content + duration + ratio + resolution,或对应的扁平字段)跑通。未列出的扩展参数会返回 400 unsupported_parameter,不会静默忽略。
创建任务
POST
https://YOUR_API_BASE_URL/v1/videos JSON 请求;支持 `content` 数组或扁平字段两种写法,二选一,不要混用。
content 写法
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | H3 模型 ID,以 GET /v1/models 为准 |
content | array | 是 | 文本与素材序列,至少包含一个非空 text |
duration | integer | 是 | 时长,4–15 秒 |
ratio | string | 是 | 16:9、9:16、4:3、3:4 |
resolution | string | 是 | 480P 或 768P |
enable_continuation | boolean | 否 | 是否允许后续续接,默认 true |
扁平字段写法
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | H3 模型 ID |
prompt | string | 是 | 提示词;与 content 中的文本二选一 |
seconds / duration | integer | 是 | 时长,4–15 秒;两者二选一 |
size / resolution | string | 是 | 分辨率,480P 或 768P;两者二选一 |
aspect_ratio / ratio | string | 是 | 画幅,16:9、9:16、4:3、3:4;两者二选一 |
images / reference_images | string[] | 否 | 参考图 |
reference_video | string[] | 否 | 参考视频 |
reference_audio | string[] | 否 | 参考音频 |
metadata | object | 否 | 扩展素材,支持 reference_video、reference_audio |
enable_continuation | boolean | 否 | 是否允许后续续接 |
不要混用两种写法
同一语义的字段不要同时传,例如 prompt 与 content 文本、seconds 与 duration、size 与 resolution、images 与 reference_images。参考图请用 images 或 content 的 role。
content 元素
| type | 必填字段 | 可用 role | 用途 |
|---|---|---|---|
text | text | 不填 | 提示词,至少一个非空文本 |
image_url | image_url.url | reference_image | 参考图 |
video_url | video_url.url | reference_video | 参考视频 |
audio_url | audio_url.url | reference_audio | 参考音频 |
json
{
"type": "image_url",
"role": "reference_image",
"image_url": { "url": "https://media.example.com/person.png" }
}素材按类型和出现顺序编号,可在文本中用 @image1、@video1、@audio1 引用。URL 必须是公网可访问的 http / https 地址或 Data URI。
素材地址要能被生成服务访问
参考素材尽量放在稳定的对象存储 / CDN 上。使用访问不稳定的图床时,可能出现素材下载超时(返回 422)。大文件建议先用文件与素材上传。
参考生视频
bash
curl "https://YOUR_API_BASE_URL/v1/videos" \
-H "Authorization: Bearer sk-xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_H3_MODEL",
"content": [
{ "type": "text", "text": "让 @image1 中的人物自然转身,镜头缓慢推进。" },
{ "type": "image_url", "role": "reference_image", "image_url": { "url": "https://media.example.com/person.png" } }
],
"duration": 5,
"ratio": "16:9",
"resolution": "480P"
}'纯文生视频
bash
curl "https://YOUR_API_BASE_URL/v1/videos" \
-H "Authorization: Bearer sk-xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_H3_MODEL",
"content": [
{ "type": "text", "text": "雨后的城市街道,霓虹灯映在积水中,镜头缓慢向前移动。" }
],
"duration": 5,
"ratio": "16:9",
"resolution": "480P"
}'创建响应
json
{
"id": "task_xxxxxxxxx",
"status": "queued"
}保存 id,用于查询、下载、取消或续接。
查询任务
bash
curl "https://YOUR_API_BASE_URL/v1/videos/task_xxxxxxxxx" \
-H "Authorization: Bearer sk-xxxxxxxx"状态为 queued → processing → succeeded / failed,建议 3–10 秒轮询一次。成功响应中的 content.video_url 指向下载接口。
下载视频
bash
curl -L "https://YOUR_API_BASE_URL/v1/videos/task_xxxxxxxxx/content" \
-H "Authorization: Bearer sk-xxxxxxxx" \
--output video.mp4取消任务
取消排队中或生成中的任务:
bash
curl -X DELETE "https://YOUR_API_BASE_URL/v1/videos/task_xxxxxxxxx" \
-H "Authorization: Bearer sk-xxxxxxxx"json
{ "id": "task_xxxxxxxxx", "action": "cancel", "status": "cancelled" }action为cancel表示取消;delete表示删除已结束任务的记录(仅部分模型支持)。- 已结束(
succeeded/failed)的任务返回409 task_already_finished。 - 不可取消的模型返回
501 task_cancellation_not_supported。 - 任务不存在或不属于当前 Key 返回
404 task_not_found。
取消是否退费取决于计费规则,以控制台为准。
续接视频
基于已成功的任务继续生成。请求体必须包含 duration,其余用 content 描述新增内容:
bash
curl "https://YOUR_API_BASE_URL/v1/videos/task_xxxxxxxxx/continue" \
-H "Authorization: Bearer sk-xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"duration": 5,
"content": [{ "type": "text", "text": "镜头继续向前推进,雨势变大。" }]
}'原任务未成功返回 400 task_not_completed。续接沿用首段任务的模型和参考素材,只接受 reference_image。
二次采样
对已生成视频做画质增强,沿用原任务的 latent:
bash
curl "https://YOUR_API_BASE_URL/v1/videos/task_xxxxxxxxx/second-sampling" \
-H "Authorization: Bearer sk-xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"target_resolution": "768P",
"dit_steps": 4,
"scale": 2,
"redraw": "保真"
}'| 字段 | 默认值 | 约束 |
|---|---|---|
target_resolution | 768P | 480P、768P |
dit_steps | 4 | 1–8 |
scale | 2 | 1–4 |
redraw | 保真 | 保真 或 标准 |
front | false | 是否前置 |
参数越界分别返回 400 invalid_target_resolution、400 invalid_second_sampling_parameters。
提示词优化
只改写提示词、不创建任务,需要该模型配置了优化器:
bash
curl "https://YOUR_API_BASE_URL/v1/prompts/optimize" \
-H "Authorization: Bearer sk-xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_H3_MODEL",
"prompt": "一片绿叶在湿润的石台上,清晨柔光。",
"duration": 4,
"ratio": "16:9"
}'也可以用 content 数组传参考素材;duration / seconds、ratio / aspect_ratio 二选一。参考视频会被抽帧后交给优化模型,参考音频只告知存在、不解析内容。
响应:
json
{
"prompt": "优化后的完整提示词……",
"original_prompt": "一片绿叶在湿润的石台上,清晨柔光。",
"model": "YOUR_H3_MODEL",
"optimizer_model": "内部优化模型",
"reference": { "images": 0, "videos": 0, "video_frames": 0, "audio": 0 }
}视频任务实际用了哪版提示词
POST /v1/videos 的创建/查询响应不返回提示词。需要核对时,可在控制台的请求记录中查看(需要登录),记录会区分调用方原始提示词与最终提交的提示词。
错误
| 状态码 / code | 含义 |
|---|---|
400 missing_model | 缺少 model |
400 missing_content | 缺少 content |
400 invalid_content | content 为空、缺少非空文本、素材 URL 不合法或素材类型无效 |
400 missing_duration / invalid_duration | 缺少时长,或时长不是整数 / 超出范围 |
400 missing_ratio | 缺少 ratio |
400 missing_resolution | 模型要求 resolution 但未提供 |
400 unsupported_parameter | 传了接口未定义的顶层字段 |
400 plugin_request_invalid | 模型不接受该字段或素材角色 |
400 invalid_request | 请求体不是合法 JSON,或参数格式错误 |
400 task_not_completed | 续接时原任务尚未成功 |
400 invalid_target_resolution | 二次采样目标分辨率不在允许范围 |
400 invalid_second_sampling_parameters | dit_steps 或 scale 越界 |
415 unsupported_media_type | 请求不是 application/json |
409 task_already_finished | 取消时任务已结束 |
501 task_cancellation_not_supported | 该模型不可取消 |
422 | 素材下载失败或超时 |
说明
- 模型 ID 与能力以
GET /v1/models和模型说明为准,文档不承诺固定模型清单。 - 请求包含接口未定义的显式参数时会返回
400,不会静默丢弃。生产环境请按模型能力构造请求。