# MiniMax Video Generation

OpenAI compatible: `POST /v1/video/generations`. Native path: `/v2/video_generation`. [Video Generation API](https://platform.minimax.cn/docs/api-reference/video-generation-v2-create)

MiniMax H3 supports text-to-video, start-and-end frame image-to-video, and image/video/audio multimodal reference-to-video. Two calling modes are now supported:

- OpenAI compatible: submit via `POST /v1/video/generations`, poll via `GET /v1/video/generations/{task_id}`
- MiniMax official native: submit via `POST /v2/video_generation`, poll via `GET /v2/query/video_generation/{task_id}`

> **Mutually Exclusive Modes**: Start/end frame generation (`first_frame`/`last_frame`) and reference generation (`reference_image`/`reference_video`/`reference_audio`) cannot be mixed.

---

## 1. OpenAI-Compatible Integration (POST)

* **HTTP Method**: `POST`
* **Request Path**: `https://www.tokenpad.ai/v1/video/generations`
* **Auth Header**: `Authorization: Bearer sk-your_token`

### A. Text-to-Video

For text-to-video, `ratio` is required and cannot be `adaptive`.

```bash
curl -X POST https://www.tokenpad.ai/v1/video/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-H3",
    "prompt": "Epic space opera trailer: a female captain stands alone before the observation window as the fleet warps away, the bridge trembles, leaving her behind",
    "resolution": "2K",
    "ratio": "16:9",
    "duration": 5
  }'
```

### B. Image-to-Video (First Frame / Start & End Frames)

1 image defaults to first frame; 2 images default to first + last frame. You can also explicitly specify `role`.

```bash
curl -X POST https://www.tokenpad.ai/v1/video/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-H3",
    "prompt": "Camera pushes in toward the background figure as steam rises thicker from the ramen bowl, smooth and natural motion",
    "images": [
      "https://example.com/first_frame.png",
      "https://example.com/last_frame.png"
    ],
    "resolution": "2K",
    "duration": 5
  }'
```

Explicit role example:

```bash
curl -X POST https://www.tokenpad.ai/v1/video/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-H3",
    "prompt": "The subject slowly turns around and smiles as the camera gently pushes in",
    "images": [
      { "url": "https://example.com/first_frame.png", "role": "first_frame" },
      { "url": "https://example.com/last_frame.png", "role": "last_frame" }
    ],
    "resolution": "768P",
    "duration": 6
  }'
```

### C. Multi-Image Reference Video Generation

Use `role: "reference_image"` (or equivalent `type`). Start/end frames cannot be passed alongside reference mode.

```bash
curl -X POST https://www.tokenpad.ai/v1/video/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-H3",
    "prompt": "Using the character appearance from image 1 and the cafe setting from image 2, smooth jib camera movement as the character carries coffee and takes a seat",
    "images": [
      { "url": "https://example.com/character.png", "role": "reference_image" },
      { "url": "https://example.com/cafe.png", "role": "reference_image" }
    ],
    "resolution": "2K",
    "ratio": "16:9",
    "duration": 5
  }'
```

### D. Image + Video + Audio Multimodal Reference Generation

Requires at least one reference image or reference video; audio alone is not supported.

```bash
curl -X POST https://www.tokenpad.ai/v1/video/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-H3",
    "prompt": "The character says: Go with the wind, live in the moment. Timbre follows the reference audio, motion follows the reference video",
    "images": [
      { "url": "https://example.com/character.png", "role": "reference_image" }
    ],
    "videos": [
      "https://example.com/motion_ref.mp4"
    ],
    "audios": [
      "https://example.com/voice_ref.mp3"
    ],
    "resolution": "2K",
    "duration": 5
  }'
```

---

## 2. OpenAI-Compatible Polling Result (GET)

* **Request Path**: `/v1/video/generations/{task_id}` or `/v1/tasks/{task_id}`

```bash
curl -X GET https://www.tokenpad.ai/v1/video/generations/video_task_minimax_001 \
  -H "Authorization: Bearer sk-your_token_here"
```

---

## 3. MiniMax Official Native Route Examples

Native routes are ideal for clients already integrated with MiniMax's official SDK / request payloads—simply replace the Base URL and authentication without rewriting into OpenAI-compatible format.

### A. Native Task Submission

* **Request Path**: `/v2/video_generation`

```bash
curl -X POST https://www.tokenpad.ai/v2/video_generation \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-H3",
    "content": [
      { "type": "text", "text": "Rainy city neon night, camera slowly pushes in as the person turns to look at the lens" },
      { "type": "image_url", "image_url": { "url": "https://example.com/first_frame.png" }, "role": "first_frame" }
    ],
    "resolution": "2K",
    "duration": 5,
    "aigc_watermark": true
  }'
```

### B. Native Task Query

* **Request Path**: `/v2/query/video_generation/{task_id}`

```bash
curl -X GET https://www.tokenpad.ai/v2/query/video_generation/video_task_minimax_001 \
  -H "Authorization: Bearer sk-your_token_here"
```

---

## 4. Complete Parameter Dictionary

| Parameter | Type | Required | Default | Description & Constraints |
| :--- | :--- | :--- | :--- | :--- |
| `model` | `string` | **Yes** | - | Video model; currently `MiniMax-H3` on the V2 channel (refer to the actual listed model name on the platform). |
| `prompt` | `string` | Required for OpenAI-compatible | - | Text prompt. Used when calling via the OpenAI-compatible route. |
| `images` / `image_urls` | `array` | No | - | Image URLs or `{url, role}`. Default: 1 → `first_frame`, 2 → start/end frames, 3+ → `reference_image`. Roles: `first_frame`/`last_frame`/`reference_image` (`type` is equivalent). Up to 9 reference images. |
| `videos` | `array` | No | - | Reference video URLs or objects; defaults to `role=reference_video`, up to 3 clips, ~2–15s per clip, total duration ≤15s. |
| `audios` | `array` | No | - | Reference audio; defaults to `role=reference_audio`, up to 3 clips; cannot be used as the sole reference. |
| `content` | `array` | Recommended for Native | - | Multimodal array; takes precedence over flat fields if both are present. Ideal for MiniMax official native route. |
| `resolution` | `string` | **Yes*** | - | `768P` or `2K`. |
| `duration` | `integer` | **Yes*** | - | Video duration in seconds; options `4`–`15`. |
| `ratio` | `string` | Conditional | - | Required and non-`adaptive` for text-to-video: `21:9`/`16:9`/`4:3`/`1:1`/`3:4`/`9:16`. Determined by input image for image-to-video (`adaptive`). Optional for reference-to-video, defaults to `adaptive`. |
| `watermark` / `aigc_watermark` | `boolean` | No | - | Watermark toggle; both fields are equivalent. |
| `callback_url` | `string` | No | - | Task status callback URL. |

\* Please pass `resolution` / `duration` explicitly.

---

## 5. Response Example

* **Submit Task Response**:
```json
{
  "id": "video_task_minimax_001",
  "task_id": "video_task_minimax_001",
  "status": "pending",
  "message": "Task submitted successfully"
}
```

* **Query Result Response (Completed)**:
```json
{
  "id": "video_task_minimax_001",
  "task_id": "video_task_minimax_001",
  "status": "completed",
  "data": [
    {
      "url": "https://example.com/output/minimax_h3.mp4"
    }
  ]
}
```



### 5. Common Error Codes & Troubleshooting

HTTP codes, error body format, and troubleshooting are **maintained in one dedicated page** (not duplicated under each example).

👉 **[Gateway Error Codes & Troubleshooting](/docs/errors/error-codes)**

**Quick reference**:

| Code | Meaning |
| :---: | :--- |
| **400** | Invalid parameters / content moderation or copyright block |
| **402** | Insufficient account balance (**not** 429) |
| **429** | RPS/RPM limits or in-flight task cap (low balance) |
| **403** | Token / IP / model permission (balance → 402; content filter → 400) |
| **200 + `status: failed`** | Async video/long-task business failure on poll |

HTTP status matches call log `status_code` for traceability by `log_id`.

> **Maintenance**: update the `error-codes` article only; this appendix links to it.
