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

# Vidu Q3 API：Standard 和 Turbo 影片生成模式

> Vidu 影片生成 API，支援文字轉影片、標準與 Turbo 圖像轉影片，以及首影格與末影格工作流程

## 概覽

根據您已有的資源選擇 Vidu Q3 請求：

| 起始素材 | 請求 |
| - | - |
| 僅提供描述 | 使用[文字轉影片](#text-to-video)並在提示中設定構圖。 |
| 靜止影像 | 使用 [單影像動畫](#single-image-animation)。選擇 `image-to-video`（標準）或 `turbo-image-to-video`（渦輪）。 |
| 開啟和關閉框架 | 在 `image_urls` 中首先放置開啟框架，然後放置關閉框架。 [轉換範例](#first-and-last-frame-transition) 顯示了順序。 |

| 功能 | 值 |
| - | - |
| 模型 ID | `vidu-q3` |
| 模式 | `text-to-video`, `image-to-video`, `turbo-image-to-video` |
| 提示詞長度 | 1 至 5000 個字元 |
| 長度 | 從 `1` 到 `16` 秒的任何整數 |
| 可用解析度 | `540p`, `720p`, `1080p` |
| 文字模式寬高比 | `16:9`, `9:16`, `4:3`, `3:4`, `1:1` |
| 文字模式樣式 | `general`, `anime` |
| 參考圖片 | 1-2 影像模式的 URL |
| 輸出 | MP4 影片 URL 陣列位於 `resultJson.resultUrls` 中 |

## 端點與身分驗證

API 基底網址：

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

| 方法 | 端點 | 用途 |
| - | - | - |
| `POST` | `/generateTask/vidu-q3` | 送出生成任務 |
| `GET` | `/statusTask/vidu-q3?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/vidu-q3" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-video",
      "prompt": "a cinematic flyover of a futuristic city at sunrise",
      "resolution": "720p",
      "duration": 8,
      "style": "general",
      "aspect_ratio": "16:9",
      "sound": true,
      "bgm": 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/vidu-q3?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": 1767965730929,
    "costTime": 120000
  }
}
```

任務失敗時的回應範例：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "PromptInvalid",
    "failMsg": "Prompt is invalid or rejected",
    "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 polished app launch teaser with a glowing phone rotating above a reflective surface",
    "resolution": "720p",
    "duration": 8,
    "style": "general",
    "aspect_ratio": "16:9",
    "movement": "auto",
    "sound": true,
    "bgm": true,
    "seed": 1234
  }
}
```

### 單圖動畫

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-video",
    "prompt": "make this product photo come alive with subtle camera motion",
    "resolution": "1080p",
    "duration": 4,
    "image_urls": [
      "https://example.com/start.jpg"
    ],
    "sound": true,
    "bgm": true
  }
}
```

### 第一影格和最後一影格過渡

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-video",
    "prompt": "transition smoothly from the first frame to the last frame",
    "resolution": "720p",
    "duration": 8,
    "image_urls": [
      "https://example.com/start.jpg",
      "https://example.com/end.jpg"
    ],
    "sound": true,
    "bgm": true
  }
}
```

## 參數

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

指定取得結果的方式。省略此欄位或設為 `async` 時，可透過 `statusTask` 輪詢；設為 `callback` 時，透過 Webhook 接收。

**callback\_url** `string`

當 `request_type` 為 `callback` 時必須提供。必須是可接收最終任務載荷的公開 URL。請參閱 [Webhooks](https://apixo.ai/docs/zh-hant/api-reference/webhooks.md)。

**input** `object` *required*

Vidu Q3 的輸入參數。

**屬性**

**mode** `string` *required*

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

**prompt** `string` *required*

描述所需影片的文字提示。修剪後必須非空，且不得超過 5000 個字元。

**resolution** `string` *required*

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

**duration** `integer` *required*

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

**style** `string`

文字模式樣式預設。支援的值：`general`、`anime`。僅適用於 `text-to-video`。

**aspect\_ratio** `string` (default: 4:3)

文字模式輸出寬高比。支援的值：`16:9`、`9:16`、`4:3`、`3:4`、`1:1`。僅適用於`text-to-video`。

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

標準 (`image-to-video`) 和 Turbo (`turbo-image-to-video`) 中均需要。對於 [單影像動畫](#single-image-animation)，請傳送一個 URL。對於 [從頭到尾的過渡](#first-and-last-frame-transition)，請按播放順序發送兩個 URL：首先打開影格，然後關閉影格。

**movement** `string`

運動幅度。支援的值：`auto`、`small`、`medium`、`large`。

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

是否隨影片產生音效。

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

是否隨影片生成背景音樂。

**seed** `integer`

隨機種子。支援從 `-1` 到 `2147483647` 的整數。

| 模式 | 所需媒體 | 文字控制項 | 計費層級 |
| - | - | - | - |
| `text-to-video` | 無 | `style`, `aspect_ratio` | Standard |
| `image-to-video` | `image_urls` 應包含 1 至 2 張影像 | 未使用 | Standard |
| `turbo-image-to-video` | `image_urls` 應包含 1 至 2 張影像 | 未使用 | Turbo |

> [!TIP]
>
> 對於影像模式，使用可公開存取且可直接存取的影像 URL。如果無法存取或處理影像 URL，則任務將被拒絕。

## 回應格式

### 送出任務時的回應

任務受理後，`POST /generateTask/vidu-q3` 會傳回任務 ID：

**code** `integer`

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

**message** `string`

狀態說明。

**data.taskId** `string`

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

### 狀態回應欄位

**taskId** `string`

任務的唯一識別碼。

**state** `string`

目前的任務狀態，可能的值為 `pending`、`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`

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

## Webhook 回呼模式

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

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/vidu-q3" \
  -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": "turbo-image-to-video",
      "prompt": "animate the reference image with a smooth handheld camera move",
      "resolution": "720p",
      "duration": 4,
      "image_urls": [
        "https://example.com/reference-image.jpg"
      ],
      "sound": true,
      "bgm": true
    }
  }'
```

