> ## 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.

# Wan 3.0 Video LoRA API：生成 480p、720p 或 1080p 影片

> Wan 3.0 Video LoRA 生成 API，支援文生影片、圖生影片與參考影片工作流程

## 概覽

Wan 3.0 Video LoRA 可生成 480p、720p 或 1080p 影片。可以提交提示詞、首影格圖或首尾影格圖，也可以使用多模態參考素材。在 APIXO Playground 試用後，可依本頁範例呼叫 API。

| 功能 | 值 |
| - | - |
| 模型 ID | `wan-3-0-video-LoRA` |
| 模式 | `text-to-video`, `image-to-video`, `reference-to-video` |
| 提示詞 | `text-to-video` 為必填項目；`image-to-video` 與 `reference-to-video` 為可選項目。 |
| 可用解析度 | `480p`, `720p`, `1080p` |
| 縱橫比 | `auto`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16` |
| 長度 | `-1` 表示智慧持續時間，或 `2` 到 `30` 秒之間的任何整數；預設為 `5` |
| 影像到影片影像 | 1-2 影像 URL；第二張影像是選填的最後一影格 |
| 參考輸入 | 最多可提供 10 個影像 URL、5 個影片 URL 或 5 個音訊 URL。 |
| 結果格式 | MP4 URL 陣列位於 `resultJson.resultUrls` 中 |

> [!NOTE]
>
> `wan-3-0-video-LoRA` 為公開模型名稱，不支援自訂 LoRA 設定參數。

## 選擇 WAN 3.0 端點。

所有三個端點均支援文生影片、第一影格或第一幆與最後一幆圖生影片，以及參考到影片。複製參數或價格前，請先選擇端點。

| 端點 | 輸出解析度 | 參考影片輸入 |
| - | - | - |
| [Wan 3.0 Video](https://apixo.ai/docs/zh-hant/models/video/wan-3-0-video.md) | `480p`, `720p`, `1080p` | 支援圖片、影片、音訊，最多可附加一個檔案 URL 或一個網頁連結；檔案與連結輸入互斥。 |
| [Wan 3.0 Video LoRA](https://apixo.ai/docs/zh-hant/models/video/wan-3-0-video-lora.md) | `480p`, `720p`, `1080p` | 影像、影片和音訊；無 `file_urls` 或 `link_urls` |
| [Wan 3.0 Video Pro LoRA](https://apixo.ai/docs/zh-hant/models/video/wan-3-0-video-pro-lora.md) | `1080p`, `2k`, `4k` | 影像、影片和音訊；無 `file_urls` 或 `link_urls` |

有關工作流程選擇，請參閱 [Wan 3.0 Video、LoRA 和 Pro LoRA 比較](https://apixo.ai/blog/wan-3-0-video-vs-lora-vs-pro-lora)。即使兩個端點提供相同的分辨率，也使用 [API 定價](https://apixo.ai/pricing/api) 中所選端點的速率。

## 端點與身分驗證

API 基底網址：

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

| 方法 | 端點 | 用途 |
| - | - | - |
| `POST` | `/generateTask/wan-3-0-video-LoRA` | 送出生成任務 |
| `GET` | `/statusTask/wan-3-0-video-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/wan-3-0-video-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",
      "resolution": "1080p",
      "aspect_ratio": "16:9",
      "duration": 5,
      "sound": true
    }
  }'
```

成功回應：

```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/wan-3-0-video-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 serene lake at sunrise with a slow cinematic camera move",
    "resolution": "1080p",
    "aspect_ratio": "16:9",
    "duration": 6,
    "sound": true
  }
}
```

### 圖生影片

```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": "720p",
    "aspect_ratio": "auto",
    "duration": 5,
    "sound": true
  }
}
```

### 參考生成影片

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "reference-to-video",
    "prompt": "keep the subject identity and use the motion reference",
    "image_urls": [
      "https://example.com/person.png"
    ],
    "video_urls": [
      "https://example.com/motion-reference.mp4"
    ],
    "audio_urls": [
      "https://example.com/audio-reference.mp3"
    ],
    "resolution": "1080p",
    "aspect_ratio": "auto",
    "duration": -1,
    "sound": true
  }
}
```

