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

# Runway Gen4 Video Turbo API：圖片生成影片

> Runway Gen4 影像轉影片 API，具備提示指導、一張來源影像和按秒計費

## 概覽

Runway Gen4 Video Turbo 會使用文字提示將來源影像動畫化為短影片。當您已有影像且需要控制運動、相機方向或氛圍時，請使用此功能。

| 功能 | 值 |
| - | - |
| 模型 ID | `runway-gen4-video-turbo` |
| 模式 | `image-to-video` |
| 提示詞 | 必填，且必須是非空字串 |
| 來源圖片 | 正是1公共影像URL |
| 長度 | 從 `5` 到 `10` 秒的整數或整數字串 |
| 縱橫比 | `16:9`, `4:3`, `1:1`, `3:4`, `9:16` |
| 計費 | 每秒 |

## 端點與身分驗證

API 基底網址：

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

| 方法 | 端點 | 用途 |
| - | - | - |
| `POST` | `/generateTask/runway-gen4-video-turbo` | 提交影片生成任務 |
| `GET` | `/statusTask/runway-gen4-video-turbo?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/runway-gen4-video-turbo" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "prompt": "The subject walks forward through soft morning fog, cinematic camera movement",
      "image_urls": [
        "https://example.com/source-image.png"
      ],
      "duration": 5,
      "aspect_ratio": "16:9"
    }
  }'
```

成功回應：

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

## 輪詢結果

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

成功回應：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/runway-gen4-video-turbo.mp4\"]}",
    "createTime": 1782980000000,
    "completeTime": 1782980060000,
    "costTime": 60000
  }
}
```

## 請求體

### 圖生影片

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-video",
    "prompt": "He lifts the noodles with chopsticks as steam curls around his face",
    "image_urls": [
      "https://example.com/source-image.png"
    ],
    "duration": "10",
    "aspect_ratio": "4:3"
  }
}
```

`mode` 欄位在此端點上是選填的。如果省略，APIXO 使用 `image-to-video`。

## 參數

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

Runway Gen4 Video Turbo 的輸入參數。

**屬性**

**mode** `string` (default: image-to-video)

選用的生成模式。此端點僅支援 `image-to-video`。

**prompt** `string` *required*

描述所需運動、攝影機移動和場景變化的文字提示。提示詞必須是修剪空格後的非空字串。

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

來源影像 URL。準確提供 1 公開的、可直接存取的影像 URL。

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

輸出持續時間（以秒為單位）。接受 JSON 整數或從 `5` 到 `10` 的整數字串。小數值無效。

**aspect\_ratio** `string`

選填的輸出縱橫比。支援的值：`16:9`、`4:3`、`1:1`、`3:4`、`9:16`。

## 回應格式

### 送出任務時的回應

任務受理後，`POST /generateTask/runway-gen4-video-turbo` 會傳回任務 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/runway-gen4-video-turbo" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/webhooks/apixo",
    "input": {
      "prompt": "Slow dolly-in, soft cinematic motion, rain on the window",
      "image_urls": [
        "https://example.com/source-image.png"
      ],
      "duration": 5,
      "aspect_ratio": "16:9"
    }
  }'
```

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)。

Runway Gen4 Video Turbo 按輸出秒數計費。

| 單位 | APIXO 價格 |
| - | - |
| 每秒 | `$0.112 / second` |

公式：

```text theme={null}
total cost = duration * 0.01
```

## 耗時與輪詢

實際延遲可能因持續時間、提示複雜性、來源影像可存取性和當前佇列負載而異。

| 長度 | 一般生成時間 | 建議首次查詢時間 | 輪詢間隔 |
| - | - | - | - |
| `5s` | 45s-75s | 任務建立 45 秒後 | 5s |
| `10s` | 75s-120s | 任務建立 60 秒後 | 5s |

> [!TIP]
>
> 對於生產影片工作負載，請使用回呼模式以避免在生成仍在運行時頻繁輪詢。

## 驗證說明

| 參數 | 後端行為 |
| - | - |
| `input.mode` | 選填。如果提供，則必須是 `image-to-video`。如果省略，APIXO 會使用 `image-to-video`。 |
| `input.prompt` | 必需的字串。修剪空白後不能為空。 |
| `input.image_urls` | 必需的。必須是恰好包含 1 個非空字串 URL 的陣列。 |
| `input.duration` | 選填。預設為 `5`。接受 JSON 整數或從 `5` 到 `10` 的整數字串；小數將被拒絕。 |
| `input.aspect_ratio` | 選填。如果提供，則必須是 `16:9`、`4:3`、`1:1`、`3:4` 或 `9:16` 之一。 |

## 錯誤與排查

| 代碼 | 含義 | 處理方式 |
| - | - | - |
| `400` | 請求主體無效、來源影像缺失、持續時間無效、寬高比無效或影像無法存取 URL。 | 修正請求後再試 |
| `401` | 缺少 API 金鑰，或金鑰無效 | 檢查 `Authorization` 請求標頭 |
| `402` | 餘額或配額不足 | 充值或更換帳號或金鑰 |
| `403` | 金鑰或路由無權訪問該模型 | 檢查權限和路由策略 |
| `429` | 已達到速率或並行限制 | 以指數退避方式重試 |
| `500` | 伺服器錯誤或未知生成失敗 | 逐步拉長間隔後重試 |
| `502` | 產生服務或網路錯誤 | 逐步拉長間隔後重試 |
| `504` | 生成超時 | 重新嘗試；耗時較長的任務可改用回呼模式 |

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

## MCP 整合

[完整模型 Schema](https://apixo.ai/docs/models/schemas/video/runway-gen4-video-turbo.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)
* [API定價](https://apixo.ai/pricing/api)


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