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

# MiniMax H3 LoRA API：生成 480p 或 768p 影片

> MiniMax H3 LoRA 提供 480p 與 768p 影片生成 API，支援文生影片、圖生影片及參考生影片的工作流程。

## 概覽

MiniMax H3 LoRA 可生成 480p 或 768p 影片。支援文字提示詞、首影格圖或首尾影格圖，也可使用圖片或影片作為參考。在 APIXO Playground 試用後，可依本頁範例呼叫 API。

| 功能 | 值 |
| - | - |
| 模型 ID | `minimax-h3-LoRA` |
| 模式 | `text-to-video`, `image-to-video`, `reference-to-video` |
| 提示詞 | 必需的非空字串，最多 4,000 個字元 |
| 輸出解析度 | `480p` 或 `768p`；預設為 `480p` |
| 輸出持續時間 | 從 `5` 到 `15` 秒的任何整數；預設為 `5` |
| 縱橫比 | `21:9`、`16:9`、`4:3`、`1:1`、`3:4`、`9:16` 適用於所有模式 |
| 影像到影片影像 | 1-2 影像 URL；第二張影像是選填的最後一影格 |
| 參考輸入 | 最多 6 HTTPS 影像 URL 和 1 HTTPS 影片 URL 作為影片參考 |
| 參考影片限制 | 0.5–60 秒，最多 100 MiB |
| 結果格式 | MP4 URL 陣列位於 `resultJson.resultUrls` 中 |

> [!NOTE]
>
> `minimax-h3-LoRA` 是公共型號名稱。它不接受自訂 LoRA 設定參數。

## 端點與身分驗證

API 基底網址：

```text theme={null}
https://api.apixo.ai/api/v1
```

| 方法 | 端點 | 用途 |
| - | - | - |
| `POST` | `/generateTask/minimax-h3-LoRA` | 送出生成任務 |
| `GET` | `/statusTask/minimax-h3-LoRA?taskId={taskId}` | 查詢任務狀態並取得結果 |

每個請求都必須附上 APIXO API 金鑰：

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

送出任務時，還需設定以下請求標頭：

```http theme={null}
Content-Type: application/json
```

## 非同步請求範例

以下範例提交一個最簡單的文字生成影片任務，回應中會傳回 `taskId`。

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/minimax-h3-LoRA" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-video",
      "prompt": "a cinematic product reveal with smooth camera movement and premium studio lighting",
      "aspect_ratio": "16:9",
      "resolution": "768p",
      "duration": 8
    }
  }'
```

成功回應：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
```

請保留 `taskId`，後續輪詢結果時會用到。

## 輪詢結果

```bash theme={null}
curl -X GET "https://api.apixo.ai/api/v1/statusTask/minimax-h3-LoRA?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

任務處理中的回應範例：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing",
    "createTime": 1767965610929
  }
}
```

成功回應：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/video.mp4\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965790929,
    "costTime": 180000
  }
}
```

任務失敗時的回應範例：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "UPSTREAM_ERROR",
    "failMsg": "Generation failed",
    "createTime": 1767965610929,
    "completeTime": 1767965620132
  }
}
```

等 `state` 變為 `success` 後，再解析 `resultJson`：

```javascript theme={null}
const payload = JSON.parse(data.resultJson);
const videoUrls = payload.resultUrls;
```

## 請求體

### 文生影片

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "text-to-video",
    "prompt": "a cinematic night street in Tokyo with rain reflections and slow camera movement",
    "aspect_ratio": "16:9",
    "resolution": "768p",
    "duration": 10,
    "seed": -1
  }
}
```

### 圖生影片

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-video",
    "prompt": "animate this portrait with subtle head movement and cinematic lighting",
    "image_urls": [
      "https://example.com/first-frame.png",
      "https://example.com/last-frame.png"
    ],
    "resolution": "480p",
    "duration": 8
  }
}
```

