> ## 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-2.3 視頻生成

> 使用 MiniMax Hailuo 2.3 系列模型生成視頻，支持文生視頻和圖生視頻，可選 Fast 快速模式

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

* 異步任務接口，提交後返回任務 ID
* 支持模型：`MiniMax-Hailuo-2.3`、`MiniMax-Hailuo-2.3-Fast`
* `MiniMax-Hailuo-2.3`：支持文生視頻和圖生視頻，畫質最優
* `MiniMax-Hailuo-2.3-Fast`：**僅支持圖生視頻**（必須傳入首幀圖片），生成速度更快

> [!WARNING]
>
> 請傳入公網可訪問的圖片 URL。不要在 `image_urls` 中直接傳 base64 圖片數據；本地圖片請先使用 [上傳圖片接口](https://docs.toapis.com/docs/zh-Hant/api-reference/uploads/images.md) 獲取 URL。

## 認證

**Authorization** `string` *required*

所有接口均需要使用 Bearer Token 認證。

```
Authorization: Bearer YOUR_API_KEY
```

## 請求參數

**model** `string` *required*

模型名稱。

可選值：

* `MiniMax-Hailuo-2.3` - 支持文生視頻和圖生視頻
* `MiniMax-Hailuo-2.3-Fast` - 僅支持圖生視頻（必須傳入 `image_urls`）

**prompt** `string` *required*

視頻內容描述，最大 **2000 字符**。

支持 15 種運鏡指令（如 `[推進]`、`[拉遠]`、`[左搖,上升]` 等），詳見下方運鏡指令表。

示例：`"一隻貓咪在花園中奔跑 [推進]，然後停下來看向鏡頭 [固定]"`

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

視頻時長（秒）。

可選值：`6` 或 `10`

> [!WARNING]
>
> 使用 `1080P` 分辨率時，僅支持 `6` 秒時長。

**resolution** `string` (default: 768P)

視頻分辨率。

可選值：

* `768P` - 高清（默認）
* `1080P` - 全高清（僅支持 6 秒時長）

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

首幀圖片 URL 數組。

* 不傳：文生視頻（`MiniMax-Hailuo-2.3-Fast` 不支持，必須傳入）
* 傳 1 張：圖生視頻，圖片作爲視頻起始幀

圖片要求：

* 格式：JPG、JPEG、PNG、WebP
* 大小：小於 20MB
* 尺寸：短邊 > 300px，長寬比在 2:5 \~ 5:2 之間

示例：`["https://example.com/first-frame.jpg"]`

**metadata** `object`

擴展參數。

**顯示 metadata 字段**

**prompt\_optimizer** `boolean` (default: true)

是否自動優化 prompt。設爲 `false` 可進行更精確的控制。

**fast\_pretreatment** `boolean` (default: false)

是否縮短 prompt 優化耗時。啓用後可加快處理速度。

**aigc\_watermark** `boolean` (default: false)

是否在生成的視頻中添加水印。

**callback\_url** `string`

ToAPIs 最終任務 Webhook。需先設定 Token URL 與密鑰；詳見 [Webhook](https://docs.toapis.com/docs/zh-Hant/api-reference/webhooks/task-webhooks.md)。

## 模型對比

| 模型 | 文生視頻 | 圖生視頻 | 分辨率 | 時長 |
| - | :-: | :-: | - | - |
| `MiniMax-Hailuo-2.3` | ✅ | ✅ | `768P` / `1080P` | 6s / 10s |
| `MiniMax-Hailuo-2.3-Fast` | ❌ | ✅（必傳首幀） | `768P` / `1080P` | 6s / 10s |

## 分辨率與時長組合

| 分辨率 | 支持的時長 | 備註 |
| - | - | - |
| 768P | 6 秒、10 秒 | 默認分辨率 |
| 1080P | 6 秒 | 不支持 10 秒 |

## 運鏡指令

在 `prompt` 中使用 `[指令]` 語法控制運鏡效果：

| 類別 | 指令 |
| - | - |
| 平移 | `[左移]` `[右移]` |
| 左右搖 | `[左搖]` `[右搖]` |
| 推拉 | `[推進]` `[拉遠]` |
| 升降 | `[上升]` `[下降]` |
| 上下搖 | `[上搖]` `[下搖]` |
| 變焦 | `[變焦推近]` `[變焦拉遠]` |
| 其他 | `[晃動]` `[跟隨]` `[固定]` |

**使用規則**：

* 組合運鏡：同一 `[]` 內多個指令同時生效，如 `[左搖,上升]`，建議不超過 3 個
* 順序運鏡：prompt 中前後出現的指令依次生效，如 `"...[推進]，然後...[拉遠]"`

## 響應

**id** `string`

任務 ID，用於查詢任務狀態。

**object** `string`

對象類型，固定爲 `generation.task`。

**model** `string`

本次請求使用的模型名稱。

**status** `string`

任務狀態：`queued`、`in_progress`、`completed` 或 `failed`。

**created\_at** `integer`

任務創建時間戳。

## 示例

### 文生視頻

```json theme={null}
{
  "model": "MiniMax-Hailuo-2.3",
  "prompt": "一隻貓咪在花園中奔跑，鏡頭緩緩推近，電影質感",
  "duration": 6,
  "resolution": "1080P"
}
```

### 圖生視頻

```json theme={null}
{
  "model": "MiniMax-Hailuo-2.3",
  "prompt": "讓圖片中的人物緩緩轉身並微笑",
  "image_urls": ["https://example.com/portrait.jpg"],
  "duration": 6,
  "resolution": "1080P"
}
```

### 圖生視頻（Fast 快速模式）

```json theme={null}
{
  "model": "MiniMax-Hailuo-2.3-Fast",
  "prompt": "人物從靜止開始緩慢行走",
  "image_urls": ["https://example.com/person.jpg"],
  "duration": 6,
  "resolution": "768P"
}
```

### 運鏡控制

```json theme={null}
{
  "model": "MiniMax-Hailuo-2.3",
  "prompt": "一個人拿起一本書 [上升]，然後開始閱讀 [固定]",
  "duration": 6,
  "resolution": "768P"
}
```

### 10 秒長視頻

```json theme={null}
{
  "model": "MiniMax-Hailuo-2.3",
  "prompt": "海浪拍打沙灘，日落時分，金色光芒灑在海面上",
  "duration": 10,
  "resolution": "768P",
  "metadata": {
    "prompt_optimizer": true,
    "fast_pretreatment": true
  }
}
```

> [!NOTE]
>
> 視頻生成爲異步任務。提交後使用 [獲取視頻任務狀態](https://docs.toapis.com/docs/zh-Hant/api-reference/tasks/video-status.md) 查詢進度和結果。

```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-Hailuo-2.3",
    "prompt": "一隻貓咪在花園中奔跑，鏡頭緩緩推近，電影質感",
    "duration": 6,
    "resolution": "1080P"
  }'
```

```python Python theme={null}
import requests

response = requests.post(
    "https://toapis.com/v1/videos/generations",
    headers={
        "Authorization": "Bearer your-ToAPIs-key",
        "Content-Type": "application/json",
    },
    json={
        "model": "MiniMax-Hailuo-2.3",
        "prompt": "一隻貓咪在花園中奔跑，鏡頭緩緩推近，電影質感",
        "duration": 6,
        "resolution": "1080P",
    },
)

print(response.json())
```

```javascript JavaScript theme={null}
const response = await fetch("https://toapis.com/v1/videos/generations", {
  method: "POST",
  headers: {
    Authorization: "Bearer your-ToAPIs-key",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "MiniMax-Hailuo-2.3",
    prompt: "一隻貓咪在花園中奔跑，鏡頭緩緩推近，電影質感",
    duration: 6,
    resolution: "1080P"
  })
});

console.log(await response.json());
```

```json 200 theme={null}
{
  "id": "vid_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ",
  "object": "generation.task",
  "model": "MiniMax-Hailuo-2.3",
  "status": "queued",
  "progress": 0,
  "created_at": 1768380224,
  "metadata": {}
}
```


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