> ## 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 快速模式

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

<Warning>
  請傳入公網可訪問的圖片 URL。不要在 `image_urls` 中直接傳 base64 圖片數據；本地圖片請先使用 [上傳圖片接口](../../uploads/images) 獲取 URL。
</Warning>

## 認證

<ParamField header="Authorization" type="string" required>
  所有接口均需要使用 Bearer Token 認證。

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## 請求參數

<ParamField body="model" type="string" required>
  模型名稱。

  可選值：

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

<ParamField body="prompt" type="string" required>
  視頻內容描述，最大 **2000 字符**。

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

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

<ParamField body="duration" type="integer" default="6">
  視頻時長（秒）。

  可選值：`6` 或 `10`

  <Warning>
    使用 `1080P` 分辨率時，僅支持 `6` 秒時長。
  </Warning>
</ParamField>

<ParamField body="resolution" type="string" default="768P">
  視頻分辨率。

  可選值：

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

<ParamField body="image_urls" type="string[]">
  首幀圖片 URL 數組。

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

  圖片要求：

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

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

<ParamField body="metadata" type="object">
  擴展參數。

  <Expandable title="顯示 metadata 字段">
    <ParamField body="prompt_optimizer" type="boolean" default="true">
      是否自動優化 prompt。設爲 `false` 可進行更精確的控制。
    </ParamField>

    <ParamField body="fast_pretreatment" type="boolean" default="false">
      是否縮短 prompt 優化耗時。啓用後可加快處理速度。
    </ParamField>

    <ParamField body="aigc_watermark" type="boolean" default="false">
      是否在生成的視頻中添加水印。
    </ParamField>

    <ParamField body="callback_url" type="string">
      回調地址。任務狀態變更時，系統將向此 URL 發送 POST 回調。
    </ParamField>
  </Expandable>
</ParamField>

## 模型對比

| 模型                        | 文生視頻 |   圖生視頻  | 分辨率              | 時長       |
| ------------------------- | :--: | :-----: | ---------------- | -------- |
| `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 中前後出現的指令依次生效，如 `"...[推進]，然後...[拉遠]"`

## 響應

<ResponseField name="id" type="string">
  任務 ID，用於查詢任務狀態。
</ResponseField>

<ResponseField name="object" type="string">
  對象類型，固定爲 `generation.task`。
</ResponseField>

<ResponseField name="model" type="string">
  本次請求使用的模型名稱。
</ResponseField>

<ResponseField name="status" type="string">
  任務狀態：`queued`、`in_progress`、`completed` 或 `failed`。
</ResponseField>

<ResponseField name="created_at" type="integer">
  任務創建時間戳。
</ResponseField>

## 示例

### 文生視頻

```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>
  視頻生成爲異步任務。提交後使用 [獲取視頻任務狀態](../../tasks/video-status) 查詢進度和結果。
</Note>

<RequestExample>
  ```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());
  ```
</RequestExample>

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