### 參考生成影片

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "reference-to-video",
    "prompt": "create a polished product launch video using the visual references and camera motion",
    "image_urls": [
      "https://example.com/product.png",
      "https://example.com/brand-style.png"
    ],
    "video_urls": [
      "https://example.com/motion-reference.mp4"
    ],
    "aspect_ratio": "16:9",
    "resolution": "480p",
    "duration": 8
  }
}
```

## 參數

**request\_type** `string` (default: async)

結果交付方式。支援的值：`async`、`callback`。使用 `async` 進行輪詢（搭配 `statusTask`），或使用 `callback` 進行 Webhook 交付。

**callback\_url** `string`

當 `request_type` 為 `callback` 時必填。請提供可從網際網路存取的 HTTPS 網址，以接收任務的最終結果。詳見 [Webhook](https://apixo.ai/docs/zh-hant/api-reference/webhooks.md)。

**input** `object` *required*

MiniMax H3 LoRA 的輸入參數。

**屬性**

**mode** `string` *required*

生成模式。可用值為 `text-to-video`、`image-to-video`、`reference-to-video`。

**prompt** `string` *required*

描述所需影片的文字提示。後端會修剪空白、拒絕空提示，並允許最多 4,000 個字元。

**resolution** `string` (default: 480p)

輸出解析度。可用值為 `480p`、`768p`。預設值為 `480p`。

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

輸出持續時間（以秒為單位）。支援從 `5` 到 `15` 的整數，包括數字字串，例如 `"8"`。小數值被拒絕。

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

所有模式的輸出寬高比。預設為 16:9。支援的值為：21:9、16:9、4:3、1:1、3:4、9:16。

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

民眾 HTTPS 影像 URL。需要用於 `image-to-video` 和 1-2 影像，其中 `image_urls[0]` 是第一影格且 `image_urls[1]` 是選填的最後一影格。可選用於 `reference-to-video` 最多 6 影像。影片參考至少需要一個 `image_urls` 或者 `video_urls` 參考。

**video\_urls** `string[]`

一個公開的 HTTPS 參考影片 URL，用於影片參考。持續時間必須為 0.5 至 60 秒，檔案大小必須最多為 100 MiB。實際輸入影片的時長將依照所選輸出解析度的參考影片速率計費。

**seed** `integer|string`

可選的整數種子，用於產生可重複的輸出。接受數字字串；小數值將被拒絕。

| 模式 | 所需媒體 | 可選的媒體 | 計費說明 |
| - | - | - | - |
| `text-to-video` | 無 | 無 | 輸出持續時間以所選解析度為單位，每秒計費。 |
| `image-to-video` | `image_urls` 應包含 1 至 2 張影像 | 無 | 輸出持續時間以所選解析度為單位，每秒計費。 |
| `reference-to-video` | 至少提供一張參考圖或一個參考影片 | `image_urls` 與 `video_urls` | 輸出時長、參考圖片與參考影片的秒數將分別計費。 |

> [!TIP]
>
> 對所有參考媒體使用公共、可直接存取的 HTTPS URL。在送出任務之前會檢查參考影片。

## 回應格式

### 送出任務時的回應

任務受理後，`POST /generateTask/minimax-h3-LoRA` 會傳回任務 ID：

**code** `integer`

API 狀態碼。`200` 表示任務已受理。

**message** `string`

狀態說明。

**data.taskId** `string`

任務的唯一 ID，用於查詢任務狀態。

### 狀態回應欄位

**taskId** `string`

任務的唯一識別碼。

**state** `string`

當狀態為 `processing` 時進行輪詢。到達 `success` 或 `failed` 時停止。被取消的一代以 `failed` 結束。

**resultJson** `string`

當 `state` 為 `success` 時傳回。解析此 JSON 字串後，即可從 `resultUrls` 取得生成的影片連結。

**failCode** `string`

供程式判讀的錯誤碼，僅在 `state` 為 `failed` 時傳回。

**failMsg** `string`

失敗原因說明，僅在 `state` 為 `failed` 時傳回。

**createTime** `integer`

任務建立時的 Unix 時間戳記，單位為毫秒。

**completeTime** `integer`

任務完成時的 Unix 時間戳記，單位為毫秒。任務完成後才會傳回。

**costTime** `integer`

處理時間，以毫秒為單位。任務完成且有計時資料時才會傳回。

## Webhook 回呼模式

若希望後端自動收到最終結果，可使用回呼模式，無須輪詢。

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/minimax-h3-LoRA" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/webhooks/apixo",
    "input": {
      "mode": "reference-to-video",
      "prompt": "create an 8-second cinematic product video using these visual references",
      "image_urls": [
        "https://example.com/ref-01.png",
        "https://example.com/ref-02.png"
      ],
      "aspect_ratio": "16:9",
      "resolution": "480p",
      "duration": 8
    }
  }'
```