回呼資料與輪詢回應有相同的頂層欄位：`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)。

Vidu Q3 按秒計費。所選的`mode`決定任務使用Standard或Turbo速率，`resolution`決定每秒的單價。

```text theme={null}
total cost = unit price x duration
```

| 模式群組 | 解析度 | APIXO 價格 |
| - | - | - |
| 標準：`text-to-video`、`image-to-video` | `540p` | `$0.07 / second` |
| 標準：`text-to-video`、`image-to-video` | `720p` | `$0.15 / second` |
| 標準：`text-to-video`、`image-to-video` | `1080p` | `$0.16 / second` |
| 渦輪增壓：`turbo-image-to-video` | `540p` | `$0.04 / second` |
| 渦輪增壓：`turbo-image-to-video` | `720p` | `$0.06 / second` |
| 渦輪增壓：`turbo-image-to-video` | `1080p` | `$0.08 / second` |

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

## 耗時與輪詢

影片生成是長期運行的。典型的 Vidu Q3 處理時間約為 60-120 秒，但實際延遲可能因模式、持續時間、解析度、提示複雜性、參考影像可存取性、路由佇列負載和儲存傳輸時間而異。

| 工作量 | 一般生成時間 | 建議首次查詢時間 | 輪詢間隔 |
| - | - | - | - |
| 簡短的 Turbo 預覽 | 60s-120s | 任務建立 60 秒後 | 5s-10s |
| 標準文本到影片或圖生影片 | 60s-180s | 任務建立 60 至 90 秒後 | 5s-10s |
| 更長或 1080p 工作 | 2-4 分鐘或更長時間 | 任務建立 90 秒後 | 10s |

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

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

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

## 錯誤與排查

### HTTP 錯誤

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

### 驗證說明

| 條件 | 後端行為 |
| - | - |
| 缺少 `input` | 請求會遭拒，系統不會建立任務。 |
| 缺少 `mode` | 請求會遭拒，系統不會建立任務。 |
| 不支援的 `mode` 值 | 請求會遭拒，系統不會建立任務。可用值為 `text-to-video`、`image-to-video`、`turbo-image-to-video`。 |
| 缺失、非字串或空 `prompt` | 請求會遭拒，系統不會建立任務。 |
| `prompt` 超過 5000 個字元 | 請求會遭拒，系統不會建立任務。 |
| 缺失或不受支持 `resolution` | 請求會遭拒，系統不會建立任務。可用值為 `540p`、`720p`、`1080p`。 |
| 缺少 `duration` | 請求會遭拒，系統不會建立任務。 |
| `duration` 在 `1` 到 `16` 之外 | 請求會遭拒，系統不會建立任務。 |
| 文字模式下不支援 `style` | 請求會遭拒，系統不會建立任務。可用值為 `general`、`anime`。 |
| 文字模式下不支援 `aspect_ratio` | 請求會遭拒，系統不會建立任務。可用值為 `16:9`、`9:16`、`4:3`、`3:4`、`1:1`。 |
| 不支援的 `movement` 值 | 請求會遭拒，系統不會建立任務。可用值為 `auto`、`small`、`medium`、`large`。 |
| 無`image_urls`的影像模式 | 請求會遭拒，系統不會建立任務。 |
| 圖片模式下未提供圖片，或提供了超過 2 張圖片 | 請求會遭拒，系統不會建立任務。 |
| `image_urls` 包含非字串項 | 請求會遭拒，系統不會建立任務。 |
| `seed` 在 `-1` 到 `2147483647` 之外 | 請求會遭拒，系統不會建立任務。 |

### 任務失敗代碼

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

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

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

## MCP 整合

[完整模型 Schema](https://apixo.ai/docs/models/schemas/video/vidu-q3.json) 中的 `mcp.result` 指定結果的解析方式，`mcp.attachments` 列出可繫結檔案的欄位。這些中繼資料供用戶端整合使用，無須當作生成參數提交。附件欄位為 `image_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)
* [在 APIXO Playground 嘗試 Vidu Q3](https://apixo.ai/models/vidu-q3)
* [API定價](https://apixo.ai/pricing/api)


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