# MiniMax-H3 Video Generation API Documentation

Call the **BeeRoute video generation API** to generate video content. This document is dedicated to the **MiniMax-H3 (Hailuo-03)** series of video generation models, supporting **text-to-video, image-to-video (first frame / last frame / first and last frames), and multimodal reference-to-video (reference images / reference videos / reference audio)**, with native 2K output.

#### [Download the MD file of this document](https://beeroute.ai/doc/coding/minimax-video.md)

> **Official Documentation**:
> - Create video generation task: [https://platform.minimaxi.com/docs/api-reference/video-generation-v2-create](https://platform.minimaxi.com/docs/api-reference/video-generation-v2-create)
> - Query task: [https://platform.minimaxi.com/docs/api-reference/video-generation-v2-query](https://platform.minimaxi.com/docs/api-reference/video-generation-v2-query)
> - Official pay-as-you-go pricing: [https://platform.minimaxi.com/docs/guides/pricing-paygo](https://platform.minimaxi.com/docs/guides/pricing-paygo)

---

## 1. Supported Models

### Model List

| Model Name | Description | Use Cases |
| :--- | :--- | :--- |
| `MiniMax-H3` | Hailuo-03, native 2K output, multimodal input | Text-to-video, image-to-video, first/last frames, multimodal reference-to-video |

### MiniMax-H3 Video Generation Pricing

#### Video Generation — Output Pricing

| Model | Resolution | Billing Rule | Price (USD) |
| :--- | :--- | :--- | :--- |
| **MiniMax-H3** | 2K | Billed per second | **$0.0588 / second** |
| **MiniMax-H3** | 768P | Billed per second | **$0.0368 / second** |

#### Video Generation — Input Material Pricing

| Model | Material Type | Billing Rule | Price (USD) |
| :--- | :--- | :--- | :--- |
| **MiniMax-H3** | Audio | Free | **Free** |
| **MiniMax-H3** | Image | Free for up to 5 images; images beyond that are billed per image | **$0.0074 / image** |
| **MiniMax-H3** | Video (2K) | Billed by input video duration and output video resolution | **$0.0588 / second** |
| **MiniMax-H3** | Video (768P) | Billed by input video duration and output video resolution | **$0.0368 / second** |

#### Video Regeneration — Output Pricing

> Regenerates an already generated 768P video into a 2K video, billed by the number of output seconds of the regenerated video.

| Model | Resolution | Billing Rule | Price (USD) |
| :--- | :--- | :--- | :--- |
| **MiniMax-H3-Regeneration** | 768P → 2K | Billed by the output seconds of the regenerated video | **$0.0221 / second** |

#### Video Regeneration — Input Material Pricing

> Input materials used in the original 768P generation task are billed again.

| Model | Material Type | Billing Rule | Price (USD) |
| :--- | :--- | :--- | :--- |
| **MiniMax-H3-Regeneration** | Audio | Free | **Free** |
| **MiniMax-H3-Regeneration** | Image | Free for up to 5 images; images beyond that are billed per image | **$0.0037 / image** |
| **MiniMax-H3-Regeneration** | Video | Billed by the seconds of input video in the original 768P generation task | **$0.0221 / second** |

> **Billing Notes**:
> - Billed by the **actual duration (seconds)** of the generated video; the `duration` parameter directly affects the cost.
> - Different resolutions (`768P` / `2K`) are billed at different multipliers; see the pricing tables above.
> - Actual billing is based on the upstream response after the task completes (any difference is refunded or charged).

---

## 2. Generate Video

Since video generation tasks take a relatively long time, the API uses asynchronous calls. The entire process consists of two core steps: **"Create task → Poll for result"**.

### API Endpoint

```
POST /v2/video_generation
```

### Request Headers

| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| Authorization | string | Yes | User authentication token (`Bearer sk-xxxx`) |
| Content-Type | string | Yes | **application/json** |

### Request Parameters

> The BeeRoute MiniMax integration uses **passthrough mode**; the request body fully matches MiniMax's native parameters.

| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **model** | string | Yes | Model name. Currently available value: `MiniMax-H3`. |
| **content** | array[object] | Yes | Array of multimodal input content describing the information used to generate the video. Each element is distinguished by `type` and can be labeled with its purpose via `role`. **Every request must include a non-empty `text` item (the prompt is required)**. See the ContentItem description below. |
| **resolution** | string | Yes | Video resolution. Options: `768P`, `2K`. |
| **duration** | integer | Yes | Generated video duration (seconds), integer. Options: `4` ~ `15`. ⚠️ **Directly affects cost; billed per second.** |
| **ratio** | string | No | Aspect ratio of the generated video. Default `adaptive` (automatic: the most suitable aspect ratio is selected adaptively based on the input; the actual ratio is available in the `ratio` field of the query API). Options: `adaptive`, `21:9`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16`. See the per-scenario notes below. |
| **callback_url** | string | No | Callback URL for task status change notifications. Once configured, the server first sends a verification request containing a `challenge` field (you must return the `challenge` unchanged within 3 seconds to complete verification). After successful verification, a POST notification is pushed to this URL every time the task status changes; the payload structure is the same as the response of the query task API. |
| **aigc_watermark** | boolean | No | Whether to add an AIGC identification watermark to the generated video. Default `false`. |

### ContentItem Description

Each element of the content array has the following structure:

| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **type** | string | Yes | Type of the input content: `text` / `image_url` / `video_url` / `audio_url`. |
| **text** | string | Conditionally required | Text prompt, used when `type=text`. **Every scenario must include a non-empty `text`** describing the desired video. A single `text` can contain at most **7000** characters. |
| **image_url** | object | Conditionally required | Image object used when `type=image_url`, containing a `url` field. |
| **video_url** | object | Conditionally required | Video object used when `type=video_url` (reference video, multimodal reference scenario only), containing a `url` field. |
| **audio_url** | object | Conditionally required | Audio object used when `type=audio_url` (reference audio, multimodal reference scenario only), containing a `url` field. |
| **role** | string | Conditionally required | Position or purpose of the content; see the per-scenario notes. Options: `first_frame`, `last_frame`, `reference_image`, `reference_video`, `reference_audio`. |

#### Supported URL Formats

| Type | Supported URL Formats |
| :--- | :--- |
| image_url.url | Public URL; `mm_file://{file_id}`; `data:image/<format>;base64,<Base64>` (`<format>` in lowercase, e.g. `jpeg`, `png`, `webp`) |
| video_url.url | Public URL; `mm_file://{file_id}`; `data:video/mp4;base64,<Base64>` |
| audio_url.url | Public URL; `mm_file://{file_id}`; `data:audio/<format>;base64,<Base64>` (`<format>` in lowercase, e.g. `wav`, `mp3`) |

### Input Media Limits

> Total request body size ≤ **64 MB**. For large files, use a public URL instead of Base64.

#### Image `image_url`

| Item | Limit |
| :--- | :--- |
| Format | JPG, JPEG, PNG, WEBP, HEIC, HEIF |
| Single file size | ≤ 30 MB |
| Width/height range | [256, 5760] px |
| Aspect ratio (width/height) | [0.4, 2.5] |
| Quantity | First frame ≤ 1, last frame ≤ 1, reference images ≤ 9 |

#### Video `video_url` (multimodal reference scenario only)

| Item | Limit |
| :--- | :--- |
| Container / Format | MP4 (`.mp4`), MOV (`.mov`) |
| Codec | Video: H.264/AVC, H.265/HEVC; audio: AAC, MP3 |
| Single file size | ≤ 50 MB |
| Count | ≤ 3 |
| Single clip duration | [2, 15] s; total duration ≤ 15 s |
| Width/height range | [256, 5760] px |
| Aspect ratio (width/height) | [0.4, 2.5] |
| Frame rate | [23.976, 60] |

#### Audio `audio_url` (multimodal reference scenario only)

| Item | Limit |
| :--- | :--- |
| Format | WAV, MP3 |
| Single file size | ≤ 15 MB |
| Count | ≤ 3 |
| Single clip duration | [2, 15] s; total duration ≤ 15 s |

---

### Request Examples

#### 1. Text-to-Video (t2va)

Uses only the common parameters; content contains only one `text` element.

> **ratio** is **required** for text-to-video and cannot be `adaptive`. Options: `21:9`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16`.

```bash
curl --location --request POST 'https://beeroute.ai/v2/video_generation' \
--header 'Authorization: Bearer sk-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "MiniMax-H3",
    "content": [
        {
            "type": "text",
            "text": "Epic space-opera theatrical trailer: a female captain stands alone before a massive observation window as the last fleet assembles and jumps away; a blinding flash erupts, the bridge shakes, and she is left behind."
        }
    ],
    "resolution": "2K",
    "duration": 5,
    "ratio": "16:9"
}'
```

---

#### 2. Image-to-Video - First Frame (i2va)

content contains `text` + 1 `image_url` (`role=first_frame`, or omit role; it is treated as the first frame by default).

> **ratio** is always `adaptive` for image-to-video and is determined by the input image; passing other valid values does not cause an error, but they are ignored and treated as `adaptive`.

```bash
curl --location --request POST 'https://beeroute.ai/v2/video_generation' \
--header 'Authorization: Bearer sk-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "MiniMax-H3",
    "content": [
        {
            "type": "text",
            "text": "Pull focus to the people in the background and add more steam to the ramen bowl."
        },
        {
            "type": "image_url",
            "image_url": {
                "url": "https://example.com/first_frame.png"
            },
            "role": "first_frame"
        }
    ],
    "resolution": "2K",
    "duration": 5,
    "ratio": "adaptive"
}'
```

---

#### 3. Image-to-Video - Last Frame

content contains `text` + 1 `image_url` (`role=last_frame`).

```bash
curl --location --request POST 'https://beeroute.ai/v2/video_generation' \
--header 'Authorization: Bearer sk-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "MiniMax-H3",
    "content": [
        {
            "type": "text",
            "text": "The camera slowly pulls back, gradually revealing a sweeping panoramic view."
        },
        {
            "type": "image_url",
            "image_url": {
                "url": "https://example.com/last_frame.png"
            },
            "role": "last_frame"
        }
    ],
    "resolution": "2K",
    "duration": 5
}'
```

---

#### 4. Image-to-Video - First and Last Frames

content contains `text` + 2 `image_url` items (with `role` set to `first_frame` and `last_frame` respectively).

```bash
curl --location --request POST 'https://beeroute.ai/v2/video_generation' \
--header 'Authorization: Bearer sk-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "MiniMax-H3",
    "content": [
        {
            "type": "text",
            "text": "Smoothly transition from the first frame to the second, with the lighting changing softly."
        },
        {
            "type": "image_url",
            "image_url": {
                "url": "https://example.com/first_frame.jpeg"
            },
            "role": "first_frame"
        },
        {
            "type": "image_url",
            "image_url": {
                "url": "https://example.com/last_frame.jpeg"
            },
            "role": "last_frame"
        }
    ],
    "resolution": "2K",
    "duration": 5
}'
```

---

#### 5. Multimodal Reference-to-Video (r2va)

Generates a video by fusing a combination of reference images (`reference_image`), reference videos (`reference_video`), and reference audio (`reference_audio`).

> **Image-to-video and multimodal reference-to-video are mutually exclusive**: if any of the `reference_image` / `reference_video` / `reference_audio` roles appears in content, `first_frame` / `last_frame` cannot appear (and vice versa).
>
> **ratio** is optional for multimodal reference-to-video, defaulting to `adaptive`; you can also explicitly specify a particular ratio.

```bash
curl --location --request POST 'https://beeroute.ai/v2/video_generation' \
--header 'Authorization: Bearer sk-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "MiniMax-H3",
    "content": [
        {
            "type": "text",
            "text": "The character says: Follow the wind, live free. Leave worries behind, enjoy the moment. Voice timbre follows Audio 1."
        },
        {
            "type": "video_url",
            "video_url": {
                "url": "https://example.com/reference_video.mp4"
            },
            "role": "reference_video"
        },
        {
            "type": "audio_url",
            "audio_url": {
                "url": "https://example.com/reference_audio.mp3"
            },
            "role": "reference_audio"
        }
    ],
    "resolution": "2K",
    "duration": 5,
    "ratio": "adaptive"
}'
```

---

### Response Format

#### 200 - Created Successfully

```json
{
    "task_id": "424010985738629"
}
```

> **Note**: Use the returned `task_id` to call the query API to get the task status and result. Task records are retained for **7 days**; they cannot be queried after expiration.

#### Error Responses

Authentication failed (401):

```json
{
    "type": "error",
    "error": {
        "type": "authorized_error",
        "message": "login fail: Please carry the API secret key in the 'Authorization' field of the request header (1004)",
        "http_code": "401"
    },
    "request_id": "021785229015510a2c883cf675b9804d"
}
```

Invalid parameters (400):

```json
{
    "type": "error",
    "error": {
        "type": "bad_request_error",
        "message": "invalid params, content must include a non-empty text item (prompt is required) (2013)",
        "http_code": "400"
    },
    "request_id": "021785229015510a2c883cf675b9804d"
}
```

Insufficient balance (402):

```json
{
    "type": "error",
    "error": {
        "type": "insufficient_balance_error",
        "message": "insufficient balance (1008)",
        "http_code": "402"
    },
    "request_id": "021785229015510a2c883cf675b9804d"
}
```

Rate limit triggered (429):

```json
{
    "type": "error",
    "error": {
        "type": "rate_limit_error",
        "message": "rate limit, please retry later (1002)",
        "http_code": "429"
    },
    "request_id": "021785229015510a2c883cf675b9804d"
}
```

Sensitive content (422):

```json
{
    "type": "error",
    "error": {
        "type": "unprocessable_entity_error",
        "message": "video description contains sensitive content (1026)",
        "http_code": "422"
    },
    "request_id": "021785229015510a2c883cf675b9804d"
}
```

Server error (500):

```json
{
    "type": "error",
    "error": {
        "type": "server_error",
        "message": "internal error (1000)",
        "http_code": "500"
    },
    "request_id": "021785229015510a2c883cf675b9804d"
}
```

---

## 3. Query Task Status

Video generation usually takes 1-5 minutes; poll the status using the `task_id`. A polling interval of **15 seconds** is recommended.

### API Endpoint

```
GET /v2/query/video_generation/{task_id}
```

### Path Parameters

| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| task_id | string | Yes | The `task_id` returned when creating the task |

### Request Example

```bash
curl --location --request GET 'https://beeroute.ai/v2/query/video_generation/424010985738629' \
--header 'Authorization: Bearer sk-xxx'
```

---

### Response Format

#### 200 - Completed Successfully (Succeeded)

```json
{
    "task": {
        "id": "424010985738629",
        "model": "MiniMax-H3",
        "status": "succeeded",
        "created_at": 1785125529,
        "updated_at": 1785125946,
        "content": {
            "url": "https://xxx/xxx.mp4"
        },
        "resolution": "2K",
        "duration": 5,
        "usage": {
            "total_seconds": 5,
            "input_seconds": 0,
            "output_seconds": 5,
            "input_image_count": 0
        },
        "ratio": "16:9",
        "task_type": "generation",
        "modality": "video"
    }
}
```

#### 200 - Queued

```json
{
    "task": {
        "id": "424010985738629",
        "model": "MiniMax-H3",
        "status": "queued",
        "created_at": 1785125529,
        "updated_at": 1785125529,
        "resolution": "2K",
        "duration": 5,
        "ratio": "16:9",
        "task_type": "generation",
        "modality": "video"
    }
}
```

#### 200 - Running

```json
{
    "task": {
        "id": "424010985738629",
        "model": "MiniMax-H3",
        "status": "running",
        "created_at": 1785125529,
        "updated_at": 1785125535,
        "resolution": "2K",
        "duration": 5,
        "ratio": "16:9",
        "task_type": "generation",
        "modality": "video"
    }
}
```

#### 200 - Task Failed (Failed)

```json
{
    "task": {
        "id": "424010985738630",
        "model": "MiniMax-H3",
        "status": "failed",
        "error": {
            "code": "1026",
            "message": "video description contains sensitive content"
        },
        "created_at": 1785125529,
        "updated_at": 1785125700,
        "resolution": "2K",
        "duration": 5,
        "usage": {
            "total_seconds": 0,
            "input_seconds": 0,
            "output_seconds": 0,
            "input_image_count": 0
        },
        "ratio": "16:9",
        "task_type": "generation",
        "modality": "video"
    }
}
```

#### 200 - Cancelled

```json
{
    "task": {
        "id": "424010985738631",
        "model": "MiniMax-H3",
        "status": "cancelled",
        "created_at": 1785125529,
        "updated_at": 1785125600,
        "resolution": "2K",
        "duration": 5,
        "ratio": "16:9",
        "task_type": "generation",
        "modality": "video"
    }
}
```

---

### Key Field Descriptions

| Field | Type | Description |
| :--- | :--- | :--- |
| **task** | object | Task object wrapping all task information. |
| **task.id** | string | Task ID. |
| **task.model** | string | The model name used, e.g. `MiniMax-H3`. |
| **task.status** | string | Task status: `queued` / `running` / `succeeded` / `failed` / `cancelled`. |
| **task.error** | object | Error information; not returned when the task succeeds. When the task fails, it returns `code` (error code) and `message` (error details). |
| **task.created_at** | integer | Task creation time (Unix timestamp, seconds). |
| **task.updated_at** | integer | Task status update time (Unix timestamp, seconds). |
| **task.content** | object | Task output content. Video generation tasks return `content.url` (video download link); video regeneration tasks also return `content.url`. |
| **task.resolution** | string | Resolution of the task output (`768P` / `2K`). |
| **task.duration** | integer | Duration of the task output (seconds). |
| **task.usage** | object | Billing usage for this request, including `total_seconds`, `input_seconds`, `output_seconds`, and `input_image_count`. |
| **task.ratio** | string | Aspect ratio of the task output; may be an empty string when not applicable to the current task type. |
| **task.task_type** | string | Task type: `generation` (video generation) / `regeneration` (video regeneration). |
| **task.modality** | string | Output modality: `video` (for both video generation and video regeneration). |

#### usage Field Descriptions

| Field | Type | Description |
| :--- | :--- | :--- |
| **total_seconds** | integer | Total billed seconds for this request = input seconds + output seconds. |
| **input_seconds** | integer | Billed seconds of input reference video (counted when a reference video is included). |
| **output_seconds** | integer | Billed seconds of output video. |
| **input_image_count** | integer | Number of images included in this billing. |

---

## 4. Task Status Transitions

```
queued → running → succeeded / failed / cancelled
```

- The initial query status is usually `queued` or `running`.
- When the status becomes `succeeded`, `task.content.url` in the response contains the video download link.
- If the status is `failed`, check the `task.error.code` and `task.error.message` error information and retry.
- Task records are retained for **7 days**; results cannot be queried after expiration.
- Video download links are time-limited; please download or transfer them promptly.

---

## 5. Scenario Quick Reference

| Scenario | content Composition | ratio Requirement |
| :--- | :--- | :--- |
| Text-to-video (t2va) | `text` only | **Required**; cannot be `adaptive` |
| Image-to-video - first frame (i2va) | `text` + 1 `image_url` (`role=first_frame` or omitted) | Always `adaptive` (other values are ignored) |
| Image-to-video - last frame | `text` + 1 `image_url` (`role=last_frame`) | Always `adaptive` (other values are ignored) |
| Image-to-video - first and last frames | `text` + 2 `image_url` items (`first_frame` + `last_frame`) | Always `adaptive` (other values are ignored) |
| Multimodal reference-to-video (r2va) | `text` + a combination of `reference_image` / `reference_video` / `reference_audio` | Optional, default `adaptive` |

> **Mutual exclusion rule**: `first_frame` / `last_frame` cannot be mixed with `reference_image` / `reference_video` / `reference_audio`.

---

## 6. Parameter Limits Overview (Quick Reference)

| Dimension | Limit |
| :--- | :--- |
| `model` | `MiniMax-H3` |
| `text` max length | 7000 characters |
| `resolution` options | `768P` / `2K` |
| `duration` range | `4` ~ `15` seconds (integer) |
| `ratio` options | `adaptive` / `21:9` / `16:9` / `4:3` / `1:1` / `3:4` / `9:16` |
| Total request body size | ≤ 64 MB |
| Image format | JPG / JPEG / PNG / WEBP / HEIC / HEIF |
| Image single file size | ≤ 30 MB |
| Image width/height range | [256, 5760] px |
| Image aspect ratio | [0.4, 2.5] |
| First-frame image count | ≤ 1 |
| Last-frame image count | ≤ 1 |
| Reference image count | ≤ 9 |
| Video format | MP4 / MOV |
| Video codec | Video: H.264/AVC, H.265/HEVC; audio: AAC, MP3 |
| Video single file size | ≤ 50 MB |
| Reference video count | ≤ 3 |
| Video single clip duration | [2, 15] s; total duration ≤ 15 s |
| Video frame rate | [23.976, 60] |
| Audio format | WAV / MP3 |
| Audio single file size | ≤ 15 MB |
| Reference audio count | ≤ 3 |
| Audio single clip duration | [2, 15] s; total duration ≤ 15 s |
| Task record retention | 7 days |
