> ## 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 2.2 Video LoRA API：控制影片首影格和尾影格

> 圖生影片 API，具有選填的第一影格和最後一影格控制、基於 LoRA 的樣式以及短剪輯的靈活持續時間。

## 概覽

Wan 2.2 Video LoRA是非同步影像到影片模型。它可以為起始影像設定動畫或在第一影格和最後一影格之間創建過渡。

| 功能 | 值 |
| - | - |
| 模型 ID | `wan-2-2-video-LoRA` |
| 模式 | `image-to-video`（必填） |
| 圖片 | 1 第一影格影像，加上 1 選填的最後一影格影像 |
| 長度 | `5` 或 `8` 秒 |
| 解析度 | `480p`或`720p` |
| 輸出 | MP4 影片 URL 陣列位於 `resultJson.resultUrls` 中 |

## 端點與身分驗證

API 基底網址：

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

| 方法 | 端點 | 用途 |
| - | - | - |
| `POST` | `/generateTask/wan-2-2-video-LoRA` | 提交影像轉影片任務 |
| `GET` | `/statusTask/wan-2-2-video-LoRA?taskId={taskId}` | 查詢任務狀態並取得結果 |

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

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

## 非同步請求範例

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/wan-2-2-video-LoRA" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "image-to-video",
      "prompt": "a cinematic camera move through a rainy neon street",
      "image_urls": ["https://example.com/first-frame.png"],
      "duration": 5,
      "resolution": "480p",
      "prompt_extend": true
    }
  }'
```

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

## 第一影格和最後一影格請求

按順序傳遞兩個影像 URL：第一影格，然後是最後一影格。

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-video",
    "prompt": "move smoothly from sunrise to a starry night",
    "image_urls": [
      "https://example.com/first-frame.png",
      "https://example.com/last-frame.png"
    ],
    "duration": 8,
    "resolution": "720p",
    "prompt_extend": true,
    "seed": 12345
  }
}
```

## 參數

**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 2.2 Video LoRA 的輸入參數。

**屬性**

**mode** `string` *required*

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

**prompt** `string` *required*

描述所需影片的非空白文字。

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

一兩個可公開存取的影像 URL。第一個URL為第一影格；選填的第二個 URL 是最後一影格。

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

輸出長度，以秒為單位。可用值為 `5`、`8`。

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

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

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

是否重寫並豐富生成前的提示。此選項不會產生額外費用。

**seed** `integer`

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

## 輪詢結果

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

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

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

## 計費

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

計費基於輸出持續時間：`480p` 成本 `$0.044/second`；`720p` 成本 `$0.088/second`。`prompt_extend`不另加單獨費用。

## 提示

* 所有媒體 URL 必須可由 API 公開存取。
* 任務創建後大約 60 秒開始輪詢，然後每 10 秒輪詢一次。
* 對長時間運作的生產工作流程使用回呼傳遞。

## MCP 整合

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

## 相關連結

* [影片模型](https://apixo.ai/docs/zh-hant/models/video)
* [生成 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)
* [API定價](https://apixo.ai/pricing/api)


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