## 參數

**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*

Wan 3.0 Video LoRA 的輸入參數。

**屬性**

**mode** `string` *required*

生成模式。支援的值：`text-to-video`、`image-to-video`、`reference-to-video`。影片參考至少需要一個受支援的參考輸入；請參閱下面的模式表。

**prompt** `string`

提示文字。 `text-to-video` 所需； `image-to-video` 和 `reference-to-video` 可選。修剪後必填提示不能為空。最大長度：20000 個字元。

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

輸出解析度級距。可用值為 `480p`、`720p`、`1080p`。

**aspect\_ratio** `string` (default: auto)

輸出縱橫比。支援的值：`auto`、`16:9`、`4:3`、`1:1`、`3:4`、`9:16`。使用 `auto` 進行自動取景。

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

輸出持續時間（以秒為單位）。支援 `-1` 智慧持續時間，或從 `2` 到 `30` 的整數，包括數字字串，例如 `"8"`。拒絕諸如 `-1.0` 之類的十進制值。

**sound** `boolean` (default: true)

生成的影片是否應包含音訊。這不會改變價格。

**seed** `integer|string`

選填的隨機種子。支援的範圍：`0` 至 `2147483647`。接受數字字串；小數值被拒絕。

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

影像 URL。需要用於 `image-to-video` 和 1-2 影像，其中 `image_urls[0]` 是第一影格且 `image_urls[1]` 是選填的最後一影格。可選用於 `reference-to-video` 最多 10 影像。每個影像必須是 240–8000 像素寬和 240–8000 像素高，包含在內。`text-to-video` 不接受影像 URL。

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

`reference-to-video` 的參考影片 URL。如果提供，最多支援 5 個 URL。每個影片必須為 1-15 秒，參考影片總時長不能超過 15 秒，參考影片秒數以與所選 `resolution` 相同的每秒費率計費。`text-to-video` 和 `image-to-video` 不接受影片 URL。

**audio\_urls** `string[]`

`reference-to-video` 的參考音訊 URL。如果提供，最多支援 5 個 URL。每個音訊檔案必須為 1-15 秒，總參考音訊持續時間不能超過 15 秒。音訊不單獨計費。`text-to-video` 和 `image-to-video` 不接受音訊 URL。

**nsfw\_checker** `boolean` (default: false)

設為 `true` 可在支援的生成路由上啟用上游內容審核。API 預設值為 `false`。

| 模式 | 所需輸入 | 不支援的媒體欄位 | 計費說明 |
| - | - | - | - |
| `text-to-video` | `prompt` | `image_urls`, `video_urls`, `audio_urls` | 按輸出長度計費，單位為秒。 |
| `image-to-video` | `image_urls` 應包含 1 至 2 張影像 | `video_urls`, `audio_urls` | 按輸出長度計費，單位為秒。 |
| `reference-to-video` | 至少需提供 `image_urls`、`video_urls` 或 `audio_urls` 中的一項。 | 無 | 輸出時長和參考影片秒數按秒計費。 |

> [!TIP]
>
> 對所有媒體輸入使用公共、可直接存取的 URL。影片參考應該是常見的影片文件，例如 MP4、MOV 或 M4V；音訊參考應該是常見的音訊文件，例如 MP3、WAV 或 M4A。

> [!TIP]
>
> 當 `duration` 為正且提供 `video_urls` 時，總參考影片秒數加上 `duration` 不能超過 30 秒。當 `duration` 為 `-1` 時，請求使用智慧持續時間，並預扣費用為輸入影片秒數加上 30 輸出秒數。

