> ## 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 Animate LoRA API：將動作遷移到目標角色

> 使用 Wan Animate LoRA API 從來源影像和運動影片驅動角色動畫，具有風格化的運動傳輸和非同步任務輪詢。

## 概覽

Wan Animate LoRA是非同步角色動畫模型。它使用一張來源影像作為角色參考和一個運動影片作為運動參考，然後傳回生成的 MP4 影片。

| 功能 | 值 |
| - | - |
| 模型 ID | `wan-animate-LoRA` |
| 模式 | `animate`（必填） |
| 來源圖片 | 確切地 1 個 URL 在 `image_urls` |
| 動態影片 | 正是 1 公開 HTTPS 影片 URL 中的 `video_urls` |
| 解析度 | `480p`, `720p` |
| 計費時長 | 從 `video_urls[0]` 開始偵測，計費至小數點後 3 位，最低 5 秒 |
| 種子 | 從 `0` 到 `2147483647` 的可選整數 |

## 端點與身分驗證

API 基底網址：

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

| 方法 | 端點 | 用途 |
| - | - | - |
| `POST` | `/generateTask/wan-animate-LoRA` | 提交動畫任務 |
| `GET` | `/statusTask/wan-animate-LoRA?taskId={taskId}` | 查詢任務狀態並取得結果 |

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

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

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

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

## 非同步請求範例

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/wan-animate-LoRA" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "animate",
      "image_urls": [
        "https://example.com/character.png"
      ],
      "video_urls": [
        "https://example.com/motion.mp4"
      ],
      "prompt": "animate the character following the reference motion",
      "resolution": "720p",
      "seed": 12345
    }
  }'
```

回應包含 `taskId`。儲存它並輪詢狀態端點，直到 `state` 變成 `success` 或 `failed`。

## 請求體

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "animate",
    "image_urls": [
      "https://example.com/character.png"
    ],
    "video_urls": [
      "https://example.com/motion.mp4"
    ],
    "prompt": "keep the face stable and follow the reference motion naturally",
    "resolution": "480p",
    "seed": 42
  }
}
```

## 參數

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

取得結果的方式。選擇 `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 Animate LoRA 的輸入參數。

**屬性**

**mode** `string` *required*

生成模式。可用值為 `animate`。

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

來源影像 URL。準確提供 1 公開 HTTP/HTTPS 影像 URL。來源影像不應大於 50 MB。

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

動作參考影片 URL。準確提供 1 公開 HTTPS 影片 URL。影片大小不得大於 200 MB。APIXO 在送出任務之前探測 `video_urls[0]` 以偵測計費持續時間。

**prompt** `string`

可選提示指導。如果提供，它必須是非空字串。

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

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

**seed** `integer`

從 `0` 到 `2147483647` 的可選隨機種子。

## 輪詢結果

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

任務處理中的回應範例：

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

成功回應：

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

`state`變成`success`後，解析`resultJson`並讀取其`resultUrls`陣列。

## Webhook 回呼模式

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

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/wan-animate-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": "animate",
      "image_urls": [
        "https://example.com/character.png"
      ],
      "video_urls": [
        "https://example.com/motion.mp4"
      ],
      "prompt": "animate the character following the reference motion",
      "resolution": "720p"
    }
  }'
```

Webhook 的接收條件與重試規則請見 [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)。

Wan Animate LoRA 依產生的影片秒數計費。所選的`resolution`確定單價，並從`video_urls[0]`檢測計費持續時間。

| 解析度 | 計費輸入 | APIXO 價格 |
| - | - | - |
| `480p` | 偵測到的參考影片時長，最短 5 秒，計費至小數點後 3 位 | `$0.064 / second` |
| `720p` | 偵測到的參考影片時長，最短 5 秒，計費至小數點後 3 位 | `$0.132 / second` |

如果參考影片短於 5 秒，則計費使用 5 秒。較長的影片按檢測到的時長計費。

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

## 耗時與輪詢

實際延遲可能因參考影片持續時間、解析度、佇列負載和當前路由運行狀況而異。

| 請求結構 | 一般生成時間 | 建議首次查詢時間 | 輪詢間隔 |
| - | - | - | - |
| 短片 `480p` 動畫 | 隨參考影片持續時間和佇列負載而變化 | 任務建立 60 秒後 | 5s-10s |
| 短片 `720p` 動畫 | 隨參考影片持續時間和佇列負載而變化 | 任務建立 60 秒後 | 5s-10s |
| 較長的參考影片 | 隨參考影片持續時間和佇列負載而變化 | 任務建立 60 至 120 秒後 | 10s |

> [!TIP]
>
> 影片生成可能需要幾分鐘的時間。對於生產工作負載，建議使用回呼模式以避免頻繁輪詢。

## 錯誤與排查

| 原因 | 需要檢查什麼 |
| - | - |
| 無效模式 | 使用`mode: "animate"` |
| 介質形狀無效 | 準確提供 1 `image_urls` 項和 1 `video_urls` 項 |
| 無法探測影片 URL | 使用支援範圍讀取或完整下載的直接公開 HTTPS 影片 URL |
| 解析度無效 | 使用`480p`或`720p` |
| 無效種子 | 使用 `0` 到 `2147483647` 之間的整數 |
| 速率限製或任務超時 | 使用退避重試或切換到回呼模式 |

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

## MCP 整合

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

## 相關連結

* [生成 API 總覽](https://apixo.ai/docs/zh-hant/models.md)
* [送出生成任務](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)
* [API定價](https://apixo.ai/pricing/api)


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