minimax-video-h3-max API

Generates 5–15-second video at 480p or 768p from text, a first frame, or first and last frames. Four-second clips, middle frames, and multimodal references are unavailable.

POST /v1/videos/generations

Supports text-to-video, frame-to-video, and first-and-last-frame-to-video generation, 480P / 768P, 5–15 seconds.

Text-to-video

Required parameters: model, prompt, resolution

Available parameters: model, prompt, content, resolution, duration, ratio, aspect_ratio, aigc_watermark, wait, idempotency_key

Image-to-video from first frame

Required parameters: model, first_frame_url, resolution

Available parameters: model, prompt, content, resolution, duration, ratio, aspect_ratio, aigc_watermark, wait, idempotency_key, first_frame_url

First-and-last-frame video generation

Required parameters: model, first_frame_url, last_frame_url, resolution

Available parameters: model, prompt, content, resolution, duration, ratio, aspect_ratio, aigc_watermark, wait, idempotency_key, first_frame_url, last_frame_url

Request parameters

ParameterTypeRequiredDescription
modelstringYesModel ID. Options: minimax-video-h3-max
promptstringNoText prompt, describing the scene and motion. Required for text-to-video; optional for image-to-video, to describe how the scene evolves. Can also be passed via a content array (if content is provided, this field is overridden).
resolutionstringYesOutput resolution, required, case-insensitive. Only supports 480P / 768P; do not pass 720P, 1080P, 2K, or other values. Options: 480P / 768P
durationintegerNoVideo duration (seconds), an integer multiple of 5–15, default 5. If less than 5 seconds, generated as 5 seconds and charged accordingly.
ratiostringNoScene aspect ratio. Default 16:9 for text-to-video if not provided; follows the first frame image's aspect ratio for image-to-video if not provided. Options: 16:9 / 9:16 / 1:1 / 4:3 / 3:4 / 21:9
first_frame_urlstringNoURL of the first frame image, from which the video begins.
last_frame_urlstringNoURL of the last frame image, must be provided together with first_frame_url, the video transitions from the first to the last frame.
contentarrayNoNative input array, can replace prompt / first_frame_url / last_frame_url (if content is provided, these fields are ignored). Element types: - Text: { "type": "text", "text": "..." } - Image: { "type": "image_url", "image_url": { "url": "..." }, "role": "first_frame" | "last_frame" } Up to 2 images (one 1 for first and last frame); does not support reference images / reference videos / reference audio.
aspect_ratiostringNoEquivalent to ratio; pass one or the other; if both are provided, ratio takes precedence.
aigc_watermarkbooleanNoWhether to add an AIGC-generated watermark in the video, default is not to add one.
waitbooleanNoWhen true, the maximum waiting time is approximately 60 seconds: if generation completes within this period, the result is returned directly; otherwise, a task in progress is returned, and the result must be retrieved via the query interface. It is recommended to use the default asynchronous method.
idempotency_keystringNoIdempotency key: when the same key is submitted repeatedly, the same task is returned and no duplicate creation or billing occurs.
## Complete example (Python) Submit task → Poll result → Download video: ```python import time import requests API_KEY = "sk-你的令牌" BASE = "https://api.router.ai/v1/videos/generations" headers = {"Authorization": f"Bearer {API_KEY}"} # 1) 提交任务 resp = requests.post(BASE, headers=headers, json={ "model": "minimax-video-h3-max", "prompt": "一只橙色小猫坐在窗台上,慢慢转头看向镜头,午后阳光", "resolution": "768P", "duration": 5, "ratio": "16:9", }) resp.raise_for_status() task_id = resp.json()["id"] # 2) 每 10 秒查询一次,直到结束 while True: task = requests.get(f"{BASE}/{task_id}", headers=headers).json() if task["status"] in ("succeeded", "failed", "timeout"): break time.sleep(10) # 3) 下载视频(链接 12 小时内有效) if task["status"] == "succeeded": url = task["task"]["content"]["url"] with open("output.mp4", "wb") as f: f.write(requests.get(url).content) print("已保存 output.mp4") else: print("生成失败:", task.get("error")) ``` ## Query result when generation fails ```json { "id": "vt_7f3c2a9e5b1d4c8a9e0b7d6e5f4a3b2c", "model": "minimax-video-h3-max", "status": "failed", "created_at": 1791734400, "error": { "code": "failed", "message": "<失败原因>" } } ``` **Failed or timeout tasks do not incur charges.** ## Task status | Status | Meaning | |---|---| | `pending` / `submitted` / `processing` | In progress, continue polling | | `succeeded` | Generation successful, video URL at `task.content.url` | | `failed` | Generation failed, reason see `error.message` | | `timeout` | Generation timeout |

Request example

# 1) 提交任务:返回 202 和任务 id
curl https://api.router.ai/v1/videos/generations \
  -H "Authorization: Bearer sk-你的令牌" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-video-h3-max",
    "prompt": "一只橙色小猫坐在窗台上,慢慢转头看向镜头,午后阳光",
    "resolution": "768P",
    "duration": 5,
    "ratio": "16:9"
  }'

# 2) 查询结果:用上一步返回的 id,每 10 秒查一次,
#    直到 status 为 succeeded(成功)或 failed / timeout(失败)
curl https://api.router.ai/v1/videos/generations/vt_7f3c2a9e5b1d4c8a9e0b7d6e5f4a3b2c \
  -H "Authorization: Bearer sk-你的令牌"

Endpoint reference: Aliyun Wan video generation