Generate

MiniMax H3

Animate a reference image with supplied audio, choose adaptive framing, set video length, and upscale to 2K.

Audio to video (A2V)

Animate one reference image using a supplied audio track with model: "MiniMax-H3" and task_type: "A2V". The supplied audio is kept in the result. A2V is available to accounts with early access; contact support to enable it. Requests from an account without access return HTTP 403.

Upload your image and audio

Use a single-frame image and an audio clip with clear speech. Upload both with your own API key. Each response contains an artifact_path:

Upload the reference image
curl --fail-with-body https://api.machgen.ai/api/v0/upload \
  -H "Authorization: Bearer $MACHGEN_API_KEY" \
  -H "X-MachGen-Upload-Model: MiniMax-H3" \
  -F "file=@portrait.png"
Upload the audio
curl --fail-with-body https://api.machgen.ai/api/v0/upload \
  -H "Authorization: Bearer $MACHGEN_API_KEY" \
  -H "X-MachGen-Upload-Model: MiniMax-H3" \
  -F "file=@speech.wav"

Prefix each returned path with @input/ in the generation request. Publicly accessible HTTPS image and audio URLs also work.

Generate with automatic transcription

Leave video_config out. The image determines the output dimensions, and the audio determines the output length. With enhance_prompt: true, the API transcribes the speech and prepares the generation prompt. Your prompt can contain scene or motion instructions, or be an empty string.

Audio to video
curl --fail-with-body https://api.machgen.ai/api/v0/generate \
  -H "Authorization: Bearer $MACHGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-H3",
    "task_type": "A2V",
    "prompt": "The person speaks naturally to the camera in a fixed shot.",
    "enhance_prompt": true,
    "src_image_urls": ["@input/<image_artifact_path>"],
    "src_audio_urls": ["@input/<audio_artifact_path>"]
  }'

The response contains a task_id. Prompt preparation continues in the background on that same task. Poll its status; do not submit the request again to check progress. Another POST creates another task, even with the same inputs or an Idempotency-Key header.

Supply a transcript

To skip automatic speech recognition, add private_config.transcript to the request above and keep enhance_prompt: true. Prompt enhancement still runs. The transcript should match the words in the selected audio clip; it does not replace the audio or generate a new voice.

Add a transcript
{
  "private_config": {
    "transcript": "Welcome to our demo. Today we will show you how it works."
  }
}

Use plain spoken text, up to 6,000 characters. Do not put [Shot N], <Subject N>, <Picture N>, <Audio N>, <d> or </d> tags in a transcript.

Use your own final prompt

Set enhance_prompt: false to skip both transcription and prompt enhancement. Supply a nonempty, single-shot prompt containing the exact line <Audio 1>: fully_copy. The prompt must fit within 24,000 UTF-8 bytes. Keep video_config omitted when supplying ordinary image and audio files.

Request with enhancement disabled
{
  "model": "MiniMax-H3",
  "task_type": "A2V",
  "prompt": "[Shot 1]\nA fixed medium shot of the person speaking naturally to camera.\n<Audio 1>: fully_copy",
  "enhance_prompt": false,
  "src_image_urls": ["@input/<image_artifact_path>"],
  "src_audio_urls": ["@input/<audio_artifact_path>"]
}

Input limits and audio selection

InputSupported values
ImageExactly one PNG, JPEG or WebP, up to 30 MB; no animated images. Each edge must be 128-5,760 pixels, with at most 16 million pixels and an aspect ratio from 1:4 to 4:1.
AudioExactly one WAV, MP3, FLAC, OGG, M4A or AAC, up to 50 MB. The selected audio must be 0.25-14.3 seconds long.
Other referencesExtra images, video references and LoRA adapters are not supported for A2V.

To use part of a longer recording, add these early-access options under private_config. They can be combined with transcript:

OptionMeaning
source_start_secsStart offset in seconds, from 0 to 300. Defaults to 0.
source_end_secsEnd offset in seconds, greater than the start and no more than 300 or the source length. Omit it to use the remaining audio.
transcriptOptional spoken text for the selected range.

For example, "private_config": {"source_start_secs": 5, "source_end_secs": 12} selects seven seconds. The selected range must still fit the audio length limit. A transcript, when supplied, must describe that range only.

Output, polling and billing

A2V uses the 768p pricing tier, with output dimensions fitted to the source image. Do not assume the returned height is always 768. Output is 24 FPS, between 124 and 345 frames (about 5.17-14.38 seconds). The service adds silence around the audio as needed to fit the supported frame count, so the video can be longer than the supplied clip. Read the actual width, height, frame count and duration from metadata.

Poll GET /api/v0/tasks/{task_id} until COMPLETED or FAILED. A task can return from RUNNING to PENDING between preparation and video generation; keep polling the same ID. Only the terminal statuses mean processing is done.

Poll, then download after COMPLETED
TASK_ID="<task_id_from_generate>"
curl --fail-with-body \
  -H "Authorization: Bearer $MACHGEN_API_KEY" \
  "https://api.machgen.ai/api/v0/tasks/$TASK_ID"

# Run this after the task reports COMPLETED.
curl --fail-with-body \
  -H "Authorization: Bearer $MACHGEN_API_KEY" \
  "https://api.machgen.ai/api/v0/assets/$TASK_ID" -o output.mp4

Generation is charged once per task. Billing uses the output duration rounded to the nearest whole second, with an exact half rounded down. For example, 277 frames at 24 FPS is about 11.54 seconds and bills as 12 seconds. Your account's price applies. See Check what a task cost for the final amount and automatic refunds on failed tasks.

If no speech can be recognized, an accepted task can finish as FAILED with guidance to supply a transcript or a final prompt. Read error_msg before deciding whether to submit a corrected request.

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

For T2V, I2V, F2F and R2V, 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. A2V instead derives its length from the supplied audio; omit video_config for that workflow.

  • 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.

For videos up to 50 MiB, upload the file in one request:

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

For files over 50 MiB and up to 256 MiB, use a resumable upload:

  1. Send file_name, content_type and size_bytes to POST /api/v0/uploads/direct/initiate.
  2. Upload the file to the returned upload_url using HTTP PUT.
  3. Send the returned upload_token to POST /api/v0/uploads/direct/complete.

Both methods return an artifact_path. Start the upscale with @input/ in front of it:

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
  • MachGen-hosted upscaling accepts up to 5 minutes (7,200 frames). For clips of 362 frames or fewer, use a frame count in the frame table. From 363 through 7,200 frames, any frame count works.
  • MP4 or MOV, up to 256 MiB with a resumable upload
  • Stereo, mono or no audio
  • Uploaded to MachGen first. Links to other sites aren't accepted.

Vendor regeneration of a completed H3 video supports up to 15 seconds.

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