> ## 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 Mini API：轻量级视频生成

> 字节跳动轻量级多模态视频生成 API，支持文生视频、首帧和末帧以及全参考工作流

## 概览

Seedance 2.0 Mini 生成 480p 或 720p 剪辑，时长为 4 至 15 秒。要控制镜头的起止位置，请使用 [第一帧和最后一帧](#first-and-last-frames)；要通过视频或音频引导镜头，请使用 [全方位参考](#omni-reference)，并至少配对一个图像或视频作为音频参考。

[Seedance 2.0 Fast](https://apixo.ai/docs/zh/models/video/seedance-2-0-fast.md) 也支持这些模式和分辨率。请使用您计划提交的变体的确切模型 ID，并在轮询时与任务 ID 一同提供。

| 功能 | 值 |
| - | - |
| 模型 ID | `seedance-2-0-mini` |
| 模式 | `text-to-video`, `first_and_last_frames`, `omni_reference` |
| 提示词 | 必填，且必须为非空字符串 |
| 可选分辨率 | `480p`, `720p` |
| 持续时间 | 从 `4` 到 `15` 秒的任何整数 |
| 纵横比 | `auto`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16`, `21:9` |
| 参考图片 | 每个 `first_and_last_frames` 提供 1-2 个 URL；每个 `omni_reference` 提供 1-9 个 URL。 |
| 参考视频或音频。 | 每个 `omni_reference` 提供 1-3 个 URL；每个文件时长为 2-15 秒，每种媒体类型总时长不超过 15 秒。 |
| 输出 | MP4 视频 URL 数组位于 `resultJson.resultUrls` 字段中 |

## 接口与身份验证

API 基础地址：

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

| 方法 | 端点 | 用途 |
| - | - | - |
| `POST` | `/generateTask/seedance-2-0-mini` | 提交生成任务 |
| `GET` | `/statusTask/seedance-2-0-mini?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-mini" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-video",
      "prompt": "a cinematic drone shot above a rainy city at night",
      "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-mini?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": 1767965890929,
    "costTime": 280000
  }
}
```

任务失败时的响应示例：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "UPSTREAM_ERROR",
    "failMsg": "The service could not complete the task",
    "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 slow tracking shot through a foggy pine forest at dawn",
    "resolution": "720p",
    "duration": 10,
    "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` (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 Mini 的输入参数。

**属性**

**mode** `string` *required*

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

**prompt** `string` *required*

用于描述所需视频的文本提示。后端将自动修剪空白字符，并拒绝空提示。最大长度为 10000 个字符。

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

输出分辨率。支持的值为 `480p` 和 `720p`，值将被修剪并转换为小写。

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

Output持续时间（以秒为单位）。支持从 `4` 到 `15` 的整数，包括数字字符串，例如 `"10"`。

**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` 场景下最多可提供 9 张图像（可选）。后端还支持提供非空对象项且包含 `url` 字段，并将其标准化为 URL 字符串。

**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` | 验证默认为无，除非提供了 `audio_urls`。 | `image_urls`, `video_urls`, `audio_urls` | 提供 `video_urls` 时，使用视频参考计费。 |

> [!TIP]
>
> 在 `omni_reference` 中，仅音频请求会被拒绝。如果提供了 `audio_urls`，必须同时提供至少一张图像或视频参考。

> [!TIP]
>
> 所有参考媒体均需使用公共、可直接访问的 URL。在任务提交前将检查视频和音频的持续时间。

## 响应格式

### 提交任务时的响应

任务受理后，`POST /generateTask/seedance-2-0-mini` 会返回任务 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`

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

**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-mini" \
  -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
    }
  }'
```

回调有效负载采用与状态轮询相同的顶级结构，包含 `code`、`message` 和 `data` 字段。成功回调将包含最终的 `state` 和 `resultJson`；新任务的终端成功回调还将包含 `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 Mini 按秒计费。所选的 `resolution` 以及 `omni_reference` 是否包含 `video_urls` 将决定每秒的单价。

| 配置 | APIXO 价格 |
| - | - |
| `480p`，无视频参考 | `$0.018 / second` |
| `480p`，有视频参考 | `$0.011 / second` |
| `720p`，无视频参考 | `$0.040 / second` |
| `720p`，有视频参考 | `$0.024 / second` |

无视频参考的公式：

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

含视频参考的公式：

```text theme={null}
billable seconds = output seconds + max(actual total reference video seconds, ceil(output seconds * 2 / 3))
total cost = billable seconds * unit price
```

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

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

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

成功的终态和新任务的回调响应包括`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)。

