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

# 通过 Comfy Router 使用 Dreamina Seedance 2.0 Mini

> 通过 Comfy Router 调用 byteplus/dreamina-seedance-2-0-mini：endpoint、请求结构以及 Router 返回的响应。

`byteplus/dreamina-seedance-2-0-mini` 的 API 参考，由 Comfy Router 提供，来源为 BytePlus。

## 快速开始

在[你的 Comfy 工作区](https://platform.comfy.org/profile/api-keys)中创建密钥，并将其导出为 `COMFY_API_KEY`。Python 和 TypeScript 代码片段使用 Comfy SDK（`pip install comfy-sdk`、`npm install @comfyorg/sdk`）；cURL 代码片段是通过原始 HTTP 执行的同一调用。

**模型 ID：** `byteplus/dreamina-seedance-2-0-mini`

**端点：** `POST https://api.comfy.org/v2/models/byteplus/dreamina-seedance-2-0-mini`

<Tabs>
  <Tab title="Wait for the result">
    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # Reads COMFY_API_KEY from the environment.
      # The SDK automatically creates an idempotency key and reuses it for automatic retries.
      with Comfy() as client:
          result = client.models.run(
              "byteplus/dreamina-seedance-2-0-mini",
              {
                  "content": [
                      {
                          "text": "A red fox trotting through a snowy pine forest",
                          "type": "text",
                      },
                  ],
                  "duration": 5,
                  "ratio": "16:9",
                  "resolution": "720p",
              },
          )

      print(result)
      ```

      ```typescript TypeScript theme={null}
      import { comfy } from "@comfyorg/sdk";

      // Reads COMFY_API_KEY from the environment.
      // The SDK automatically creates an idempotency key and reuses it for automatic retries.
      const { data } = await comfy.models.run("byteplus/dreamina-seedance-2-0-mini", {
        content: [
          {
            text: "A red fox trotting through a snowy pine forest",
            type: "text",
          },
        ],
        duration: 5,
        ratio: "16:9",
        resolution: "720p",
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/byteplus/dreamina-seedance-2-0-mini \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"content\": [{\"text\":\"A red fox trotting through a snowy pine forest\",\"type\":\"text\"}], \"duration\": 5, \"ratio\": \"16:9\", \"resolution\": \"720p\"}"
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Queue and collect later">
    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # Reads COMFY_API_KEY from the environment.
      # Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.
      with Comfy() as client:
          handle = client.models.submit(
              "byteplus/dreamina-seedance-2-0-mini",
              {
                  "content": [
                      {
                          "text": "A red fox trotting through a snowy pine forest",
                          "type": "text",
                      },
                  ],
                  "duration": 5,
                  "ratio": "16:9",
                  "resolution": "720p",
              },
          )
          print("request_id:", handle.request_id)  # with the model ID, all another process needs

          # Poll until the request completes, waiting the Retry-After the server names.
          for update in handle.iter_events():
              print(update.status, update.queue_position)

          # The provider's own payload, the same value models.run() returns.
          # A request that failed or was cancelled raises the typed Router error here.
          result = handle.get()

      print(result)
      ```

      ```typescript TypeScript theme={null}
      import { comfy } from "@comfyorg/sdk";

      // Reads COMFY_API_KEY from the environment.
      // Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.
      const handle = await comfy.models.submit("byteplus/dreamina-seedance-2-0-mini", {
        content: [
          {
            text: "A red fox trotting through a snowy pine forest",
            type: "text",
          },
        ],
        duration: 5,
        ratio: "16:9",
        resolution: "720p",
      });
      console.log("requestId:", handle.requestId); // with the model ID, all another process needs

      // Poll until the request completes, waiting the Retry-After the server names.
      for await (const update of handle.events()) {
        console.log(update.status, update.queuePosition);
      }

      // The same result models.run() returns. A request that failed or was cancelled rejects here.
      const result = await handle.get();

      console.log(result.data);
      ```

      ```bash cURL theme={null}
      # 1. Submit. Router answers 201 with request_id, status_url, response_url and cancel_url.
      curl https://api.comfy.org/v2/models/byteplus/dreamina-seedance-2-0-mini/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"content\": [{\"text\":\"A red fox trotting through a snowy pine forest\",\"type\":\"text\"}], \"duration\": 5, \"ratio\": \"16:9\", \"resolution\": \"720p\"}"

      # 2. Poll until status is COMPLETED, waiting the Retry-After seconds each response names.
      REQUEST_ID="<request_id from the 201 body>"
      curl -i https://api.comfy.org/v2/models/byteplus/dreamina-seedance-2-0-mini/requests/$REQUEST_ID/status \
        -H "X-API-Key: $COMFY_API_KEY"

      # 3. Collect. 200 with the model's native output, 202 with the status body while it is still running.
      curl https://api.comfy.org/v2/models/byteplus/dreamina-seedance-2-0-mini/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## Schema

### 输入

<ParamField body="callback_url" type="string (uri)">
  本生成任务结果的回调通知地址

  格式：`uri`
</ParamField>

<ParamField body="content" type="object[]" required>
  供模型生成视频的输入内容
</ParamField>

<ParamField body="content[].audio_url" type="object">
  输入音频对象。仅 Seedance 2.5、2.0 和 2.0 fast 支持音频输入。Seedance 2.0 和 2.0 fast 不能单独使用音频，必须至少包含 1 个图像或视频；Seedance 2.5 支持仅音频输入。
</ParamField>

<ParamField body="content[].audio_url.url" type="string" required>
  音频 URL、Base64 编码或资产 ID。
  音频 URL：音频的公开 URL（wav、mp3）。
  Base64：格式为 data:audio/\<format>;base64,\<content>
  资产 ID：格式为 asset://\<ASSET\_ID>
</ParamField>

<ParamField body="content[].image_url" type="object" />

<ParamField body="content[].image_url.url" type="string" required>
  用于图生视频的图像内容（当 type 为 "image\_url" 时）
  图片 URL：请确保图片 URL 可访问。
  Base64 编码的内容：格式必须为 data:image/\<format>;base64,\<content>
  资产 ID：格式为 asset://\<ASSET\_ID>
</ParamField>

<ParamField body="content[].role" type="string">
  内容项的角色/位置。
  对于图像：first\_frame、last\_frame 或 reference\_image。
  对于视频：reference\_video（仅 Seedance 2.5、2.0 和 2.0 fast）。
  对于音频：reference\_audio（仅 Seedance 2.5、2.0 和 2.0 fast）。

  可能的值：`first_frame`、`last_frame`、`reference_image`、`reference_video`、`reference_audio`
</ParamField>

<ParamField body="content[].text" type="string">
  模型的输入文本信息。包含文本提示词和可选参数。

  文本提示词（必填）：使用中文和英文字符描述要生成的视频。

  参数（可选）：在文本提示词之后添加 --\[parameters] 以控制视频规格：

  * \--resolution (--rs)：480p、720p、1080p（默认：720p）
  * \--ratio (--rt)：21:9、16:9、4:3、1:1、3:4、9:16、9:21、adaptive（默认：16:9 或 adaptive）
  * \--duration (--dur)：3-12 秒（默认：5）
  * \--framepersecond (--fps)：24（默认：24）
  * \--watermark (--wm)：true/false（默认：false）
  * \--seed (--seed)：-1 到 2^32-1（默认：-1）
  * \--camerafixed (--cf)：true/false（默认：false）

  示例："A beautiful landscape --ratio 16:9 --resolution 720p --duration 5"
</ParamField>

<ParamField body="content[].type" type="string" required>
  输入内容的类型

  可能的值：`text`、`image_url`、`video_url`、`audio_url`
</ParamField>

<ParamField body="content[].video_url" type="object">
  输入视频对象。仅 Seedance 2.5、2.0 和 2.0 fast 支持视频输入。
</ParamField>

<ParamField body="content[].video_url.url" type="string" required>
  视频 URL 或资产 ID。
  视频 URL：视频的公开 URL（mp4、mov）。
  资产 ID：格式为 asset://\<ASSET\_ID>
</ParamField>

<ParamField body="duration" type="`-1` | object">
  视频时长，单位为秒。Seedance 2.5：\[4,30] 或 -1（自动；视频编辑任务仅支持 -1）。Seedance 2.0 和 2.0 fast：\[4,15] 或 -1（自动）。Seedance 1.5 pro：\[4,12] 或 -1。Seedance 1.0：\[2,12]。

  范围：`2` 到 `30`
</ParamField>

<ParamField body="execution_expires_after" type="integer">
  任务超时阈值，单位为秒。默认 172800（48 小时）。范围：\[3600, 259200]。

  范围：`3600` 到 `259200`
</ParamField>

<ParamField body="generate_audio" type="boolean" default="true">
  Seedance 2.5、2.0、2.0 fast 和 1.5 pro 支持。已生成的视频是否包含与画面同步的音频。
  true：模型输出的视频带有同步音频。
  false：模型输出无声视频。
</ParamField>

<ParamField body="model" type="string">
  要调用的模型 ID。支持的模型：seedance-1-5-pro-251215、seedance-1-0-pro-250528、seedance-1-0-pro-fast-251015、seedance-1-0-lite-t2v-250428、seedance-1-0-lite-i2v-250428、dreamina-seedance-2-0-260128、dreamina-seedance-2-0-fast-260128、dreamina-seedance-2-0-mini 和 dreamina-seedance-2-5-260628。直接通过 v1 调用 POST /proxy/byteplus/api/v3/contents/generations/tasks 时必须提供该参数：代理会拒绝任何其他值，省略该参数时也会返回 400。它不在本 schema 的 `required` 列表中，因为 Comfy Router 会从 /v2/models/byteplus/\{model} 的 `{model}` 路径段填充该值，因此 Router 调用方会省略它。
</ParamField>

<ParamField body="output_format" type="string" default="&#x22;mp4&#x22;">
  仅 Seedance 2.5。输出视频的容器格式。
  mp4：常规容器（H.264/AAC，yuv420p），兼容性广泛且文件大小更小。
  mov：专业容器（H.264 High 4:4:4 Predictive/PCM，yuv444p），颜色精度高，适合后期制作；文件大小更大。

  可能的值：`mp4`、`mov`
</ParamField>

<ParamField body="ratio" type="string">
  已生成视频的比例。Seedance 2.0 和 2.0 fast、1.5 pro 默认：adaptive。

  可能的值：`16:9`、`4:3`、`1:1`、`3:4`、`9:16`、`21:9`、`9:21`、`adaptive`
</ParamField>

<ParamField body="resolution" type="string">
  视频分辨率。Seedance 2.5、2.0 和 2.0 fast、1.5 pro、1.0 lite 默认：720p。Seedance 1.0 pro 和 pro-fast 默认：1080p。
  注意：Seedance 2.0 和 2.0 fast 不支持 1080p。Seedance 2.5 支持 480p、720p 和 1080p。

  可能的值：`480p`、`720p`、`1080p`、`4k`
</ParamField>

<ParamField body="return_last_frame" type="boolean" default="false">
  是否返回已生成视频的最后一帧图像。是：返回已生成视频的尾帧图像。将此参数设置为是后，可通过调用查询视频生成任务信息接口获取尾帧图像。尾帧图像为 PNG 格式，其像素宽度和高度与已生成视频一致，且不带水印。使用此参数可以生成多个连续视频：将前一个已生成视频的尾帧作为下一个视频任务的首帧，从而快速生成多个连续视频。
  否：不返回已生成视频的尾帧图像。
</ParamField>

<ParamField body="seed" type="integer">
  用于控制随机性的种子整数。取值范围：\[-1, 2^32-1]。使用 -1 表示随机种子。

  取值范围：`-1` 到 `4294967295`
</ParamField>

<ParamField body="service_tier" type="string">
  处理所用的服务层级。Seedance 2.5、2.0 和 2.0 fast 不支持 flex（离线推理）。

  可选值：`default`、`flex`
</ParamField>

<ParamField body="watermark" type="boolean" default="false">
  已生成视频是否包含水印。
</ParamField>

本文档由 Router 在 `GET /v2/models/byteplus/dreamina-seedance-2-0-mini/openapi.json` 提供的 schema 生成，该 schema 也是请求到达提供商之前用于校验调用的同一份文档。

### 输出

<ResponseField name="content" type="object">
  视频生成任务完成后的输出内容。其中包含输出视频的下载 URL；当 BytePlus 返回时，还包含其最后一帧的下载 URL。`video_url` 和 `last_frame_url` 都会被重新托管到 Comfy 存储上，此处的其他所有字段均来自 BytePlus 本身。可为空：BytePlus 会在任务结束 24 小时后清除这些 URL，因此在此之后轮询一个已成功的文档时，`content` 可能不存在或为 null。
</ResponseField>

<ResponseField name="content.last_frame_url" type="string">
  已生成视频最后一帧的下载 URL。当请求设置了 `return_last_frame` 时返回。请勿根据此 URL 推断图像格式：BytePlus 在请求侧将最后一帧记录为 PNG，而 Router 会重新托管它接收到的任意字节，并依据上游的 Content-Type 或内容嗅探来确定其类型，仅当两者都失败时才将 `image/jpeg` 作为最后兜底。Router 会将最后一帧重新托管到 Comfy 存储并重写此字段，因此它通常是 Comfy 签名的 URL，有效期最长 24 小时。该 URL 在签发时按 24 小时签名，并从一份 23 小时的备忘中重放，所以稍后轮询可能返回一个仅剩一小时有效期的链接。当无法执行重新托管时，该字段会保留 BytePlus 自己的 URL，而 BytePlus 会在任务结束 24 小时后清除它。无论哪种情况，链接都会过期，因此请下载该帧，而不要存储 URL。
</ResponseField>

<ResponseField name="content.output_format" type="string">
  已生成视频的容器格式（mp4 或 mov），当 BytePlus 将其嵌套在 `content` 内时返回。Seedance 系列模型更常将其作为 `content` 的顶层同级字段返回，请参见顶层的 `output_format` 字段；Router 会读取两者中实际存在的那个。
</ResponseField>

<ResponseField name="content.video_url" type="string">
  输出视频的下载 URL。Router 会将视频重新托管到 Comfy 存储并重写此字段，因此它通常是 Comfy 签名的 URL，有效期最长 24 小时。该 URL 在签发时按 24 小时签名，并从一份 23 小时的备忘中重放，所以稍后轮询可能返回一个仅剩一小时有效期的链接。当无法执行重新托管时，该字段会保留 BytePlus 自己的 URL，而 BytePlus 会在任务结束 24 小时后清除它，并且在某些模型上将其下载次数限制为 100 次。无论哪种情况，链接都会过期，因此请下载该视频，而不要存储 URL。
</ResponseField>

<ResponseField name="created_at" type="integer">
  任务的创建时间。该值为 UNIX 时间戳，单位为秒。
</ResponseField>

<ResponseField name="duration" type="number">
  已生成视频的时长，单位为秒。声明为 number 而非 integer，是因为 BytePlus 对此并不一致：视频任务曾被观察到返回整数秒，而 BytePlus 的其他相关接口会报告带小数的时长，因此客户端不应假定其为整数值。这是 BytePlus 自己的字段，在视频任务成功时返回并原样转发。
</ResponseField>

<ResponseField name="error" type="object">
  错误信息。如果任务成功，则返回 null。如果任务失败，则返回错误信息。
</ResponseField>

<ResponseField name="error.code" type="string">
  错误码
</ResponseField>

<ResponseField name="error.message" type="string">
  报错信息
</ResponseField>

<ResponseField name="id" type="string">
  视频生成任务的 ID
</ResponseField>

<ResponseField name="model" type="string">
  该任务所使用的模型名称与版本
</ResponseField>

<ResponseField name="output_format" type="string">
  已生成视频的容器格式（mp4 或 mov），在顶层作为 `content` 的同级字段返回，这正是 Seedance 视频任务查询返回它的位置。这是 BytePlus 自己的字段，原样转发。
</ResponseField>

<ResponseField name="resolution" type="string">
  已生成视频的分辨率，例如 `1080p`。这是 BytePlus 自己的字段，在视频任务成功时返回并原样转发。
</ResponseField>

<ResponseField name="seed" type="integer">
  该任务实际使用的生成种子。这是 BytePlus 自己的字段，在视频任务成功时返回并原样转发。

  格式：`int64`
</ResponseField>

<ResponseField name="status" type="string">
  任务的状态

  可能的取值：`queued`、`running`、`cancelled`、`succeeded`、`failed`、`expired`
</ResponseField>

<ResponseField name="updated_at" type="integer">
  任务的最后更新时间。该值为 UNIX 时间戳，单位为秒。
</ResponseField>

<ResponseField name="usage" type="object">
  该请求的 token 用量
</ResponseField>

<ResponseField name="usage.completion_tokens" type="integer">
  模型生成的 token 数量
</ResponseField>

<ResponseField name="usage.total_tokens" type="integer">
  对于视频生成模型，不计算输入 token 数量，默认值为 0。因此 total\_tokens = completion\_tokens。
</ResponseField>

## 示例

### 输入

```json theme={null}
{
  "content": [
    {
      "text": "A red fox trotting through a snowy pine forest",
      "type": "text"
    }
  ],
  "duration": 5,
  "ratio": "16:9",
  "resolution": "720p"
}
```

### 输出

```json theme={null}
{
  "content": {
    "last_frame_url": "https://example.invalid/byteplus/seedance-1-0-lite-t2v-250428/last-frame",
    "video_url": "https://example.invalid/byteplus/seedance-1-0-lite-t2v-250428/generated.mp4"
  },
  "created_at": 1767225600,
  "duration": 5,
  "error": null,
  "id": "3f7a1b28-5c0d-4e91-8a6f-1b2c3d4e5f60",
  "model": "dreamina-seedance-2-0-mini-260615",
  "output_format": "mp4",
  "resolution": "1080p",
  "seed": 1234567890123,
  "status": "succeeded",
  "updated_at": 1767225730
}
```

## 发布前须知

SDK 会生成 `Idempotency-Key` 并在自动重试中复用它。手动重试时，请复用原始 key。Router 最长可保持连接 10 分钟。

请求失败时，Router 会发送 `X-Comfy-Error-Type` 响应头说明原因。`422` 表示 Router 在调用提供商之前就拒绝了输入。生成的资源请及时下载，因为[结果链接会过期](/zh/development/comfy-router/reference#结果资产)。

<CardGroup cols={3}>
  <Card title="请求头" icon="list" href="/zh/development/comfy-router/quickstart">
    身份验证、幂等性、请求 ID、错误分类、重试节奏、消费限额。
  </Card>

  <Card title="使用 Router API" icon="code" href="/zh/development/comfy-router/quickstart">
    模型发现、校验错误、重试与计费。
  </Card>

  <Card title="限制" icon="triangle-exclamation" href="/zh/development/comfy-router/limitations">
    Router 目前不支持的功能，以及替代方案。
  </Card>
</CardGroup>
