> ## Documentation Index
> Fetch the complete documentation index at: https://docs.toapis.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MiniMax Hailuo H3 視頻生成

> 使用 MiniMax Hailuo H3 生成 2K 或 768p 視頻，支持文生視頻、首尾幀及多模態參考生成

> [!NOTE]
>
> **中國大陸用戶請注意：** 中國大陸用戶請使用 `https://toapis.cn` 作為接口地址（Base URL）。文檔示例中的 `https://toapis.com` 請替換為 `https://toapis.cn`。

* 支援 `MiniMax-H3`、`MiniMax-H3-Max` 與 `MiniMax-H3-Max-Turbo` 三個模型
* `MiniMax-H3` 和 `MiniMax-H3-Max` 支援文生視頻, 首幀/尾幀圖生視頻, 以及圖片, 視頻, 音頻聯合參考生成
* `MiniMax-H3-Max-Turbo` 僅支援文生視頻和首幀/尾幀圖生視頻, 不支援參考媒體
* 舊版 H3 保持 `2K` / `768p` 和 `4-15` 秒。Max / Max-Turbo 支持 `480P` / `768P` 和 `5-15` 秒
* 異步任務接口，提交後返回統一的 `generation.task`

> [!WARNING]
>
> `MiniMax-H3-Max-Turbo` 不支援 `reference_image`, `reference_video` 或 `reference_audio`. 傳入參考媒體會返回 `MiniMax-H3-Max-Turbo does not support reference media`. 如需參考視頻, 請選擇 `MiniMax-H3` 或 `MiniMax-H3-Max`.

> [!WARNING]
>
> 請優先傳入公網可訪問的素材 URL。首尾幀模式與多模態參考模式互斥；參考音頻不能單獨使用，必須同時提供至少一張參考圖或一段參考視頻。

## 認證

**Authorization** `string` *required*

所有接口均需要使用 Bearer Token 認證：`Authorization: Bearer YOUR_API_KEY`。

## 請求參數

**model** `string` *required* (default: MiniMax-H3)

視頻生成模型名稱, 可選 `MiniMax-H3`, `MiniMax-H3-Max` 或 `MiniMax-H3-Max-Turbo`. 多模態參考僅適用於 `MiniMax-H3` 和 `MiniMax-H3-Max`; Turbo 僅支援文生視頻和首幀/尾幀圖生視頻.

**prompt** `string` *required*

視頻內容描述，最多 `7000` 個字符。

**duration** `integer` (default: 5)

`MiniMax-H3` 支援 `4-15` 秒; Max / Max-Turbo 支援 `5-15` 秒的整數值.

**resolution** `string` (default: 2K)

`MiniMax-H3` 可選 `2K`, `768p`; Max / Max-Turbo 可選 `480P`, `768P`.

**aspect\_ratio** `string` (default: 16:9)

可選值：`21:9`、`16:9`、`4:3`、`1:1`、`3:4`、`9:16`、`adaptive`。

* 文生視頻默認 `16:9`，不能使用 `adaptive`
* 首幀/尾幀模式固定按輸入圖片自適應
* 多模態參考模式 (僅 `MiniMax-H3` 和 `MiniMax-H3-Max`) 默認 `adaptive`, 也可指定具體比例

**image\_urls** `string[]`

兼容圖片 URL 數組。1 張按首幀處理，2 張依次按首幀和尾幀處理，3-9 張按參考圖處理。新接入請優先使用 `image_with_roles`。

3-9 張圖片會進入參考圖模式, 僅適用於 `MiniMax-H3` 和 `MiniMax-H3-Max`, Turbo 不支援.

**image\_with\_roles** `array`

帶角色的圖片數組。

**顯示圖片字段**

**url** `string` *required*

圖片 URL。支持 JPG、JPEG、PNG、WebP、HEIC、HEIF；單文件不超過 `30 MB`，寬高爲 `256-5760 px`，寬高比爲 `0.4-2.5`。

**role** `string` *required*

`first_frame`（最多 1 張）、`last_frame`（最多 1 張）或 `reference_image`（最多 9 張）。

`reference_image` 僅適用於 `MiniMax-H3` 和 `MiniMax-H3-Max`; Turbo 僅支援 `first_frame` 和 `last_frame`.

**video\_with\_roles** `array`

僅適用於 `MiniMax-H3` 和 `MiniMax-H3-Max`, Turbo 不支援.

參考視頻數組，最多 `3` 段。每項包含公網 `url` 和固定角色 `reference_video`。支持 MP4、MOV；單文件不超過 `50 MB`，單段 `2-15` 秒，總時長不超過 `15` 秒。

> [!NOTE]
>
> ToAPIs 會讀取參考視頻的實際時長用於計費，請勿提交客戶端計算的時長字段。

**audio\_with\_roles** `array`

