Skip to main content
POST
The interactive Playground on the right lets you test live. Put your API Key in Authorization (format Bearer sk-xxx), add one text item to content (plus image, video, or audio items if needed), pick duration and ratio, and send. The response is a task_id; fetch the video with the query endpoint described below.
One endpoint, four modes: text only = text-to-video; add a first_frame / last_frame image = keyframe video; add reference_image / reference_video / reference_audio = reference video. The mode is inferred from content[], so there is no endpoint to switch. See the MiniMax-H3 overview for the full picture.
⚠️ The four most common mistakes
  1. The path starts with /hailuo: create with POST /hailuo/v2/video_generation, query with GET /hailuo/v2/query/video_generation/{task_id}. A bare /v2/... path returns a web page, not JSON
  2. duration must be an integer from 4 to 15: the string "5" or a decimal like 5.5 is rejected
  3. resolution must be uppercase 768P: 768p and 2K are both rejected
  4. Text-only and audio-only requests cannot use ratio: "adaptive"; pick a fixed ratio. adaptive only works when the request includes images or videos

Code Examples

Python (requests · submit + poll + download)

Python (first-frame video · request body)

Python (mixed references · request body)

cURL

Node.js (native fetch)

Browser JavaScript

Already have a task_id? One cURL call

When status is succeeded, task.content.url is the MP4 URL and can be downloaded directly:

Parameter Reference

Ratio and output size (measured)

Media requirements

All media must be public HTTPS URLs that can be downloaded directly. Base64, data URIs, http:// links, and private-network addresses are not supported. Links behind hotlink protection or a login make the task fail when it tries to download the media.

Response Format

Create task

Query task (in progress)

Query task (succeeded)

Query task (failed)

⚠️ Response notes
  • The query result is wrapped in a task object, not at the top level
  • On success only id, status, progress, and content.url are guaranteed; usage, model, ratio and similar fields are not always returned, so parse them defensively
  • Status goes queued → running → succeeded / failed; at peak times a task may start at running
  • progress only jumps between 0 and 1, so it is not useful as a percentage bar
  • The video URL is task.content.url and needs no auth header. It returns 403 to HEAD requests but works with GET, so use GET to check it
  • Download and store the video on your side soon after you get the URL
Billing: when the task is accepted, duration × \$0.03 is pre-charged, with no extra charge for reference media; failed tasks are refunded in full automatically. Requests that return 4xx / 5xx at submission are not billed, and querying or downloading is free. See pricing on the overview page.

Authorizations

Authorization
string
header
required

API Key from the APIYI console

Body

application/json
model
enum<string>
default:MiniMax-H3
required

Always MiniMax-H3 (case-sensitive)

Available options:
MiniMax-H3
content
object[]
required

Exactly one text item plus 0–12 media items. Media item types:

  • image_url: role first_frame / last_frame / reference_image; up to 9 reference images. A single image without role is treated as the first frame
  • video_url: role reference_video; up to 3 clips, MP4/MOV, 50MB max, at least 2 seconds each, 15 seconds total at most
  • audio_url: role reference_audio; up to 3 clips, WAV/MP3/M4A/AAC, 15MB max, at least 2 seconds each
Required array length: 1 - 13 elements
resolution
enum<string>
default:768P
required

Resolution. This channel supports 768P only (uppercase; 768p and 2K are rejected)

Available options:
768P
duration
integer
default:5
required

Output length in seconds, an integer from 4 to 15. Billed per second; the finished clip is usually 0.1–0.5 s longer than requested

Required range: 4 <= x <= 15
ratio
enum<string>
default:16:9
required

Aspect ratio and output size: 21:9=1536×672, 16:9=1344×768, 4:3=1024×768, 1:1=768×768, 3:4=768×1024, 9:16=768×1344. adaptive follows the input image's ratio and only works for requests with images or videos; text-only and audio-only requests need a fixed ratio.

Available options:
16:9,
9:16,
21:9,
4:3,
1:1,
3:4,
adaptive

Response

Task accepted; returns task_id

task_id
string

Task ID for GET /hailuo/v2/query/video_generation/{task_id}

Example:

"task_Clo9iKPCM46sRwRsMFcmJG6pGNSL1ygx"