MiniMax-H3

MiniMax-H3 can generate videos based on text, first frame pictures, first and last frame pictures, or pictures, videos, and audio references. The output specification of this site is 768P / 2K, and the duration is an integer from 4 to 15 seconds. Videos are obtained by first submitting, then querying, and finally downloading.

Before use, press Access Basics to set SHANHAI_BASE_URL (the root address of this site, excluding /v1) and SHANHAI_API_KEY (the token created on this site). The following examples all call the interface of this site; the image, video and audio addresses in the examples must be replaced with your own real public network address.

Basic information

Item Content
The model name on the site is MiniMax-H3, please keep this case
Submit task POST /v1/videos
Query task GET /v1/videos/{task_id}
media file download GET /v1/videos/{task_id}/content
Authentication Each request carries Authorization: Bearer YOUR_API_KEY

When submitting a request, you must also bring Content-Type: application/json. YOUR_API_KEY is a placeholder. When querying and downloading, replace {task_id} in the path with the id that submitted the response; only the site token is needed, no need to add X-Model-Name.

request parameters

Parameter Type Required Description
model string Yes Fixed fill in MiniMax-H3
prompt string Condition required Video description. Only fill in when text is generated; when using content, you can put the text into the text item
content array Conditions required Picture, video, audio input list, the structure is shown below. Use prompt when not passing; when passing in, it must contain a non-empty text item, or the text
duration integer (integer) No Output duration, 4 ~ 15 seconds, default 5. It is recommended to fill in
resolution string No Output resolution, fill in 768P / 2K, default 768P
ratio string (string) No aspect ratio, support 21:9, 16:9 , 4:3, 1:1, 3:4, 9:16, adaptive. The usage of each input method is shown in the table below

Put the description once in a text item in content. Older requests may still use top-level prompt, seconds, size and metadata.ratio. If both forms are present their values must agree. Images in images are references. Set role in content for a first or last frame.

Poll for task status. Unsupported top-level fields — generate_audio, callback_url, aigc_watermark, response_format.

Input method Usage of ratio
Only text Default 16:9; The above six specific ratios are optional, adaptive
The first or last frame picture The input image sets the aspect ratio. Use adaptive. Other valid ratios are treated as adaptive.
Reference picture or reference video Default adaptive, you can also specify the above six specific ratios
Reference picture or reference video and audio Default adaptive, you can also specify the above six specific ratios

768P / 2K is the resolution level, and the actual width and height will change with the ratio. The specifications listed in this article apply to MiniMax-H3 on this page.

The video studio offers 768P. For 2K, set resolution in a standard generation request.

How to fill in pictures, videos and audios

Each item in content uses type to specify the input type. The media address is placed in url of the corresponding object. role and type are on the same layer.

type Content field role Purpose
text "text": "视频描述" No need to fill in Text required for each request
image_url "image_url": {"url": "图片公网地址"} first_frame As the video start screen, up to 1 picture
image_url Same as above last_frame In conjunction with the first frame, it serves as the end picture of the video, up to 1 picture
image_url Same as above reference_image Reference character, object or style, up to 9 pictures
video_url "video_url": {"url": "视频公网地址"} reference_video Reference video, up to 3 segments
audio_url "audio_url": {"url": "音频公网地址"} reference_audio Reference audio, up to 3 segments

The first frame, first and last frame modes and the reference mode are mutually exclusive: after a request uses first_frame or last_frame, reference_image, reference_video or reference_audio cannot be added. The reference method can select one or more media as needed, and it is not necessary to provide all of them; however, reference audio cannot be used alone, and reference pictures or reference videos must be provided at the same time.

Input file limit

The following restrictions apply to materials provided via public addresses. The address should be able to return the file directly without logging in; the local path, the login page in the browser, or the download address that requires additional request headers cannot be used as materials. Please keep the material accessible until the task is completed.

Material Format Single file size Quantity and duration Other requirements
Picture JPG, JPEG, PNG, WEBP, HEIC, HEIF No more than 30 MB The first frame and the last frame are each at most 1; the reference picture is at most 9 Width and height are 2565760 pixels each, width/height are 0.42.5
Video MP4, MOV No more than 50 MB Up to 3 segments; each segment 2~15 seconds, total no more than 15 seconds Width and height are 2565760 pixels each, width/height is 0.42.5; frame rate is 23.976~60; video encoding H.264 or H.265, audio track encoding AAC or MP3
Audio WAV, MP3 No more than 15 MB Up to 3 segments; each segment 2~15 seconds, total no more than 15 seconds Use the directly downloadable audio file

