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

# Seedance 2.0 Fast API：快速生成多模态视频

> 字节跳动通过文生视频、首帧和末帧以及全参考模式生成多模态视频

## 概览

Seedance 2.0 Fast 是字节跳动的视频生成模型，支持快速文生视频、首尾帧动画和多模态参考生成。在 APIXO Playground 试用后，可以按本页示例调用 API。

| 功能 | 值 |
| - | - |
| 模型 ID | `seedance-2-0-fast` |
| 模式 | `text-to-video`, `first_and_last_frames`, `omni_reference` |
| 提示词 | 必填，文本不能为空 |
| 分辨率 | `480p`, `720p` |
| 时长 | 4-15秒，预设值为 `5` |
| 纵横比 | `auto`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16`, `21:9` |
| 参考图片 | `first_and_last_frames`：1-2张图像；`omni_reference`：1-9张图像 |
| 参考视频 | 仅 `omni_reference`，支持 1-3 个视频，每个 2-15 秒，总长度不超过 15 秒 |
| 参考音频 | 仅 `omni_reference`，支持 1-3 个音频文件，每个 2-15 秒，总长度不超过 15 秒 |
| 音频和搜索 | 可选的生成音频和网络搜索控件 |

## 接口与身份验证

API 基础地址：

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

| 方法 | 端点 | 用途 |
| - | - | - |
| `POST` | `/generateTask/seedance-2-0-fast` | 提交生成任务 |
| `GET` | `/statusTask/seedance-2-0-fast?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/seedance-2-0-fast" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-video",
      "prompt": "a cinematic tracking shot through a rainy neon street",
      "resolution": "720p",
      "duration": 5,
      "aspect_ratio": "16:9",
      "sound": true,
      "web_search": false
    }
  }'
```

成功响应：

```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/seedance-2-0-fast?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": 1767965910929,
    "costTime": 300000
  }
}
```

任务失败时的响应示例：

```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 cinematic tracking shot through a rainy neon street",
    "resolution": "720p",
    "duration": 5,
    "aspect_ratio": "16:9",
    "sound": true,
    "web_search": false
  }
}
```

### 第一帧和最后一帧

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "first_and_last_frames",
    "prompt": "turn the still frames into a smooth cinematic camera move",
    "image_urls": [
      "https://example.com/frame-start.png",
      "https://example.com/frame-end.png"
    ],
    "resolution": "720p",
    "duration": 5,
    "aspect_ratio": "9:16",
    "sound": true,
    "web_search": false
  }
}
```

