Generate
REST APIModel Specifics

MiniMax H3

Set a video's length by frame count.

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.