僅適用於 `MiniMax-H3` 和 `MiniMax-H3-Max`, Turbo 不支援.

參考音頻數組，最多 `3` 段。每項包含公網 `url` 和固定角色 `reference_audio`。支持 WAV、MP3；單文件不超過 `15 MB`，單段 `2-15` 秒，總時長不超過 `15` 秒。

> [!WARNING]
>
> 參考音頻不能單獨使用，必須同時傳入至少一項 `reference_image` 或 `reference_video`。

**watermark** `boolean` (default: false)

是否添加 AIGC 標識水印。

**client\_business\_id** `string`

客戶側業務 ID，可用於後續查詢任務。

**callback\_url** `string`

ToAPIs 任務完成回調地址；詳見 [Webhook](https://docs.toapis.com/docs/zh-Hant/api-reference/webhooks/task-webhooks.md)。

## 輸入模式與限制

| 模式 | 適用型號 | 輸入 | 寬高比 |
| - | - | - | - |
| 文生視頻 | 三個型號均支援 | `prompt` | 具體比例, 默認 `16:9` |
| 首幀/首尾幀 | 三個型號均支援 | `prompt` + `first_frame` / `last_frame` | 自動 `adaptive` |
| 多模態參考 | 僅 `MiniMax-H3` 和 `MiniMax-H3-Max` | `prompt` + 參考圖片/視頻/音頻 | 默認 `adaptive` |

多模態參考限制 (僅 `MiniMax-H3` 和 `MiniMax-H3-Max`):

* 參考圖最多 `9` 張，參考視頻最多 `3` 段，參考音頻最多 `3` 段
* 圖片、視頻、音頻合計最多 `12` 個文件
* 首尾幀角色不能與任意參考角色混用

## 示例

參考媒體示例使用 `MiniMax-H3`, 不能僅將 `model` 替換為 `MiniMax-H3-Max-Turbo`. 如改用 `MiniMax-H3-Max`, `resolution` 必須使用 `480P` 或 `768P`, `duration` 必須為 `5-15` 秒.

### 首尾幀圖生視頻

```json theme={null}
{
  "model": "MiniMax-H3",
  "prompt": "女孩從童年自然成長爲青年，保持人物身份一致",
  "duration": 5,
  "resolution": "768p",
  "image_with_roles": [
    {"url": "https://example.com/start.jpg", "role": "first_frame"},
    {"url": "https://example.com/end.jpg", "role": "last_frame"}
  ]
}
```

### 視頻與音頻聯合參考

```json theme={null}
{
  "model": "MiniMax-H3",
  "prompt": "參考視頻1的動作與鏡頭節奏，並使用音頻1的音色完成對白",
  "duration": 5,
  "resolution": "2K",
  "aspect_ratio": "adaptive",
  "video_with_roles": [
    {"url": "https://example.com/motion.mp4", "role": "reference_video"}
  ],
  "audio_with_roles": [
    {"url": "https://example.com/voice.mp3", "role": "reference_audio"}
  ]
}
```

## 響應

**id** `string`

ToAPIs 任務 ID。

**object** `string`

固定爲 `generation.task`。

**model** `string`

固定爲 `MiniMax-H3`。

**status** `string`

`queued`、`in_progress`、`completed` 或 `failed`。

**progress** `integer`

任務進度，範圍 `0-100`。

**created\_at** `integer`

Unix 創建時間戳（秒）。

> [!NOTE]
>
> 提交後使用 [獲取視頻任務狀態](https://docs.toapis.com/docs/zh-Hant/api-reference/tasks/video-status.md) 輪詢；完成時視頻 URL 位於 `result.data[0].url`。

```bash cURL（文生視頻） theme={null}
curl --request POST \
  --url https://toapis.com/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "MiniMax-H3",
    "prompt": "宇航員站在月球邊緣眺望藍色地球，鏡頭緩慢推進",
    "duration": 5,
    "resolution": "2K",
    "aspect_ratio": "16:9"
  }'
```

```bash cURL（圖片、視頻、音頻聯合參考） theme={null}
curl --request POST \
  --url https://toapis.com/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "MiniMax-H3",
    "prompt": "保持圖片1中的人物，參考視頻1的動作與運鏡，並使用音頻1的音色完成對白",
    "duration": 5,
    "resolution": "2K",
    "aspect_ratio": "adaptive",
    "image_with_roles": [{"url": "https://example.com/person.png", "role": "reference_image"}],
    "video_with_roles": [{"url": "https://example.com/motion.mp4", "role": "reference_video"}],
    "audio_with_roles": [{"url": "https://example.com/voice.mp3", "role": "reference_audio"}]
  }'
```

```json 200 theme={null}
{
  "id": "vid_01KZ3H3EXAMPLE00000000000",
  "object": "generation.task",
  "model": "MiniMax-H3",
  "status": "queued",
  "progress": 0,
  "created_at": 1785729000
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.