### 全参考

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "omni_reference",
    "prompt": "create a stylish product ad using the visual references and voice rhythm",
    "image_urls": [
      "https://example.com/product-shot.png"
    ],
    "video_urls": [
      "https://example.com/ref-motion.mp4"
    ],
    "audio_urls": [
      "https://example.com/ref-audio.mp3"
    ],
    "resolution": "480p",
    "duration": 6,
    "aspect_ratio": "auto",
    "sound": true,
    "web_search": false
  }
}
```

## 参数

**request\_type** `string` *required* (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*

Seedance 2.0 Fast 的输入参数。

**属性**

**mode** `string` *required*

生成模式。可选值为 `text-to-video`、`first_and_last_frames`、`omni_reference`。

**prompt** `string` *required*

描述所需视频的文本提示。该值已被修剪并且不能为空。最大长度：10000 个字符

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

输出分辨率。可选值为 `480p`、`720p`。

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

输出持续时间（以秒为单位）。支持从 `4` 到 `15` 的整数。接受并规范化数字字符串，但建议使用整数

**aspect\_ratio** `string` (default: auto)

输出画面的宽高比。可选值为 `auto`、`16:9`、`4:3`、`1:1`、`3:4`、`9:16`、`21:9`。

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

是否随输出视频生成音频

**web\_search** `boolean` (default: false)

启用网络搜索在生成过程中引用当前信息。

**nsfw\_checker** `boolean` (default: false)

启用此请求的内容安全过滤。默认值为 `false`，若提供该参数，必须为布尔值。

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

参考图像 URL。用于 `first_and_last_frames` 时需提供 1-2 张图像；用于 `omni_reference` 时可提供 1-9 张图像。

**video\_urls** `string[]`

仅适用于 `omni_reference` 模式的参考视频 URL。提供时支持 1-3 个 URL，每个视频时长为 2-15 秒，所有参考视频总时长不得超过 15 秒。

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

仅适用于 `omni_reference` 模式的参考音频 URL。提供时支持 1-3 个 URL，每个音频文件时长为 2-15 秒，所有参考音频总时长不得超过 15 秒。

### 各模式的限制

* `text-to-video` 仅使用提示和生成设置。
* `first_and_last_frames` 需要 `image_urls`，提供 1-2 张图像。第一张图像为起始帧；若存在第二张图像，则为结束帧。
* `omni_reference` 可同时使用 `image_urls`、`video_urls` 和 `audio_urls`。
* `omni_reference` 请求仅包含 `audio_urls` 且无图像或视频时将被拒绝。
* 参考媒体必须是可公开访问的 URL，以便 API 可以获取或探测它们。

## 响应格式

### 提交任务时的响应

任务受理后，`POST /generateTask/seedance-2-0-fast` 会返回任务 ID：

**code** `integer`

API 状态码。`200` 表示任务已受理。

**message** `string`

状态说明。

**data.taskId** `string`

任务的唯一 ID，用于查询任务状态。

### 状态响应字段

**taskId** `string`

任务的唯一标识符。

**state** `string`

当前任务状态，可能的值为 `pending`、`processing`、`success`、`failed`。

**resultJson** `string`

JSON 字符串，包含 `resultUrls` 中生成的视频 URL。当 `state` 为 `success` 时存在。

**failCode** `string`

供程序处理的错误码，仅在 `state` 为 `failed` 时返回。

**failMsg** `string`

失败原因说明，仅在 `state` 为 `failed` 时返回。

**createTime** `integer`

任务创建时的 Unix 时间戳，单位为毫秒。

**completeTime** `integer`

任务完成时的 Unix 时间戳，单位为毫秒。任务完成后返回。

**costTime** `integer`

处理耗时，以毫秒为单位。任务完成且有计时数据时返回。

**billing** `object`

新任务成功结束后，查询状态的响应和回调通知都会在 `data.billing` 中返回最终计费明细。旧任务可能没有此对象，兼容规则见本页计费说明。

**billing.settlementState** `string`

结算状态。最终快照使用 `final`。

**billing.billingRuleVersion** `string`

创建此任务时捕获的计费规则的不透明标识符。不要从轮询时间推断规则。

**billing.inputVideoSeconds** `number`

所有参考视频的实际总时长，单位为秒。未提供参考视频时为零。此处记录实际值，不会调高到最低计费时长。

**billing.minimumInputVideoSeconds** `number`

新任务如有参考视频，按 `ceil(outputVideoSeconds * 2 / 3)` 计算，向上取整至整秒。没有参考视频或沿用旧规则时，此值为零。

**billing.billableInputVideoSeconds** `number`

取 `inputVideoSeconds` 和 `minimumInputVideoSeconds` 中较大的值。没有参考视频时为零。

**billing.outputVideoSeconds** `number`

用于计费的输出持续时间，单位为秒。

**billing.totalBillableSeconds** `number`

计费总秒数为 `outputVideoSeconds + billableInputVideoSeconds`。

**billing.unit** `string`

时长单位，值为 `second`。

## Webhook 回调模式

如果希望服务端自动收到最终结果，可以使用回调模式，无需轮询。

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/seedance-2-0-fast" \
  -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": "first_and_last_frames",
      "prompt": "turn the still frames into a smooth cinematic camera move",
      "image_urls": [
        "https://example.com/frame-start.png",
        "https://example.com/frame-end.png"
      ],
      "resolution": "720p",
      "duration": 5,
      "aspect_ratio": "9:16",
      "sound": true,
      "web_search": false
    }
  }'
```