Use up to 12 reference assets in total. Audio must have a directly downloadable public HTTPS URL. The request body limit is 64 MB. Prefer public URLs to embedding encoded files.

For a small image or video, set url to data:<MIME>;base64,<BASE64> using the file’s MIME type. The encoded request must fit the request size limit.

Request Example

Each JSON below is an independent submission request. Addresses with example.com are placeholders and must be replaced before use. Please fill in the materials according to the corresponding input method and comply with the format and size restrictions below.

Text generation video

{
  "model": "MiniMax-H3",
  "content": [{"type": "text", "text": "日出时,一只红色纸船在平静的池塘上缓缓漂动,水面泛起细小涟漪,镜头固定。"}],
  "duration": 4,
  "resolution": "768P",
  "ratio": "16:9"
}

The following command will submit the same request and works in Bash (Linux, macOS, or Git Bash):

curl "$SHANHAI_BASE_URL/v1/videos" \
  -H "Authorization: Bearer $SHANHAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-H3",
    "content": [{"type": "text", "text": "日出时,一只红色纸船在平静的池塘上缓缓漂动,水面泛起细小涟漪,镜头固定。"}],
    "duration": 4,
    "resolution": "768P",
    "ratio": "16:9"
  }'

First frame picture generation video

{
  "model": "MiniMax-H3",
  "content": [
    { "type": "text", "text": "画面中的纸船缓缓向前漂动,保持主体外观一致。" },
    {
      "type": "image_url",
      "image_url": { "url": "https://example.com/first-frame.png" },
      "role": "first_frame"
    }
  ],
  "duration": 5,
  "resolution": "768P",
  "ratio": "adaptive"
}

Generate video from first and last frame pictures

{
  "model": "MiniMax-H3",
  "content": [
    {
      "type": "text",
      "text": "从第一张图片自然过渡到最后一张图片,镜头平稳移动。"
    },
    {
      "type": "image_url",
      "image_url": { "url": "https://example.com/first-frame.png" },
      "role": "first_frame"
    },
    {
      "type": "image_url",
      "image_url": { "url": "https://example.com/last-frame.png" },
      "role": "last_frame"
    }
  ],
  "duration": 5,
  "resolution": "768P",
  "ratio": "adaptive"
}

One reference video and two reference images

{
  "model": "MiniMax-H3",
  "content": [
    {"type": "text", "text": "参考视频的运镜,用第一张图里的棉花和第二张图里的童装制作竖屏短片。"},
    {"type": "video_url", "role": "reference_video", "video_url": {"url": "https://example.com/clip.mp4"}},
    {"type": "image_url", "role": "reference_image", "image_url": {"url": "https://example.com/cotton.png"}},
    {"type": "image_url", "role": "reference_image", "image_url": {"url": "https://example.com/clothes.png"}}
  ],
  "duration": 4,
  "resolution": "2K",
  "ratio": "9:16"
}

Use picture, video and audio reference

{
  "model": "MiniMax-H3",
  "content": [
    {
      "type": "text",
      "text": "以参考图片中的人物为主角,参考视频中的镜头运动和音频中的音色,让人物自然说出:欢迎来到ShangHai Do。"
    },
    {
      "type": "image_url",
      "image_url": { "url": "https://example.com/reference.png" },
      "role": "reference_image"
    },
    {
      "type": "video_url",
      "video_url": { "url": "https://example.com/reference.mp4" },
      "role": "reference_video"
    },
    {
      "type": "audio_url",
      "audio_url": { "url": "https://example.com/reference.mp3" },
      "role": "reference_audio"
    }
  ],
  "duration": 5,
  "resolution": "768P",
  "ratio": "16:9"
}

Unnecessary references can be deleted; the quantity and total duration of each media must still comply with the input limits. You cannot keep only the reference audio and text; please keep at least one reference picture or a reference video at the same time.

Query tasks and downloads

Response example after successful submission:

{
  "id": "task_EXAMPLE",
  "object": "video",
  "model": "MiniMax-H3",
  "status": "queued",
  "progress": 0
}

Save the real id and query it every 15 to 20 seconds. TASK_ID below must be replaced with the real task number:

curl "$SHANHAI_BASE_URL/v1/videos/TASK_ID" \
  -H "Authorization: Bearer $SHANHAI_API_KEY"
Task status status Meaning and processing
queued Queuing, continue to query later
in_progress is being generated, continue to query
completed Completed, ready to download
failed Failed. Stop polling and check error.message if present.
unknown The status cannot be determined temporarily; keep the task number and check it later. If it continues to appear, contact the site customer service

