> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mixroute.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Seedance

> Seedance 视频生成参数、支持取值、输入限制与请求示例。

Seedance 根据文本和受支持的媒体输入生成视频。Doubao 与 Dreamina 路由使用相同的参数命名，具体能力和限制取决于所选模型版本。

`POST https://api.mixroute.ai/v1/video/generations`

<Info>
  请求顶层保留 `model`、`prompt`、`asset`。所有厂商字段统一放入 `metadata`，包括 `content`、`duration`、`ratio`、`resolution` 和 `generate_audio`。
</Info>

路由分类文档：[Doubao](/cn/api-reference/endpoint/doubao) | [Dreamina](/cn/api-reference/endpoint/dreamina)

## 模型 ID

| 系列                | MixRoute 模型 ID                                                          |
| ----------------- | ----------------------------------------------------------------------- |
| Seedance 2.5      | `doubao-seedance-2-5-260628`                                            |
| Seedance 2.0      | `dreamina-seedance-2-0-260128` / `doubao-seedance-2-0-260128`           |
| Seedance 2.0 Fast | `dreamina-seedance-2-0-fast-260128` / `doubao-seedance-2-0-fast-260128` |
| Seedance 2.0 Mini | `dreamina-seedance-2-0-mini-260615` / `doubao-seedance-2-0-mini-260615` |

