> ## 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/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/api-reference/webhooks.md)。

## 计费

新提交的非 LLM 请求按 **1 积分 = `$0.001`** 计费。先按用量和附加项目计算总额，再应用账号折扣，最后将请求总额向上取整到整数积分。如果约定了固定单价，则按该单价的原始精度计算，不再使用标准价或另行打折；最终积分仍向上取整。详见[积分换算与取整](https://apixo.ai/docs/zh/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` | 余额或配额不足 | 充值或更换账号或API密钥 |
| `403` | 密钥或路由无权访问该模型 | 检查权限和路由策略 |
| `429` | 已达到速率或并发限制 | 按指数退避策略重试 |
| `500` | 服务器错误或未知生成失败 | 逐步延长间隔后重试 |
| `502` | 生成服务或网络错误 | 逐步延长间隔后重试 |
| `504` | 生成超时 | 重试；耗时较长的任务可改用回调模式 |

完整列表见[错误码](https://apixo.ai/docs/zh/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/models.md)
* [视频模型](https://apixo.ai/docs/zh/models/video)
* [提交生成任务](https://apixo.ai/docs/zh/api-reference/generate-task.md)
* [查询任务状态](https://apixo.ai/docs/zh/api-reference/status-task.md)
* [Webhook](https://apixo.ai/docs/zh/api-reference/webhooks.md)
* [错误码](https://apixo.ai/docs/zh/api-reference/errors.md)
* [参数规范](https://apixo.ai/docs/zh/api-reference/parameters.md)
* [路由策略](https://apixo.ai/docs/zh/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.