有關選擇和組合參考的指南，請參閱 [Wan 3.0 參考工作流程](https://apixo.ai/blog/wan-3-0-multimodal-reference-guide)。其文件和 Web 連結步驟僅適用於標準 Wan 3.0 Video，不適用於此端點。

## 回應格式

### 送出任務時的回應

任務受理後，`POST /generateTask/wan-3-0-video-LoRA` 會傳回任務 ID：

**code** `integer`

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

**message** `string`

狀態說明。

**data.taskId** `string`

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

### 狀態回應欄位

**taskId** `string`

任務的唯一識別碼。

**state** `string`

目前的任務狀態，可能的值為 `processing`、`success`、`failed`。

**resultJson** `string`

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

**failCode** `string`

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

**failMsg** `string`

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

**createTime** `integer`

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

**completeTime** `integer`

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

**costTime** `integer`

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

**billing** `object`

最終計費明細。僅在成功終止的回應中出現，針對提交 `duration=-1` 的 `wan-3-0-video-LoRA` 任務。

**billing.settlementState** `string`

結算狀態。對於此最終快照，該值始終為 `final`。

**billing.inputVideoSeconds** `number`

所有輸入影片的總時長（以秒為單位），四捨五入至小數點後 3 位。

**billing.outputVideoSeconds** `number`

實際產生的輸出影片持續時間（以秒為單位），四捨五入至小數點後 3 位。

**billing.totalBillableSeconds** `number`

最終計費持續時間（以秒為單位）。這始終是 `inputVideoSeconds + outputVideoSeconds`。

**billing.unit** `string`

時間單位，值為 `second`。

**billing.rounding** `string`

用於持續時間欄位的捨入規則。值為 `round half up to 3 decimal places`。

**billing.inputVideoCount** `integer`

`inputVideoSeconds` 中包含的輸入影片數量。

**billing.outputVideoCount** `integer`

`outputVideoSeconds` 中包含的輸出影片數量。

## Webhook 回呼模式

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

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/wan-3-0-video-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 a polished product video using the references",
      "image_urls": [
        "https://example.com/ref.png"
      ],
      "resolution": "720p",
      "aspect_ratio": "auto",
      "duration": -1,
      "sound": true
    }
  }'
