> ## 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.7 Video LoRA API：生成影片時選填配聲音

> 圖生影片 API，具有選填的生成聲音或提供的音訊、基於 LoRA 的樣式以及短剪輯的第一影格控制。

## 概覽

Wan 2.7 Video LoRA 是一種非同步影像到影片模型，它可以對一個起始影像進行動畫處理，並可以產生聲音或使用一個提供的音軌。

| 功能 | 值 |
| - | - |
| 模型 ID | `wan-2-7-video-LoRA` |
| 模式 | `image-to-video`（必填） |
| 圖片 | 必須且僅限 1 個第一影格影像 |
| 音訊 | 最多 1 個可選音訊 URL |
| 長度 | 從 `2` 到 `15` 秒的任何整數 |
| 解析度 | `720p`或`1080p` |
| 輸出 | MP4 影片 URL 陣列位於 `resultJson.resultUrls` 中 |

## 端點與身分驗證

API 基底網址：

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

| 方法 | 端點 | 用途 |
| - | - | - |
| `POST` | `/generateTask/wan-2-7-video-LoRA` | 提交影像轉影片任務 |
| `GET` | `/statusTask/wan-2-7-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-7-video-LoRA" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "image-to-video",
      "prompt": "a dancer performs under dramatic stage lighting",
      "image_urls": ["https://example.com/first-frame.png"],
      "sound": true,
      "duration": 8,
      "resolution": "720p",
      "prompt_extend": true
    }
  }'
```

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

## 請求提供音訊

當存在 `audio_urls` 時，`sound` 必須為 `true` 或省略。

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-video",
    "prompt": "subtle natural movement synchronized with the music",
    "negative_prompt": "blurry, unstable motion",
    "image_urls": ["https://example.com/first-frame.png"],
    "audio_urls": ["https://example.com/music.mp3"],
    "sound": true,
    "duration": 10,
    "resolution": "1080p",
    "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.7 Video LoRA 的輸入參數。

**屬性**

**mode** `string` *required*

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

**prompt** `string` *required*

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

**negative\_prompt** `string`

要避免的可選內容描述。空文本將被忽略。

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

恰好一個公共第一影格影像 URL。支援的格式為不透明的 JPEG、JPG、PNG、BMP 和 WEBP。檔案大小不得大於 20 MB，每邊必須為 240-8000 像素，寬度除以高度必須為 0.125-8。

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

最多 1 個公共音訊 URL。提供時，`sound` 必須是 `true` 或省略。

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

輸出是否應包含聲音。 `sound: false` 不能與`audio_urls` 組合。

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

輸出持續時間（以秒為單位）。支援從 `2` 到 `15` 的任何整數。

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

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

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

是否重寫並豐富生成前的提示。

**seed** `integer`

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

## 輪詢結果

```bash theme={null}
curl -X GET "https://api.apixo.ai/api/v1/statusTask/wan-2-7-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)。

計費基於輸出持續時間：`720p` 成本 `$0.143/second`；`1080p` 成本 `$0.22/second`。

## 提示

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

## MCP 整合

[完整模型 Schema](https://apixo.ai/docs/models/schemas/video/wan-2-7-video-lora.json) 中的 `mcp.result` 指定結果的解析方式，`mcp.attachments` 列出可繫結檔案的欄位。這些中繼資料供用戶端整合使用，無須當作生成參數提交。附件欄位為 `image_urls`, `audio_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.