模型可用性与账户有关，请使用 [模型广场](https://console.mixroute.ai/models) 中显示的完整 ID。

## 顶层字段

| 字段         | 类型      | 必填  | 说明                                                   |
| ---------- | ------- | --- | ---------------------------------------------------- |
| `model`    | string  | 是   | 模型表中的完整 MixRoute 模型 ID。                              |
| `prompt`   | string  | 是   | MixRoute 视频提示词。`metadata.content` 中存在文本项时，两处文本须保持一致。 |
| `asset`    | boolean | 按场景 | MixRoute 素材处理开关，不是厂商字段，放在请求顶层；纯文本示例使用 `false`。       |
| `metadata` | object  | 是   | 下列厂商字段的容器。                                           |

## 生成参数

| 字段                                  | 类型        | 必填 | 说明                                                                                                                         |
| ----------------------------------- | --------- | -- | -------------------------------------------------------------------------------------------------------------------------- |
| `metadata.content`                  | object\[] | 是  | 视频输入内容，可包含文本、图像、视频、音频或受支持的样片任务。纯文本生成须有文本项；媒体输入组合中的文本项在模型接口中为可选。                                                            |
| `metadata.omni_reference_task_type` | string    | 否  | 仅 Seedance 2.5。默认 `auto`；取值为 `auto`、`reference`、`edit`、`extend`。指定模式可提前检查场景约束；声明类型与模型识别的意图不一致时仍可能异步失败。                     |
| `metadata.resolution`               | string    | 否  | 输出分辨率档位，支持的取值和默认值见版本表；取值区分大小写。                                                                                             |
| `metadata.ratio`                    | string    | 否  | 取值为 `16:9`、`4:3`、`1:1`、`3:4`、`9:16`、`21:9`、`adaptive`。2.5、2.0 和 1.5 Pro 默认 `adaptive`；1.0 文生视频默认 `16:9`，图生视频默认 `adaptive`。 |
| `metadata.duration`                 | integer   | 否  | 请求的视频时长，单位为秒，范围见版本表。受支持版本可用 `-1` 自动选择时长；Seedance 2.5 默认 `-1`，视频编辑必须为 `-1`。                                                 |
| `metadata.frames`                   | integer   | 否  | 仅 Seedance 1.0 Pro/Pro Fast。范围为 29-289，须满足 `25 + 4n`，n 为正整数；与 `duration` 同时提供时优先。输出帧率为 24 fps。                             |
| `metadata.generate_audio`           | boolean   | 否  | 2.5、2.0 和 1.5 Pro 支持。默认 `true`，生成与画面同步的单声道语音、音效或音乐；`false` 生成无声视频。                                                         |
| `metadata.watermark`                | boolean   | 否  | 默认 `false`。`true` 在右下角添加 AI 生成水印，`false` 不添加。                                                                              |
| `metadata.output_format`            | string    | 否  | 仅 Seedance 2.5。默认 `mp4`；取值为 `mp4`、`mov`。MP4 适合通用播放，MOV 面向高色彩精度的后期处理，播放端须兼容相应编码。                                            |
| `metadata.seed`                     | integer   | 否  | 仅 1.5 Pro 和 1.0。范围为 -1 至 2147483647，默认 -1 表示随机种子；相同种子可产生相似结果，但不保证完全一致。                                                     |
| `metadata.camera_fixed`             | boolean   | 否  | 仅 1.5 Pro 和 1.0，参考图模式不支持。默认 `false`；`true` 增加固定镜头指令，但不保证镜头完全静止。                                                            |
| `metadata.return_last_frame`        | boolean   | 否  | 默认 `false`。`true` 在任务结果中返回无水印 PNG 尾帧，像素尺寸与生成视频一致。                                                                          |
| `metadata.draft`                    | boolean   | 否  | 仅 1.5 Pro，默认 `false`。样片模式须为 480p，不能同时设置 `return_last_frame=true` 或使用离线推理。                                                  |
| `metadata.service_tier`             | string    | 否  | 仅 1.5 Pro 和 1.0。默认 `default` 为在线推理，`flex` 为离线推理；提交后不能修改服务等级。2.5 和 2.0 系列不支持 `flex`。                                        |
| `metadata.callback_url`             | string    | 否  | 任务状态回调 URL。厂商通过 POST 发送其任务查询响应结构，状态包括 `queued`、`running`、`succeeded`、`failed`、`expired`。                                   |
| `metadata.execution_expires_after`  | integer   | 否  | 范围为 3600-259200 秒，默认 172800 秒（48 小时），从任务创建时计算；超时后任务终止并标记为 `expired`。                                                       |
| `metadata.priority`                 | integer   | 否  | 仅 2.5 和 2.0。范围为 0-9，默认 0。数值越大，在同一推理接入点的队列中越优先；同优先级仍按先入先出，不中断运行中的任务，不能用于 `flex`。                                            |
| `metadata.safety_identifier`        | string    | 否  | 稳定且唯一的终端用户标识，不超过 64 个英文字符；建议使用哈希标识，避免直接提供个人信息。                                                                             |
| `metadata.tools`                    | object\[] | 否  | 仅 2.5 和 2.0。每个工具须提供 `type`，支持的取值为 `web_search`。模型自行决定是否搜索；查询结果中的 `usage.tool_usage.web_search` 返回搜索次数。                     |

## 版本限制

| 版本                          | 分辨率                              | 默认分辨率   | 时长          | 参考数量上限（图像 / 视频 / 音频） |
| --------------------------- | -------------------------------- | ------- | ----------- | -------------------- |
| Seedance 2.5                | `480p` / `720p` / `1080p`        | `720p`  | 4-30 s / -1 | 30 / 10 / 10         |
| Seedance 2.0                | `480p` / `720p` / `1080p` / `4k` | `720p`  | 4-15 s / -1 | 9 / 3 / 3            |
| Seedance 2.0 Fast / Mini    | `480p` / `720p`                  | `720p`  | 4-15 s / -1 | 9 / 3 / 3            |
| Seedance 1.5 Pro            | `480p` / `720p` / `1080p`        | `720p`  | 4-12 s / -1 | -                    |
| Seedance 1.0 Pro / Pro Fast | `480p` / `720p` / `1080p`        | `1080p` | 2-12 s      | -                    |

## 内容项

| 字段                                 | 类型     | 必填  | 说明                                                                                                                                          |
| ---------------------------------- | ------ | --- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `metadata.content[].type`          | string | 是   | 按模型能力使用 `text`、`image_url`、`video_url`、`audio_url` 或 `draft_task`。                                                                          |
| `metadata.content[].text`          | string | 按场景 | `type=text` 时必填，用于描述期望视频。建议中文不超过 500 字、英文不超过 1000 词；这是提示词建议，不是硬性输入上限。                                                                       |
| `metadata.content[].image_url.url` | string | 按场景 | 图像项必填。支持公网 URL、`data:image/<format>;base64,...` 或可访问的 `asset://` 素材 ID。                                                                     |
| `metadata.content[].video_url.url` | string | 按场景 | 视频项必填。支持公网 URL 或可访问的 `asset://` 素材 ID；此输入格式不支持视频 Base64 data URL。                                                                           |
| `metadata.content[].audio_url.url` | string | 按场景 | 音频项必填。支持公网 URL、`data:audio/<format>;base64,...` 或可访问的 `asset://` 素材 ID。                                                                     |
| `metadata.content[].draft_task.id` | string | 按场景 | 仅 1.5 Pro。已成功生成的样片任务 ID，用于复用其模型、输入、音频设置、种子、比例、时长及镜头设置。                                                                                      |
| `metadata.content[].role`          | string | 按场景 | 单张首帧图可省略 role 或使用 `first_frame`；首尾帧过渡须传入两个图像项并显式标记 `first_frame`、`last_frame`。参考素材使用 `reference_image`、`reference_video`、`reference_audio`。 |

## 媒体限制

| 媒体 | 限制                                                                                                                                               |
| -- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| 图像 | JPEG/PNG/WebP/BMP/TIFF/GIF；1.5 Pro 及以上另支持 HEIC/HEIF。单张小于 30 MB，宽高各为 300-6000 px，宽高比为 0.4-2.5。首帧输入为一张图，首尾帧输入为两张图。                                 |
| 视频 | MP4/MOV；单个不超过 200 MB，24-60 fps，宽高比 0.4-2.5，宽高各为 300-6000 px，总像素数 407696-8295044。2.0 每段 2-15 秒、合计不超过 15 秒；2.5 每段 2-30 秒、合计不超过 30 秒，编辑输入须为 4-30 秒。 |
| 音频 | WAV/MP3，单个不超过 15 MB。2.0 每段 2-15 秒、合计不超过 15 秒；2.5 每段 2-30 秒、合计不超过 30 秒。                                                                           |
| 请求 | JSON 请求总大小不超过 64 MB，包括 Base64 编码开销。输入素材须满足模型的素材授权要求。                                                                                             |

## 场景约束

* 首帧、首尾帧和全模态参考是互斥场景，不要将首尾帧角色与 `reference_*` 角色混用。
* Seedance 2.5 的首帧、首尾帧、编辑和延长场景必须使用 `ratio="adaptive"`。编辑须提供至少一个 4-30 秒参考视频并使用 `duration=-1`，延长须提供参考视频。可选参数 `omni_reference_task_type` 可显式指定 `edit` 或 `extend`，也可保留自动判定。
* Seedance 2.0 的音频参考必须同时包含至少一个图像或视频参考。 Seedance 2.5 另支持仅音频参考。
* 旧版本不支持完整的全模态参考流程；Seedance 1.0 Pro Fast 支持首帧输入，不支持首尾帧过渡。

## 调用示例

调用前设置环境变量 `MIXROUTE_API_KEY`，并将媒体占位值替换为可访问的素材。请求被接受后会创建计费任务；提交超时后不要自动重复提交。

<Tabs>
  <Tab title="文生视频">
    ```bash theme={null}
    curl --location "https://api.mixroute.ai/v1/video/generations" \
      --header "Authorization: Bearer $MIXROUTE_API_KEY" \
      --header "Content-Type: application/json" \
      --data '{
      "model": "dreamina-seedance-2-0-260128",
      "prompt": "A professor is teaching a class in a classroom.",
      "asset": false,
      "metadata": {
        "content": [
          {
            "type": "text",
            "text": "A professor is teaching a class in a classroom."
          }
        ],
        "duration": 10,
        "ratio": "16:9",
        "resolution": "720p",
        "generate_audio": false
      }
    }'
    ```
  </Tab>

  <Tab title="首尾帧（2.0）">
    ```bash theme={null}
    curl --location "https://api.mixroute.ai/v1/video/generations" \
      --header "Authorization: Bearer $MIXROUTE_API_KEY" \
      --header "Content-Type: application/json" \
      --data '{
      "model": "dreamina-seedance-2-0-260128",
      "prompt": "A professor is teaching a class in a classroom.",
      "asset": true,
      "metadata": {
        "content": [
          {
            "type": "image_url",
            "image_url": {
              "url": "https://static.freebeatfit.com/aiImageEdit/result/L001510027166320955392/1780060289776-1.png"
            },
            "role": "first_frame"
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "https://static.freebeatfit.com/aiImageEdit/result/M1509975287180300288_0004_1780047826.png"
            },
            "role": "last_frame"
          },
          {
            "type": "text",
            "text": "A professor is teaching a class in a classroom."
          }
        ],
        "generate_audio": false,
        "duration": 10,
        "ratio": "16:9"
      }
    }'
    ```
  </Tab>

  <Tab title="首帧（2.5）">
    ```bash theme={null}
    curl --location "https://api.mixroute.ai/v1/video/generations" \
      --header "Authorization: Bearer $MIXROUTE_API_KEY" \
      --header "Content-Type: application/json" \
      --data '{
      "model": "doubao-seedance-2-5-260628",
      "prompt": "A professor is teaching a class in a classroom.",
      "asset": true,
      "metadata": {
        "content": [
          {
            "type": "text",
            "text": "A professor is teaching a class in a classroom."
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "https://static.freebeatfit.com/aiImageEdit/result/L001510027166320955392/1780060289776-1.png"
            },
            "role": "first_frame"
          }
        ],
        "ratio": "adaptive",
        "duration": 5,
        "resolution": "720p",
        "generate_audio": false
      }
    }'
    ```
  </Tab>

  <Tab title="图像与音频参考">
    ```bash theme={null}
    curl --location "https://api.mixroute.ai/v1/video/generations" \
      --header "Authorization: Bearer $MIXROUTE_API_KEY" \
      --header "Content-Type: application/json" \
      --data '{
      "model": "dreamina-seedance-2-0-fast-260128",
      "prompt": "A professor is teaching a class in a classroom.",
      "asset": true,
      "metadata": {
        "content": [
          {
            "type": "text",
            "text": "A professor is teaching a class in a classroom."
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "https://static.freebeatfit.com/aiImageEdit/result/L001510027166320955392/1780060289776-1.png"
            },
            "role": "reference_image"
          },
          {
            "type": "audio_url",
            "audio_url": {
              "url": "https://example.com/reference.mp3"
            },
            "role": "reference_audio"
          }
        ],
        "duration": 10,
        "ratio": "16:9",
        "generate_audio": true
      }
    }'
    ```
  </Tab>

  <Tab title="编辑视频（2.5）">
    ```bash theme={null}
    curl --location "https://api.mixroute.ai/v1/video/generations" \
      --header "Authorization: Bearer $MIXROUTE_API_KEY" \
      --header "Content-Type: application/json" \
      --data '{
      "model": "doubao-seedance-2-5-260628",
      "prompt": "Change the lighting in Video 1 to sunset and preserve its camera motion.",
      "asset": true,
      "metadata": {
        "content": [
          {
            "type": "text",
            "text": "Change the lighting in Video 1 to sunset and preserve its camera motion."
          },
          {
            "type": "video_url",
            "video_url": {
              "url": "https://example.com/source.mov"
            },
            "role": "reference_video"
          }
        ],
        "omni_reference_task_type": "edit",
        "duration": -1,
        "ratio": "adaptive",
        "output_format": "mov"
      }
    }'
    ```
  </Tab>
</Tabs>

### Python

```python theme={null}
import json
import os
import requests

payload = json.loads(r'''
{
  "model": "dreamina-seedance-2-0-260128",
  "prompt": "A professor is teaching a class in a classroom.",
  "asset": false,
  "metadata": {
    "content": [
      {
        "type": "text",
        "text": "A professor is teaching a class in a classroom."
      }
    ],
    "duration": 10,
    "ratio": "16:9",
    "resolution": "720p",
    "generate_audio": false
  }
}
''')
response = requests.post(
    "https://api.mixroute.ai/v1/video/generations",
    headers={"Authorization": "Bearer " + os.environ["MIXROUTE_API_KEY"]},
    json=payload,
    timeout=60,
)
response.raise_for_status()
print(response.json())
```

## 任务结果

保存提交响应中的 MixRoute 任务 ID，并调用 [查询视频任务](/cn/api-reference/endpoint/query-video-task)。提交成功表示任务已创建；任务完成后再读取生成结果。不同路由的响应封装和结果位置可能不同。