progress is for display status only and does not represent the exact completion ratio. status should be used to determine whether it is completed, and an upper limit should be set for waiting. Successful submission does not mean successful generation; if the submission times out and id is not received, check the task list on this site first, and do not submit again immediately to avoid repeated generation and billing.

Query response example after task completion:

{
  "id": "task_EXAMPLE",
  "object": "video",
  "model": "MiniMax-H3",
  "status": "completed",
  "progress": 100
}

When the status is completed, download the video with the same task ID and site token.

curl --fail --location "$SHANHAI_BASE_URL/v1/videos/TASK_ID/content" \
  -H "Authorization: Bearer $SHANHAI_API_KEY" \
  -o result.mp4

If the media address has expired, the file cannot be read temporarily, or the download fails, please keep the original task number and contact the site customer service for verification; do not try to restore the same video by regenerating it.

Python complete example

First set the two environment variables in Access Basics and install the dependencies:

python -m pip install requests

The following program is only submitted once, save the task number in minimax-h3-task.txt in the current directory, and then query and save the video. When running again, if the file exists, the original task will continue to be queried. Only when you really need to generate a new video, delete the file and run again. The upper limit of waiting time is 20 minutes, which is the setting of this example. It does not mean that the task will be completed within this time.

import os
import time
from pathlib import Path

import requests

base_url = os.environ["SHANHAI_BASE_URL"].rstrip("/")
api_key = os.environ["SHANHAI_API_KEY"]
headers = {"Authorization": f"Bearer {api_key}"}
task_file = Path("minimax-h3-task.txt")

payload = {
    "model": "MiniMax-H3",
    "content": [{"type": "text", "text": "日出时,一只红色纸船在平静的池塘上缓缓漂动,水面泛起细小涟漪,镜头固定。"}],
    "duration": 4,
    "resolution": "768P",
    "ratio": "16:9",
}

if task_file.exists():
    task_id = task_file.read_text(encoding="utf-8").strip()
    if not task_id:
        raise SystemExit("任务编号文件为空,请先到本站任务列表核对。")
else:
    try:
        response = requests.post(
            f"{base_url}/v1/videos",
            headers=headers,
            json=payload,
            timeout=(10, 90),
        )
    except requests.RequestException as exc:
        raise SystemExit(
            "提交结果不确定,请先到本站任务列表核对,勿直接重跑提交。"
        ) from exc
    if not response.ok:
        raise SystemExit(
            f"提交返回异常,请先核对任务记录:{response.status_code} {response.text}"
        )
    task_id = response.json().get("id")
    if not task_id:
        raise SystemExit("未收到任务编号,请先到本站任务列表核对,勿重复提交。")
    task_file.write_text(task_id, encoding="utf-8")

print(f"任务编号:{task_id}")
deadline = time.monotonic() + 20 * 60

while time.monotonic() < deadline:
    time.sleep(20)
    try:
        response = requests.get(
            f"{base_url}/v1/videos/{task_id}",
            headers=headers,
            timeout=30,
        )
    except requests.RequestException:
        print("查询暂时失败,稍后继续查询原任务。")
        continue
    if response.status_code == 429 or response.status_code >= 500:
        print(f"查询暂时不可用:{response.status_code},稍后继续。")
        continue
    if not response.ok:
        raise SystemExit(f"查询失败:{response.status_code} {response.text}")
    result = response.json()
    status = result.get("status")
    print(f"当前任务状态:{status}")
    if status == "failed":
        message = (result.get("error") or {}).get("message", "任务失败")
        raise SystemExit(f"{message};请保留任务编号:{task_id}")
    if status == "completed":
        break
else:
    raise SystemExit(f"等待已达上限。任务编号已保存,可稍后重新运行继续查询:{task_id}")

# 只有任务完成后才下载;下载失败可使用原任务编号继续获取。
output = Path("result.mp4")
partial = Path("result.mp4.part")
with requests.get(
    f"{base_url}/v1/videos/{task_id}/content",
    headers=headers,
    stream=True,
    timeout=(10, 120),
) as response:
    response.raise_for_status()
    with partial.open("wb") as file:
        for chunk in response.iter_content(chunk_size=1024 * 1024):
            if chunk:
                file.write(chunk)
partial.replace(output)
print(f"视频已保存:{output.resolve()}")

When you need to change it to a picture or multiple media reference, replace payload with the corresponding JSON content above, and fill in the real material address; the Python dictionary is written in the same way as these examples.

Fees and FAQs

encountered a problem

If you encounter problems with calling or configuration, please contact the site customer service and provide the model name, error time and error information to facilitate troubleshooting.