curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "MiniMax-H3-Max",
"prompt": "雨夜霓虹街头,穿风衣的侦探回头,镜头缓缓推近,水面倒影闪烁。",
"duration": 5,
"resolution": "768P",
"aspect_ratio": "16:9"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "MiniMax-H3-Max",
"prompt": "雨夜霓虹街头,穿风衣的侦探回头,镜头缓缓推近,水面倒影闪烁。",
"duration": 5,
"resolution": "768P",
"aspect_ratio": "16:9",
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/videos/generations";
const payload = {
model: "MiniMax-H3-Max",
prompt: "雨夜霓虹街头,穿风衣的侦探回头,镜头缓缓推近,水面倒影闪烁。",
duration: 5,
resolution: "768P",
aspect_ratio: "16:9",
};
fetch(url, {
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ"
}
]
}
{
"error": {
"code": 400,
"message": "请求参数无效",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "身份验证失败,请检查您的 API 密钥",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "账户余额不足,请充值后再试",
"type": "payment_required"
}
}
{
"error": {
"code": 422,
"message": "内容安全审核未通过",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 429,
"message": "请求过于频繁,请稍后再试",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "服务器内部错误,请稍后重试",
"type": "server_error"
}
}
MiniMax-H3
MiniMax-H3-Max 视频生成
- MiniMax 视频生成 V2 极速版,异步返回任务 ID
- 支持文生视频与图生视频(首帧 / 尾帧 / 首尾帧)
- 支持 768P / 480P,时长 5 ~ 15 秒,输出带音轨
- 不支持 2K、中间帧或多模态参考生视频
POST
/
v1
/
videos
/
generations
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "MiniMax-H3-Max",
"prompt": "雨夜霓虹街头,穿风衣的侦探回头,镜头缓缓推近,水面倒影闪烁。",
"duration": 5,
"resolution": "768P",
"aspect_ratio": "16:9"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "MiniMax-H3-Max",
"prompt": "雨夜霓虹街头,穿风衣的侦探回头,镜头缓缓推近,水面倒影闪烁。",
"duration": 5,
"resolution": "768P",
"aspect_ratio": "16:9",
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/videos/generations";
const payload = {
model: "MiniMax-H3-Max",
prompt: "雨夜霓虹街头,穿风衣的侦探回头,镜头缓缓推近,水面倒影闪烁。",
duration: 5,
resolution: "768P",
aspect_ratio: "16:9",
};
fetch(url, {
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ"
}
]
}
{
"error": {
"code": 400,
"message": "请求参数无效",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "身份验证失败,请检查您的 API 密钥",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "账户余额不足,请充值后再试",
"type": "payment_required"
}
}
{
"error": {
"code": 422,
"message": "内容安全审核未通过",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 429,
"message": "请求过于频繁,请稍后再试",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "服务器内部错误,请稍后重试",
"type": "server_error"
}
}
模型选择:
MiniMax-H3-Max 适合只需文生视频或首尾帧控制、优先生成速度的场景。需要 2K、中间帧、参考图、参考视频或参考音频时,请使用 MiniMax-H3。curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "MiniMax-H3-Max",
"prompt": "雨夜霓虹街头,穿风衣的侦探回头,镜头缓缓推近,水面倒影闪烁。",
"duration": 5,
"resolution": "768P",
"aspect_ratio": "16:9"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "MiniMax-H3-Max",
"prompt": "雨夜霓虹街头,穿风衣的侦探回头,镜头缓缓推近,水面倒影闪烁。",
"duration": 5,
"resolution": "768P",
"aspect_ratio": "16:9",
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/videos/generations";
const payload = {
model: "MiniMax-H3-Max",
prompt: "雨夜霓虹街头,穿风衣的侦探回头,镜头缓缓推近,水面倒影闪烁。",
duration: 5,
resolution: "768P",
aspect_ratio: "16:9",
};
fetch(url, {
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ"
}
]
}
{
"error": {
"code": 400,
"message": "请求参数无效",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "身份验证失败,请检查您的 API 密钥",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "账户余额不足,请充值后再试",
"type": "payment_required"
}
}
{
"error": {
"code": 422,
"message": "内容安全审核未通过",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 429,
"message": "请求过于频繁,请稍后再试",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "服务器内部错误,请稍后重试",
"type": "server_error"
}
}
认证
string
必填
所有接口均使用 Bearer Token 认证。访问 API Key 管理页面 获取密钥。
Authorization: Bearer YOUR_API_KEY
选择模型
| 能力 | MiniMax-H3 | MiniMax-H3-Max |
|---|---|---|
| 分辨率 | 2K / 768P,默认 2K | 768P / 480P,默认 768P |
| 时长 | 4 ~ 15 秒 | 5 ~ 15 秒 |
| 文生视频 | 支持 | 支持 |
| 首帧 / 尾帧 / 首尾帧 | 支持 | 支持 |
| 中间帧 | 支持 | 不支持 |
| 多模态参考 | 参考图、视频、音频 | 不支持 |
| 输入图片费用 | 5 张以内免费 | 免费 |
MiniMax-H3-Max 不支持 2K,也不能作为 Regeneration 的源任务。需要这些能力时请使用 MiniMax-H3。生成模式
MiniMax-H3-Max 根据请求字段自动识别生成模式,无需传递mode:
| 模式 | 触发条件 | 说明 |
|---|---|---|
| 文生视频(T2V) | 只传 prompt 及通用字段 | 纯文本驱动生成 |
| 图生视频(I2V) | 传 first_frame_image / last_frame_image,或在 image_with_roles 中指定首尾帧 | 支持首帧、尾帧或首尾帧控制 |
本模型不支持
image_urls、video_urls、audio_urls,也不支持 image_with_roles[].role = "reference_image"。传入任一参考素材字段会同步返回 400,不创建任务、不扣费。请求参数
string
必填
固定值:
MiniMax-H3-Max模型 ID 大小写不敏感,minimax-h3-max 也可使用。string
必填
视频内容描述,任何场景都必填且不能为空。
- 上限:
7000个字符 - 按字符数计算,中文一个字计一个字符
integer
默认值:"5"
视频时长(秒)。
- 取值:
5~15的整数 - 默认:
5 - 不支持
4秒
string
默认值:"768P"
输出分辨率。
768P(默认)480P
不支持
2K、1440P 或 2048P,传入后会同步返回 400,不会自动降级。string
输出宽高比。也可使用
size 或 ratio 传递。文生视频可选:21:9、16:9、4:3、1:1、3:4、9:16。- 文生视频不传或传
adaptive:自动回落为16:9 - 图生视频:宽高比由输入图片决定,此参数会被忽略
string
首帧图片的公网 URL。传入后以该图片作为视频起始画面。
string
尾帧图片的公网 URL。可以单独使用,也可与
first_frame_image 组合实现首尾帧控制。object[]
boolean
默认值:"false"
是否添加 AIGC 水印。兼容字段名:
aigc_watermark。string
任务成功或失败时,本服务向该地址推送终态通知。
请使用
webhook,不要传 MiniMax 官方的 callback_url。callback_url 由本服务内部使用,不接受用户传入。不支持的参数
以下参数或取值会同步返回 400,不创建任务、不扣费:| 参数 / 取值 | 原因 |
|---|---|
image_urls | 裸图片数组按参考图处理,本模型不支持参考图 |
image_with_roles[].role = "reference_image" | 本模型只支持首帧和尾帧 |
video_urls / video_url | 不支持参考视频 |
audio_urls / audio_url | 不支持参考音频 |
resolution: "2K" | 仅支持 768P 和 480P |
duration: 4 或大于 15 | 仅支持 5 ~ 15 秒 |
需要参考素材、2K、中间帧或 4 秒视频时,将
model 改为 MiniMax-H3,并按 MiniMax-H3 视频生成文档 调整参数。图片限制
请求体总大小不得超过 64 MB。图片请使用公网 URL,不要使用 Base64。| 项目 | 限制 |
|---|---|
| 格式 | JPG / JPEG / PNG / WEBP / HEIC / HEIF |
| 单文件大小 | ≤ 30 MB |
| 宽高 | 256 ~ 5760 px |
| 宽高比(宽 / 高) | 0.4 ~ 2.5 |
| 数量 | 首帧 ≤ 1、尾帧 ≤ 1,合计最多 2 张 |
请求示例
文生视频
{
"model": "MiniMax-H3-Max",
"prompt": "一个男孩在海边打篮球,黄昏,海浪拍岸,电影感运镜",
"duration": 6,
"resolution": "768P",
"aspect_ratio": "16:9"
}
首帧图生视频
{
"model": "MiniMax-H3-Max",
"prompt": "镜头缓慢推近,蒸汽升腾,背景人物走动",
"first_frame_image": "https://cdn.example.com/ramen.png",
"duration": 5,
"resolution": "480P"
}
首尾帧图生视频
{
"model": "MiniMax-H3-Max",
"prompt": "镜头从清晨缓慢过渡到日落",
"first_frame_image": "https://cdn.example.com/morning.png",
"last_frame_image": "https://cdn.example.com/sunset.png",
"duration": 8,
"resolution": "768P"
}
使用 image_with_roles
{
"model": "MiniMax-H3-Max",
"prompt": "镜头从清晨缓慢过渡到日落",
"image_with_roles": [
{
"url": "https://cdn.example.com/morning.png",
"role": "first_frame"
},
{
"url": "https://cdn.example.com/sunset.png",
"role": "last_frame"
}
],
"duration": 8
}
查询任务
提交成功后返回task_id。使用 获取任务状态 查询生成进度和结果:
curl https://api.apimart.ai/v1/tasks/task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ \
--header 'Authorization: Bearer <token>'
{
"code": 200,
"data": {
"id": "task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ",
"status": "completed",
"progress": 100,
"cost": 0.375,
"result": {
"videos": [
{
"url": ["https://cdn.example.com/output.mp4"],
"expires_at": 1785315415
}
]
}
}
}
status | 含义 |
|---|---|
pending | 已提交或排队中 |
processing | 生成中 |
completed | 成功,视频地址位于 result.videos[0].url |
failed | 失败,查看 error.message;费用会自动退回 |
视频 URL 通常约 24 小时有效,请及时下载并转存。
计费
总费用按视频时长计算,首帧和尾帧图片不额外收费:| 项目 | 单价 |
|---|---|
| 768P 视频 | $0.075 / 秒 |
| 480P 视频 | $0.0495 / 秒 |
| 输入图片 | 免费 |
| 示例 | 费用 |
|---|---|
| 768P / 5 秒 | $0.375 |
| 768P / 10 秒 | $0.75 |
| 480P / 10 秒 | $0.495 |
| 480P / 15 秒 | $0.7425 |
cost 为准。
错误处理
| 场景 | 状态码 / 处理 |
|---|---|
prompt 为空或超过 7000 字符 | 400,不创建任务 |
duration 不在 5 ~ 15 | 400,不创建任务 |
resolution 不是 768P / 480P | 400,不创建任务 |
| 传入参考图、参考视频或参考音频 | 400,不创建任务 |
| 图片角色无效或同一角色超过一张 | 400,不创建任务 |
| 余额不足 | 402 |
| 内容安全审核未通过 | 422 |
| 请求过于频繁 | 429,退避后重试 |
failed,error.message 会说明原因,预扣费用自动退回。
Response
integer
响应状态码,成功时为 200