## 延迟与轮询

视频生成需要长时间运行，通常需要几分钟的时间。实际延迟可能因提示复杂性、持续时间、参考媒体可访问性、路由队列负载和存储传输时间而异。

| 工作量 | 通常生成耗时 | 建议首次查询时间 | 轮询间隔 |
| - | - | - | - |
| 文生视频或第一帧和最后一帧 | 通常需要几分钟 | 任务创建 180 至 240 秒后 | 10s-20s |
| 具有图像/视频/音频输入的全方位参考 | 通常需要几分钟或更长时间 | 任务创建 200 至 300 秒后 | 10s-20s |

> [!TIP]
>
> 生产环境建议使用回调，避免在视频生成期间频繁轮询。

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

结果链接有时效。任务完成后，请尽快下载并保存重要文件。

请求频率和并发上限因账号、API 密钥和路由而异。收到 `429` 时，请降低请求频率，逐步延长重试间隔。账号级限制见[系统 API](https://apixo.ai/docs/zh/api-reference/system.md)。

## 错误与排查

### HTTP 错误

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

### 验证说明

| 条件 | 后端行为 |
| - | - |
| 缺少 `input` | 请求会被拒绝，系统不会创建任务。 |
| 缺失、非字符串或空 `prompt` | 请求会被拒绝，系统不会创建任务。 |
| 缺少 `mode` | 请求会被拒绝，系统不会创建任务。 |
| 不支持的 `mode` 值 | 请求会被拒绝，任务不会创建。可选值为 `text-to-video`、`first_and_last_frames`、`omni_reference`。 |
| 缺少 `resolution` | 默认值为 `720p`。 |
| 不支持的 `resolution` 值 | 请求会被拒绝，任务不会创建。可选值为 `480p`、`720p`。 |
| 缺少 `duration` | 默认值为 `5`。 |
| `duration` 超出 `4` 到 `15` 的范围 | 请求会被拒绝，系统不会创建任务。 |
| 缺少 `aspect_ratio` | 默认值为 `auto`。 |
| 不支持的 `aspect_ratio` 值 | 请求会被拒绝，系统不会创建任务。 |
| `sound` 或 `web_search` 不是布尔值 | 请求会被拒绝，系统不会创建任务。 |
| `first_and_last_frames` 缺少 `image_urls` | 请求会被拒绝，系统不会创建任务。 |
| `first_and_last_frames` 模式的图片超过 2 张 | 请求会被拒绝，系统不会创建任务。 |
| `omni_reference` 模式下，图片超过 9 张、视频超过 3 个或音频文件超过 3 个 | 请求会被拒绝，系统不会创建任务。 |
| `omni_reference` 模式下仅提供了 `audio_urls` | 请求会被拒绝，系统不会创建任务。 |
| 参考视频或音频的时长不足 2 秒或超过 15 秒 | 请求会被拒绝，系统不会创建任务。 |
| 总参考视频时长或总参考音频时长超过 15 秒 | 请求会被拒绝，系统不会创建任务。 |

### 任务失败错误码

`failCode` 表示任务失败的原因，常见值如下。

| 错误码 | 含义 | 处理方式 |
| - | - | - |
| `SensitiveContent` | 提示或输入/输出内容被安全检查拒绝 | 更改提示或参考媒体 |
| `PromptInvalid` | 提示词无效或被拒绝 | 修改提示词后重试 |
| `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/seedance-2-0-mini.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 Mini](https://apixo.ai/models/seedance-2-0-mini)
* [API定价](https://apixo.ai/pricing/api)


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