> ## 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](/zh-hant/api-reference/endpoint/doubao) | [Dreamina](/zh-hant/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，並呼叫 [查詢影片任務](/zh-hant/api-reference/endpoint/query-video-task)。提交成功表示任務已建立；任務完成後再讀取生成結果。不同路由的響應封裝和結果位置可能不同。
