> ## 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 请求：

| 起始素材 | 请求 |
| - | - |
| 仅需描述 | Use [文本转视频](#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/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/api-reference/webhooks.md)。

## 计费

新提交的非 LLM 请求按 **1 积分 = `$0.001`** 计费。先按用量和附加项目计算总额，再应用账号折扣，最后将请求总额向上取整到整数积分。如果约定了固定单价，则按该单价的原始精度计算，不再使用标准价或另行打折；最终积分仍向上取整。详见[积分换算与取整](https://apixo.ai/docs/zh/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/api-reference/system.md)。

## 错误与排查

### HTTP 错误

| 代码 | 含义 | 处理方式 |
| - | - | - |
| `400` | 请求体无效、缺少 `input`、不受支持的 `mode`、空或太长的 `prompt`、无效 `resolution`、无效 `duration`、无效 `style`、无效 `aspect_ratio`、无效 `movement` 或无效 `image_urls` | 在重试前修复请求 |
| `401` | 缺少 API 密钥，或密钥无效 | 检查 `Authorization` 请求头 |
| `402` | 余额或配额不足 | 充值或更换账号或API密钥 |
| `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/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/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)
* [在 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.