```

在回呼有效負載中，使用與狀態輪詢相同的頂級結構，包含 `code`、`message` 和 `data`。成功的回呼會包含最終的 `state` 和 `resultJson`。對於 `duration=-1` 任務，成功的終端回呼會包含與狀態輪詢相同之 `data.billing` 物件。請參閱 [Webhooks](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)。

Wan 3.0 Video LoRA 按秒計費。單價依 `resolution` 變動；相同解析度下，所有支援的模式共享相同速率。

| 模式 | 解析度 | APIXO 官方價格 |
| - | - | - |
| `text-to-video` | `480p` | `$0.053 / second` |
| `text-to-video` | `720p` | `$0.105 / second` |
| `text-to-video` | `1080p` | `$0.210 / second` |
| `image-to-video` | `480p` | `$0.053 / second` |
| `image-to-video` | `720p` | `$0.105 / second` |
| `image-to-video` | `1080p` | `$0.210 / second` |
| `reference-to-video` | `480p` | `$0.053 / second` |
| `reference-to-video` | `720p` | `$0.105 / second` |
| `reference-to-video` | `1080p` | `$0.210 / second` |

計費公式：

| 請求 | 公式 |
| - | - |
| `text-to-video` 或 `image-to-video` 且 `duration` 為正值 | `duration * unitPrice` |
| `reference-to-video` 且 `duration` 為正值 | `(input video seconds + duration) * unitPrice` |
| 任一 `duration = -1` 的模式 | 預扣費用為 `(input video seconds + 30) * unitPrice`；成功後，最終計費秒數為 `input video seconds + actual output seconds`，差額將退還 |

輸入的影像與音訊檔案不會增加獨立的計費秒數。

對使用 `duration=-1` 的任務，成功結束後的回應會在 `data.billing` 中傳回最終結算秒數。以下示例假設參考影片為 5.371 秒、輸出影片為 10.042 秒，用於說明計費明細，並非任務實測結果。

```json theme={null}
{
  "billing": {
    "settlementState": "final",
    "inputVideoSeconds": 5.371,
    "outputVideoSeconds": 10.042,
    "totalBillableSeconds": 15.413,
    "unit": "second",
    "rounding": "round half up to 3 decimal places",
    "inputVideoCount": 1,
    "outputVideoCount": 1
  }
}
```

`billing` 中的時長均以秒為單位，四捨五入至小數點後三位。`inputVideoSeconds` 是所有輸入影片的總時長，`inputVideoCount` 是計入總時長的影片個數，`outputVideoSeconds` 是實際生成的影片時長。`totalBillableSeconds` 始終等於 `inputVideoSeconds + outputVideoSeconds`。未提供輸入影片時，`inputVideoSeconds` 為 `0.000`，`inputVideoCount` 為 `0`。只有最終結算成功後才會傳回此 `billing` 物件，成功回撥中也會包含它。重複輪詢會得到相同的值。

如果沒有參考影片，輸入影片秒數為零。影片參考仍然需要至少一個受支援的參考輸入。對於`duration=-1`，30輸出秒數是預扣費用基礎，而不是承諾的輸出長度。最終費用為`(input video seconds + actual output seconds) * unitPrice`；使用 `data.billing.settlementState=final` 的成功回應來確定秒數。

例如，使用記錄的`1080p`基本速率`$0.21/second`、5秒參考影片和固定10秒輸出，成本為`$3.15`。對於`duration=-1`，相同輸入初始預扣費用為`(5 + 30) * $0.21 = $7.35`。若成功輸出10秒，則最終費用為`$3.15`，退還差額為`$4.20`。這些為算術範例，非實際生成結果。

有關預算演練，請參閱 [Wan 3.0 持續時間和成本指南](https://apixo.ai/blog/wan-3-0-duration-and-cost)。其美元範例使用標準 Wan 3.0 Video 費率；檢查 [API 定價](https://apixo.ai/pricing/api) 以了解所選端點的當前費率。API 使用量以 USD 分開計費，與 Studio 每月積分無關。

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

## 耗時與輪詢

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

### 驗證說明

| 條件 | 後端行為 |
| - | - |
| 缺少 `input` | 請求會遭拒，系統不會建立任務。 |
| 缺少 `mode` | 請求會遭拒，系統不會建立任務。 |
| 不支援的 `mode` 值 | 請求會遭拒，系統不會建立任務。可用值為 `text-to-video`、`image-to-video`、`reference-to-video`。 |
| `text-to-video` 請求中缺少 `prompt` | 請求會遭拒，系統不會建立任務。 |
| `prompt` 欄位為空 | 請求會遭拒，系統不會建立任務。 |
| 缺少 `resolution` | 預設值為 `1080p`。 |
| 不支援的 `resolution` 值 | 請求會遭拒，系統不會建立任務。可用值為 `480p`、`720p`、`1080p`。 |
| 缺少 `aspect_ratio` | 預設值為 `auto`。 |
| 不支援的 `aspect_ratio` 值 | 請求在任務建立前失敗。請使用 `auto`、`16:9`、`4:3`、`1:1`、`3:4` 或 `9:16`。 |
| 缺少 `duration` | 預設值為 `5`。 |
| `duration` 不在 `-1` 或 `2` 至 `30` 之間，或為小數值 | 請求會遭拒，系統不會建立任務。 |
| `image-to-video` 未提供 `image_urls` | 請求會遭拒，系統不會建立任務。 |
| `image-to-video` 模式的圖片超過 2 張 | 請求會遭拒，系統不會建立任務。 |
| `reference-to-video` 未提供任何參考輸入 | 請求會遭拒，系統不會建立任務。 |
| 參考影片或音訊的時長不足 1 秒或超過 15 秒 | 請求會遭拒，系統不會建立任務。 |
| 總參考影片持續時間或總參考音訊持續時間超過 15 秒 | 請求會遭拒，系統不會建立任務。 |
| 正數 `duration` 加上總參考影片長度超過 30 秒 | 請求會遭拒，系統不會建立任務。 |

### 任務失敗代碼

`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/wan-3-0-video-lora.json) 中的 `mcp.result` 指定結果的解析方式，`mcp.attachments` 列出可繫結檔案的欄位。這些中繼資料供用戶端整合使用，無須當作生成參數提交。附件欄位為 `image_urls`, `video_urls`, `audio_urls`。請保留使用者指定的檔案順序。模型參數由 API 驗證。

## 相關連結

* [生成 API 總覽](https://apixo.ai/docs/zh-hant/models.md)
* [Wan 3.0 Video Pro LoRA](https://apixo.ai/docs/zh-hant/models/video/wan-3-0-video-pro-lora.md)


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