Generate
REST APIModel Specifics

MiniMax H3

Choose adaptive framing, set a video's length by frame count, and upscale your own 768p video to 2K.

Adaptive aspect ratio

Set video_config.aspect_ratio to "adaptive" to choose the output framing from your source images or reference videos. This is available on MiniMax-H3 and MiniMax-H3-MultiMax at height: 480 or 768. Accounts with 1080p access can also use it at height: 1080. MiniMax-H3 also supports adaptive framing at height: 1440 (2K).

  • I2V / first-and-last-frame video: uses the first source image's orientation and proportions. The prompt and end frame do not override the framing.
  • R2V: considers the prompt and reference images or videos. Include at least one image or video; audio-only references cannot determine the framing.
  • T2V: requires a fixed ratio, such as "16:9" or "9:16".

The output uses a supported framing: 16:9, 9:16, 1:1, 4:3, 3:4, or 21:9. I2V selects the closest one to the source image and may crop it to fit. Adaptive framing also works when prompt enhancement is turned off.

Adaptive image-to-video
curl https://api.machgen.ai/api/v0/generate \
  -H "Authorization: Bearer $MACHGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-H3",
    "task_type": "I2V",
    "prompt": "The dog looks around and gently tilts its head.",
    "src_image_urls": ["https://example.com/dog.jpg"],
    "video_config": {"duration_secs": 5, "height": 768, "aspect_ratio": "adaptive"}
  }'

Replace the image URL with your own publicly accessible image, or upload one and use "@input/<artifact_path>". The response's metadata.aspect_ratio, metadata.width, and metadata.height report the selected framing and size. For example, a 3:4 image at 768p produces a 768x1024 video.

Set a video's length

There are two ways to set how long a video is. Send exactly one of them in video_config - a request with both, or neither, is rejected with HTTP 400.

  • duration_secs: whole seconds, from the model's list of durations. Works on every video model.
  • num_frames: a frame count, for lengths between whole seconds. MiniMax-H3 accepts it for T2V, I2V, F2F, and R2V at 24 FPS. Other models reject it with HTTP 400.

Want 3.75 seconds? Send num_frames: 90 - seconds x 24.

Frame count
curl https://api.machgen.ai/api/v0/generate \
  -H "Authorization: Bearer $MACHGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A red panda exploring a misty forest at dawn",
    "model": "MiniMax-H3",
    "task_type": "T2V",
    "video_config": {"num_frames": 90, "height": 768, "aspect_ratio": "16:9"}
  }'

MiniMax-H3 renders frame counts of 17n + 5: 22, 39, 56, 73, 90, and so on up to 362. Any other count from 14 to 370 moves to the nearest of these, so num_frames: 60 renders 56 frames (2.33 seconds). An exact tie goes to the shorter one. The response returns the count used in metadata.num_frames, and the exact length in seconds in metadata.duration_secs:

Response (excerpt)
{
  "task_id": "t-abc123",
  "metadata": {"num_frames": 90, "duration_secs": 3.75, "fps": 24, ...}
}

All the frame counts MiniMax-H3 renders, with their length in seconds:

FramesSecondsFramesSecondsFramesSeconds
220.92391.62562.33
733.04903.751074.46
1245.171415.881586.58
1757.2919282098.71
2269.4224310.1226010.83
27711.5429412.2531112.96
32813.6734514.3836215.08

The request is rejected with HTTP 400 when:

  • num_frames is below 14 or above 370 (it would render fewer than 22 or more than 362 frames).
  • fps is set to anything but 24 (or leave it out).
  • the model or task type doesn't take num_frames, or reference_video_operation keeps the source video's length.

A frame-count video is billed by the second, rounded to the nearest whole second (an exact half rounds down): 56 frames bill as 2 seconds, 124 frames (5.17 seconds) as 5.

With the Python SDK, see Set a video's length.

Upscale your own video to 2K

Send a 768p video and get the same clip back at 2K (1440p), sharper and more detailed, with its length and sound unchanged. This is available through the API only.

First upload the video. The response gives you an artifact_path:

Upload
curl https://api.machgen.ai/api/v0/upload \
  -H "Authorization: Bearer $MACHGEN_API_KEY" \
  -F "file=@my_video.mp4"

Then start the upscale with @input/ in front of that artifact_path:

Upscale
curl https://api.machgen.ai/api/v0/generate \
  -H "Authorization: Bearer $MACHGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A red panda exploring a misty forest at dawn",
    "model": "MiniMax-H3",
    "task_type": "UPSCALE",
    "src_video_urls": ["@input/<artifact_path>"],
    "video_config": {"height": 1440, "duration_secs": 1}
  }'

Leave duration_secs as it is. Your video keeps its own length.

For the best result, send the original prompt that made the video. If you don't have it, send an empty prompt.

Which videos work

Videos made with MiniMax-H3 at 768p work as they are. Other videos need to match the same format:

  • 768p, landscape, portrait or square (for example 1344x768)
  • 24 frames per second
  • A length H3 can make, from about 1 to 15 seconds. Most whole-second lengths, like 5 or 10 seconds, don't fit, so check the frame table.
  • MP4 or MOV, up to 50 MB
  • Stereo, mono or no audio
  • Uploaded to MachGen first. Links to other sites aren't accepted.

If a video doesn't fit, the API says what to change, and you won't be charged.