回呼資料與輪詢回應有相同的頂層欄位：`code`、`message` 和 `data`。任務成功時，回呼也會包含最終的 `state` 與 `resultJson`。接收條件與重試規則請見 [Webhook](https://apixo.ai/docs/zh-hant/api-reference/webhooks.md)。

## 計費

新提交的非 LLM 請求按 **1 點 = `$0.001`** 計費。先依用量和加購項目計算總額，再套用帳戶折扣，最後將請求總額無條件進位至整數點數。若已約定固定單價，則保留該單價的精度，不再使用標準價或另行打折；最終點數仍須進位。詳見[積分換算與進位](https://apixo.ai/docs/zh-hant/pricing.md#credit-conversion-and-rounding)。

MiniMax H3 LoRA 依所選模式和解析度按輸出秒計費。`reference-to-video` 有自己的輸出速率，並且還對參考影像和參考影片秒數進行計費。

| 項目 | APIXO 價格 | 計費規則 |
| - | - | - |
| 文字/影像到影片輸出，`480p` | `$0.04 / second` | `duration * $0.04` |
| 文字/影像到影片輸出，`768p` | `$0.08 / second` | `duration * $0.08` |
| 參考影像輸出，`480p` | `$0.05 / second` | `duration * $0.05` |
| 參考影像輸出，`768p` | `$0.10 / second` | `duration * $0.10` |
| 參考影像輸入 | `$0.02 / image` | `image_urls.length * $0.02` |
| 帶有 `480p` 輸出的參考影片輸入 | `$0.05 / second` | `video_urls` 所對應的實際總秒數乘以 `$0.05` |
| 帶有 `768p` 輸出的參考影片輸入 | `$0.10 / second` | `video_urls` 所對應的實際總秒數乘以 `$0.10` |

對於文字/圖生影片，請使用 `output_rate = $0.04` 在 `480p` 或 `$0.08` 在 `768p`；對於影片參考，生成的影片與輸入參考影片均使用 `reference_video_rate = $0.05` 在 `480p` 或 `$0.10` 在 `768p`，依據所選輸出解析度計算。

`text-to-video` 與 `image-to-video` 的公式為：

```text theme={null}
total cost = output duration * output_rate
```

`reference-to-video` 的公式為：

```text theme={null}
total cost = output duration * reference_video_rate
           + reference image count * $0.02
           + total reference video seconds * reference_video_rate
```

範例：

| 請求 | 收費範例 |
| - | - |
| 10秒`768p`文字到影片輸出 | `10 * $0.08 = $0.80` |
| 8 秒 `480p` 參考影片輸出、6 張參考影像和 30 秒參考影片 | `(8 * $0.05) + (6 * $0.02) + (30 * $0.05) = $2.02` |
| 5 秒 `768p` 參考影片輸出和 5 秒參考影片 | `(5 * $0.10) + (5 * $0.10) = $1.00` |

最新的美元費率請見 [API 價目表](https://apixo.ai/pricing/api)。

## 耗時與輪詢

MiniMax H3 LoRA 任務是長時間運行的影片作業。實際延遲可能會因提示複雜性、持續時間、解析度、參考媒體可存取性、路由佇列負載和生成時間而異。

| 工作量 | 一般生成時間 | 建議首次查詢時間 | 輪詢間隔 |
| - | - | - | - |
| 文字轉影片或影像轉影片 | 因提示和持續時間而異 | 任務建立 60 秒後 | 10s-15s |
| 帶有影像或影片輸入的影片參考 | 通常比簡單生成更長 | 任務建立 60 至 90 秒後 | 10s-15s |

> [!TIP]
>
> 正式環境建議使用回呼，以免在影片生成期間頻繁輪詢。

結果連結有時效。任務完成後，請盡快下載並儲存重要檔案。

請求頻率與並行數上限會依帳戶、API 金鑰和路由而異。收到 `429` 時，請降低請求頻率，並逐步拉長重試間隔。帳戶層級的限制請見[系統 API](https://apixo.ai/docs/zh-hant/api-reference/system.md)。

## 錯誤與排查

### HTTP 錯誤

| 代碼 | 含義 | 處理方式 |
| - | - | - |
| `400` | 請求主體無效、缺少 `input`、不受支援的 `mode`、缺少 `prompt`、無效 `resolution`、無效 `duration`、無效 `aspect_ratio` 或無效媒體陣列 | 修正請求後再試 |
| `401` | 缺少 API 金鑰，或金鑰無效 | 檢查 `Authorization` 請求標頭 |
| `402` | 餘額或配額不足 | 充值或更換帳號或金鑰 |
| `403` | 金鑰或路由無權訪問該模型 | 檢查權限和路由策略 |
| `404` | 輪詢時未找到任務 | 檢查`taskId` |
| `429` | 已達到速率或並行限制 | 以指數退避方式重試 |
| `500` | 伺服器錯誤或未知任務失敗 | 逐步拉長間隔後重試 |
| `502` | 服務錯誤 | 逐步拉長間隔後重試 |
| `504` | 服務超時 | 重新嘗試；耗時較長的任務可改用回呼模式 |

### 驗證說明

| 條件 | 後端行為 |
| - | - |
| 缺少 `input` | 請求會遭拒，系統不會建立任務。 |
| 缺失、非字串或空 `prompt` | 請求會遭拒，系統不會建立任務。 |
| 提示超過 4,000 個字元 | 請求會遭拒，系統不會建立任務。 |
| 缺少 `mode` | 請求會遭拒，系統不會建立任務。 |
| 不支援的 `mode` 值 | 請求會遭拒，系統不會建立任務。可用值為 `text-to-video`、`image-to-video`、`reference-to-video`。 |
| 缺少 `resolution` | 預設值為 `480p`。 |
| 不支援的 `resolution` 值 | 請求會遭拒，系統不會建立任務。可用值為 `480p`、`768p`。 |
| 缺少 `duration` | 預設值為 `5`。 |
| `duration` 不在 `5` 到 `15` 之間或為小數值 | 請求會遭拒，系統不會建立任務。 |
| 缺少 `aspect_ratio` | 預設值為 `16:9`。 |
| 不支援的 `aspect_ratio` 值 | 請求會遭拒，系統不會建立任務。 |
| 圖生影片未提供 `image_urls` | 請求會遭拒，系統不會建立任務。 |
| 圖生影片時提供了超過 2 張圖片 | 請求會遭拒，系統不會建立任務。 |
| 參考影片既未提供 `image_urls` 也未提供 `video_urls` | 請求會遭拒，系統不會建立任務。 |
| 參考生成影片時，圖片超過 6 張或影片超過 1 個 | 請求會遭拒，系統不會建立任務。 |
| 參考影片長度超出 0.5–60 秒或不可用 | 請求在上游提交之前失敗 |
| `seed` 是十進制值 | 請求會遭拒，系統不會建立任務。 |
| 自訂 LoRA 設定欄位 | 目前的模型介面不支援此選項。 |

### 任務失敗代碼

`failCode` 表示任務失敗的原因，常見值如下。

| 錯誤碼 | 含義 | 處理方式 |
| - | - | - |
| `SensitiveContent` | 提示或輸入/輸出內容被安全檢查拒絕 | 更改提示或參考媒體 |
| `PromptInvalid` | 提示詞無效或遭拒 | 修改提示詞後再試一次 |
| `ImageFormatIncorrect` | 無法處理參考影像格式 | 請提供可公開存取的圖片直連網址，並使用常見的圖片格式 |
| `RateLimited` | 請求頻率已達上限 | 以指數退避方式重試 |
| `Timeout` | 任務逾時 | 稍後重試或使用回呼模式 |
| `Unknown error` | 任務因不明原因失敗 | 逐步拉長間隔後重試，或聯絡支援團隊並提供 `taskId` |

完整列表見[錯誤碼](https://apixo.ai/docs/zh-hant/api-reference/errors.md)。

## MCP 整合

[完整模型 Schema](https://apixo.ai/docs/models/schemas/video/minimax-h3-lora.json) 中的 `mcp.result` 指定結果的解析方式，`mcp.attachments` 列出可繫結檔案的欄位。這些中繼資料供用戶端整合使用，無須當作生成參數提交。附件欄位為 `image_urls` and `video_urls`。請保留使用者指定的檔案順序。模型參數由 API 驗證。

## 相關連結

* [生成 API 總覽](https://apixo.ai/docs/zh-hant/models.md)
* [影片模型](https://apixo.ai/docs/zh-hant/models/video)
* [送出生成任務](https://apixo.ai/docs/zh-hant/api-reference/generate-task.md)
* [查詢任務狀態](https://apixo.ai/docs/zh-hant/api-reference/status-task.md)
* [Webhook](https://apixo.ai/docs/zh-hant/api-reference/webhooks.md)
* [錯誤碼](https://apixo.ai/docs/zh-hant/api-reference/errors.md)
* [參數規範](https://apixo.ai/docs/zh-hant/api-reference/parameters.md)
* [路由策略](https://apixo.ai/docs/zh-hant/concepts/routing-strategies.md)
* [嘗試 MiniMax H3 LoRA 在 APIXO Playground](https://apixo.ai/models/minimax-h3-lora)
* [API定價](https://apixo.ai/pricing/api)


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