跳转到内容

MiniMax H3 视频(workflow_id)

MiniMax H3 通过 OpenAI 兼容的异步视频接口调用:提交任务 → 轮询状态 → 下载成片。每个请求用 workflow_id 选择工作流,工作流决定可以带哪些参考素材以及支持的尺寸。

POST https://api.4allapi.com/v1/videos
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json (上传本地文件时用 multipart/form-data)

模型名请使用 minimax-h3(以控制台模型广场显示的名称为准)。MiniMax H3 只支持 OpenAI 协议,不支持 Gemini predictLongRunning。

workflow_id参考素材尺寸
text-to-video不接收任何参考素材,仅文生视频最高 1080P
fl2v1–2 张图片;两张时按顺序作为首帧、尾帧;不支持视频和音频最高 1080P
multi-reference可选;图片最多 9 张,视频、音频各最多 3 个最高 1080P
cf-fl2v同 fl2v必须为 2K 或 4K
cf-multi-reference同 multi-reference必须为 2K 或 4K

三步选择:只有文字 → text-to-video;有 1–2 张图片想指定首帧或首尾帧 → fl2v;有多张图片、参考视频或参考音乐 → multi-reference。需要 2K/4K 成片时改用对应的 cf- 工作流。

不符合工作流规则的请求(如 text-to-video 带图片、fl2v 没有图片、超出数量、cf- 工作流不是 2K/4K)会在提交前直接返回 400,不扣费。

参数类型必填说明
modelstring是minimax-h3
promptstring是视频描述
workflow_idstring是见上表
secondsinteger否4–15 秒,默认 10
resolutionstring否480p、768p、1080p;2k、4k 仅 cf- 工作流可用
aspect_ratiostring否16:9(默认)、9:16、1:1、2:3、3:2、3:4、4:3、21:9
imagesstring[]视工作流公网图片 URL;fl2v 中第 1 张为首帧、第 2 张为尾帧
reference_videosstring[]否公网视频 URL,最多 3 个(仅 multi-reference)
reference_audiosstring[]否公网音频 URL,最多 3 个(仅 multi-reference)
prompt_enhanceboolean否提示词增强,默认开启

resolution 与 aspect_ratio 会换算成上游的标准画布尺寸,例如 768P 16:9 = 1376x768,1080P 16:9 = 1920x1088,1080P 9:16 = 1088x1920。2K/4K 以 2K/4K 加画幅比例提交。

素材限制:图片支持 JPG/PNG/WEBP/HEIC/HEIF,单张不超过 30 MB;视频 MP4/MOV,单个不超过 50 MB、2–15 秒;音频 WAV/MP3,单个不超过 15 MB、2–15 秒;视频、音频总时长各不超过 15 秒。JSON 请求必须使用公网 http(s) URL,不接受 Base64 / Data URL;本地文件请用 multipart 上传。

Terminal window
curl https://api.4allapi.com/v1/videos \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "minimax-h3",
"prompt": "一位身穿红色连衣裙的舞者在明亮舞台上自然起舞,镜头平稳推进,电影级光影",
"workflow_id": "text-to-video",
"seconds": 10,
"resolution": "1080p",
"aspect_ratio": "16:9"
}'
Terminal window
curl https://api.4allapi.com/v1/videos \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "minimax-h3",
"prompt": "从首帧平滑过渡到尾帧,镜头运动自然稳定",
"workflow_id": "fl2v",
"seconds": 10,
"resolution": "768p",
"aspect_ratio": "9:16",
"images": [
"https://cdn.example.com/first-frame.png",
"https://cdn.example.com/last-frame.png"
]
}'

只给 1 张图片时,它作为首帧。

示例:多素材参考(multi-reference)

Section titled “示例:多素材参考(multi-reference)”
Terminal window
curl https://api.4allapi.com/v1/videos \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "minimax-h3",
"prompt": "将参考人物、动作和音乐融合成一段自然舞蹈视频",
"workflow_id": "multi-reference",
"seconds": 8,
"resolution": "1080p",
"aspect_ratio": "16:9",
"images": ["https://cdn.example.com/person.png", "https://cdn.example.com/outfit.png"],
"reference_videos": ["https://cdn.example.com/dance.mp4"],
"reference_audios": ["https://cdn.example.com/music.mp3"]
}'
Terminal window
curl https://api.4allapi.com/v1/videos \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "minimax-h3",
"prompt": "从首帧平滑过渡到尾帧,镜头运动自然稳定",
"workflow_id": "cf-fl2v",
"seconds": 10,
"resolution": "4k",
"aspect_ratio": "16:9",
"images": ["https://cdn.example.com/first-frame.png", "https://cdn.example.com/last-frame.png"]
}'

图片用重复的 image[],视频用 video[],音频用 audio[],其余参数作为普通表单字段。文件会先转存到图床再提交上游。

Terminal window
curl https://api.4allapi.com/v1/videos \
-H "Authorization: Bearer $API_KEY" \
-F "model=minimax-h3" \
-F "prompt=从首帧平滑过渡到尾帧" \
-F "workflow_id=fl2v" \
-F "seconds=10" \
-F "resolution=768p" \
-F "aspect_ratio=16:9" \
-F "image[]=@first.png;type=image/png" \
-F "image[]=@last.png;type=image/png"
import time
import requests
BASE_URL = "https://api.4allapi.com"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}
body = {
"model": "minimax-h3",
"prompt": "从首帧平滑过渡到尾帧,镜头运动自然稳定",
"workflow_id": "fl2v",
"seconds": 10,
"resolution": "1080p",
"aspect_ratio": "16:9",
"images": [
"https://cdn.example.com/first-frame.png",
"https://cdn.example.com/last-frame.png",
],
}
task = requests.post(f"{BASE_URL}/v1/videos", headers=HEADERS, json=body).json()
task_id = task["id"]
while task.get("status") not in ("completed", "failed"):
time.sleep(5)
task = requests.get(f"{BASE_URL}/v1/videos/{task_id}", headers=HEADERS).json()
print(task.get("status"), task.get("progress"))
if task["status"] == "completed":
video = requests.get(f"{BASE_URL}/v1/videos/{task_id}/content", headers=HEADERS)
video.raise_for_status()
open("output.mp4", "wb").write(video.content)
Terminal window
# 查询状态:queued / in_progress / completed / failed
curl https://api.4allapi.com/v1/videos/<TASK_ID> -H "Authorization: Bearer $API_KEY"
# 下载成片(需同一个 API Key)
curl -L https://api.4allapi.com/v1/videos/<TASK_ID>/content \
-H "Authorization: Bearer $API_KEY" -o output.mp4
提示原因
workflow text-to-video is text-to-video only and accepts no reference mediatext-to-video 带了参考素材
workflow fl2v needs 1-2 images; got 0fl2v / cf-fl2v 缺少图片或超过 2 张
workflow cf-fl2v requires size 2K or 4Kcf- 工作流的 resolution 不是 2k/4k
2K/4K requires a cf- workflow非 cf- 工作流使用了 2k/4k
seconds must be between 4 and 15时长超出 4–15 秒
unsupported video aspect ratio画幅比例不在支持列表内
workflow xxx is not configured for minimax-h3当前分组未开放该工作流