新任务的成功终端回调包括与状态轮询相同的 `data.billing` 快照。请参阅 [Webhooks](https://apixo.ai/docs/zh/api-reference/webhooks.md) 了解传送要求和重试行为。

## 计费

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

Seedance 2.0 Fast 按秒计费。所选的 `resolution` 和 `omni_reference` 是否包含 `video_urls` 决定单价。

| 配置 | APIXO 价格 |
| - | - |
| `480p`，无视频参考 | `$0.058 / second` |
| `480p`，有视频参考 | `$0.033 / second` |
| `720p`，无视频参考 | `$0.123 / second` |
| `720p`，有视频参考 | `$0.074 / second` |

计费公式：

* 没有视频参考：`output duration seconds x per-second rate`
* 有视频参考：`(output duration seconds + max(actual total reference video seconds, ceil(output duration seconds * 2 / 3))) x per-second rate`

`ceil` 将秒数向上取整。先合计所有参考视频的时长，再应用一次最低计费时长。例如，输出 5 秒、参考视频合计 3 秒，计费时长为 `5 + max(3, 4) = 9` 秒。输出 6 秒、参考视频合计 2 秒，则按 10 秒计费。

新规则适用于计费更新后创建的任务。已有任务沿用创建时记录的规则：有参考视频时按 `(output duration + actual total reference video duration) * unit price` 计算，没有参考视频时只计输出时长。单价、折扣和结算方式也沿用原记录。即使在更新后查询状态或收到回调，已有任务的规则也不会改变。

`text-to-video`和`first_and_last_frames`始终使用“无视频参考”速率。在 `omni_reference` 模式下，仅当提供 `video_urls` 时才适用“带视频参考”。图像和音频参考不会增加额外的计费秒数。

成功的终态和新任务的回调响应包括`data.billing`。持续时间值使用具有三位小数的秒；`minimumInputVideoSeconds` 是向上取整后的最低计费输入秒数。`inputVideoSeconds`仍然是实际输入持续时间，而`billableInputVideoSeconds`是计费输入时长。快照在重复轮询中保持稳定。较旧的任务可能会省略 `billing` 或新字段；客户端不得要求历史任务一定返回这些字段。

例如，5输出秒和3参考视频秒的计费明细包括：

```json theme={null}
{
  "billing": {
    "settlementState": "final",
    "inputVideoSeconds": 3.000,
    "minimumInputVideoSeconds": 4.000,
    "billableInputVideoSeconds": 4.000,
    "outputVideoSeconds": 5.000,
    "totalBillableSeconds": 9.000,
    "unit": "second"
  }
}
```

最新的美元费率见 [API 价目表](https://apixo.ai/pricing/api)。

## 延迟与轮询

实际延迟可能因提示复杂性、参考媒体、提供商路由和当前队列负载而异。

| 工作流程 | 通常生成耗时 | 建议首次查询时间 | 轮询间隔 |
| - | - | - | - |
| 文生视频 | 3-6 分钟 | 任务创建 200 至 300 秒后 | 10-20s |
| 第一帧和最后一帧 | 3-6 分钟 | 任务创建 200 至 300 秒后 | 10-20s |
| 全参考 | 3-6 分钟 | 任务创建 200 至 300 秒后 | 10-20s |

> [!TIP]
>
> 对于生产工作负载，请使用回调模式来减少较长视频任务期间的轮询开销。

> [!TIP]
>
> 对于该模型来说，最初几分钟内没有明显的状态变化是正常的。建议采用退避策略持续轮询，而非立即重试相同任务。

结果 URL 可能是临时的。建议在任务完成后尽快下载生成的视频。

## 错误与排查

### HTTP 错误

| 代码 | 含义 | 处理方式 |
| - | - | - |
| `400` | 请求体无效、参数缺失、值不被支持或参考媒体无效 | 在重试前修复请求 |
| `401` | 缺少 API 密钥，或密钥无效 | 检查 `Authorization` 请求头 |
| `402` | 余额或配额不足 | 充值或更换账号或API密钥 |
| `403` | 密钥或路由无权访问该模型 | 检查权限和路由策略 |
| `404` | 未找到任务 | 检查 `taskId` 和模型端点 |
| `429` | 已达到速率或并发限制 | 按指数退避策略重试 |
| `500` | 服务器错误或未知任务失败 | 逐步延长间隔后重试 |
| `502` | 服务错误 | 逐步延长间隔后重试 |
| `504` | 服务超时 | 重试；耗时较长的任务可改用回调模式 |

### 常见请求验证错误

| 错误 | 含义 | 处理方式 |
| - | - | - |
| `Missing required parameter` | 缺少 `input`、`mode`、`prompt` 或特定模式所需的必填字段 | 添加缺失的必填字段 |
| `Invalid parameter type` | 字段的 JSON 类型错误 | 文本字段和 URL 使用字符串类型，`sound` 和 `web_search` 使用布尔值，`duration` 使用整数 |
| `Invalid parameter value` | 值超出支持的取值范围或有效区间 | 检查 `mode`、`resolution`、`duration`、`aspect_ratio` 以及参考媒体的持续时间 |
| `Param length exceeded` | 提供了太多参考 URL | 将 `image_urls`、`video_urls` 和 `audio_urls` 保持在文档规定的限制范围内 |
| `ImageNotAccess` | 无法访问引用的 URL | 使用公共的直接媒体 URL |

### 任务失败错误码

| 错误码 | 含义 | 处理方式 |
| - | - | - |
| `PromptInvalid` | 提示或输入无效或被拒绝 | 调整提示或参考 |
| `SensitiveContent` | 输入或输出被安全检查标记 | 修改提示或输入媒体 |
| `RateLimited` | 请求频率达到上限 | 按指数退避策略重试 |
| `Timeout` | 任务超时 | 稍后重试或使用回调模式 |
| `Unknown error` | 任务因未知原因失败 | 逐步延长间隔后重试，或联系支持团队并提供 `taskId` |

完整列表见[错误码](https://apixo.ai/docs/zh/api-reference/errors.md)。

## MCP 集成

[完整模型 Schema](https://apixo.ai/docs/models/schemas/video/seedance-2-0-fast.json) 中的 `mcp.result` 指定了结果的解析方式，`mcp.attachments` 列出支持绑定文件的字段。这些元数据供客户端集成使用，无需作为生成参数提交。附件字段为 `image_urls`, `video_urls`, `audio_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 尝试 Seedance 2.0 Fast](https://apixo.ai/models/seedance-2-0-fast)
* [API定价](https://apixo.ai/pricing/api)


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