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

# Seedance 2.0

> 字节跳动 Doubao Seedance 2.0 视频生成：文生视频、首尾帧、多模态参考与有声视频。请求体与火山方舟官方一致。

* 请求体与 [火山方舟视频生成 API](https://www.volcengine.com/docs/82379/1520757) 官方格式一致：文本、图片、视频、音频都放在 `content` 数组中，用 `role` 区分用途。
* 异步接口：提交后立即返回任务 `id`，再调用 [查询视频任务](/api-reference/videos/task-status) 获取结果。
* 计费与时长、分辨率、是否包含参考视频相关，见 [模型价格](https://nodylink.com/pricing)。任务失败自动退款。

## 模型

| 模型 ID | 说明 | 分辨率 |
| - | - | - |
| `Doubao-Seedance-2.0` | 标准版 | 720p / 1080p |
| `Doubao-Seedance-2.0-fast` | 快速版，功能与标准版一致，生成更快 | 仅 720p |
| `Doubao-Seedance-2.0-mini` | 迷你版，功能与标准版一致 | 仅 720p |

可用模型以 [模型广场](https://nodylink.com/market) 为准。

<RequestExample>
  ```bash cURL theme={null}
  curl https://api.nodylink.com/v2/videos/generations \
    -H "Authorization: Bearer sk-你的密钥" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "Doubao-Seedance-2.0",
      "content": [
        {"type": "text", "text": "小猫对着镜头打哈欠，午后阳光，浅景深"}
      ],
      "resolution": "720p",
      "ratio": "16:9",
      "duration": 5,
      "generate_audio": true
    }'
  ```

  ```python Python theme={null}
  import time
  import requests

  API_KEY = "sk-你的密钥"
  BASE = "https://api.nodylink.com"
  headers = {"Authorization": f"Bearer {API_KEY}"}

  submit = requests.post(
      f"{BASE}/v2/videos/generations",
      headers=headers,
      json={
          "model": "Doubao-Seedance-2.0",
          "content": [{"type": "text", "text": "小猫对着镜头打哈欠，午后阳光，浅景深"}],
          "resolution": "720p",
          "ratio": "16:9",
          "duration": 5,
          "generate_audio": True,
      },
  ).json()
  task_id = submit["id"]


  def video_url(data):
      task = data.get("task") or {}
      if task.get("outputs"):
          return task["outputs"][0]
      return (data.get("content") or {}).get("video_url")


  while True:
      task = requests.get(f"{BASE}/v2/videos/generations/{task_id}", headers=headers).json()
      if task["status"] == "SUCCESS":
          print(video_url(task["data"]))
          break
      if task["status"] == "FAILURE":
          raise RuntimeError(task["fail_reason"])
      time.sleep(10)
  ```

  ```javascript Node.js theme={null}
  const API_KEY = "sk-你的密钥";
  const BASE = "https://api.nodylink.com";
  const headers = {
    Authorization: `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
  };

  const submit = await fetch(`${BASE}/v2/videos/generations`, {
    method: "POST",
    headers,
    body: JSON.stringify({
      model: "Doubao-Seedance-2.0",
      content: [{ type: "text", text: "小猫对着镜头打哈欠，午后阳光，浅景深" }],
      resolution: "720p",
      ratio: "16:9",
      duration: 5,
      generate_audio: true,
    }),
  }).then((r) => r.json());

  const videoUrl = (data) => data?.task?.outputs?.[0] ?? data?.content?.video_url;

  while (true) {
    const task = await fetch(`${BASE}/v2/videos/generations/${submit.id}`, { headers })
      .then((r) => r.json());
    if (task.status === "SUCCESS") {
      console.log(videoUrl(task.data));
      break;
    }
    if (task.status === "FAILURE") throw new Error(task.fail_reason);
    await new Promise((r) => setTimeout(r, 10000));
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "6b2f8d1e-3c4a-4e9b-8f70-1a5d9c2e7b36",
    "task_id": "6b2f8d1e-3c4a-4e9b-8f70-1a5d9c2e7b36",
    "object": "video",
    "model": "Doubao-Seedance-2.0",
    "status": "queued",
    "progress": 0,
    "created_at": 1792000000
  }
  ```

  ```json 400 theme={null}
  {
    "code": "missing_model",
    "message": "model field is required",
    "data": null
  }
  ```
</ResponseExample>

## 鉴权

<ParamField header="Authorization" type="string" required>
  `Bearer <API Key>`。在 [API 密钥](https://nodylink.com/dashboard/keys) 页面创建。
</ParamField>

## 请求参数

<ParamField body="model" type="string" required>
  模型 ID：`Doubao-Seedance-2.0`、`Doubao-Seedance-2.0-fast` 或 `Doubao-Seedance-2.0-mini`。
</ParamField>

<ParamField body="content" type="array" required>
  输入内容数组，可以包含文本、图片、视频、音频。

  <Expandable title="文本">
    <ParamField body="type" type="string" required>
      固定为 `text`。
    </ParamField>

    <ParamField body="text" type="string" required>
      提示词，建议写清主体、动作、镜头和风格。中文建议不超过 500 字，英文不超过 1000 词。可以用「图片1」「视频1」「音频1」指代参考素材，序号按同类素材在数组中的顺序从 1 开始。
    </ParamField>
  </Expandable>

  <Expandable title="图片">
    <ParamField body="type" type="string" required>
      固定为 `image_url`。
    </ParamField>

    <ParamField body="image_url.url" type="string" required>
      图片 URL，或 `data:image/png;base64,...` 格式的 Base64 数据。
    </ParamField>

    <ParamField body="role" type="string">
      图片用途：

      * `first_frame`：首帧
      * `last_frame`：尾帧，需与首帧一起使用
      * `reference_image`：参考图，最多 9 张
    </ParamField>
  </Expandable>

  <Expandable title="视频">
    <ParamField body="type" type="string" required>
      固定为 `video_url`。
    </ParamField>

    <ParamField body="video_url.url" type="string" required>
      参考视频 URL。
    </ParamField>

    <ParamField body="role" type="string" required>
      固定为 `reference_video`。最多 3 个，总时长 2～15 秒，分辨率 480p～720p。
    </ParamField>
  </Expandable>

  <Expandable title="音频">
    <ParamField body="type" type="string" required>
      固定为 `audio_url`。
    </ParamField>

    <ParamField body="audio_url.url" type="string" required>
      参考音频 URL，支持 wav / mp3。
    </ParamField>

    <ParamField body="role" type="string" required>
      固定为 `reference_audio`。最多 3 段，总时长不超过 15 秒，必须与参考图或参考视频一起使用。
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="resolution" type="string" default="720p">
  分辨率：`720p` 或 `1080p`。`Doubao-Seedance-2.0-fast` 和 `Doubao-Seedance-2.0-mini` 仅支持 `720p`。
</ParamField>

<ParamField body="ratio" type="string" default="16:9">
  宽高比：`16:9`、`4:3`、`1:1`、`3:4`、`9:16`、`21:9`，或 `adaptive`（根据输入图片 / 视频自动匹配）。
</ParamField>

<ParamField body="duration" type="integer" default="5">
  视频时长（秒），取值 4～15。传 `-1` 时由模型自动决定时长，提交时按上限预扣费用，完成后按实际结果结算。
</ParamField>

<ParamField body="generate_audio" type="boolean" default="true">
  是否生成与画面同步的音频（人声、音效、背景音乐）。
</ParamField>

<ParamField body="seed" type="integer">
  随机种子，取值 -1 到 2^32-1。相同请求和种子会生成相似结果，但不保证完全一致。
</ParamField>

<ParamField body="watermark" type="boolean" default="false">
  是否在视频中添加「AI 生成」水印。
</ParamField>

<ParamField body="return_last_frame" type="boolean" default="false">
  是否额外返回视频最后一帧的图片，可以作为下一段视频的首帧，实现连续生成。
</ParamField>

<ParamField body="tools" type="array">
  增强工具。目前支持联网搜索：`[{"type": "web_search"}]`，生成时参考网络上的实时信息。
</ParamField>

<Warning>
  * 使用首帧 / 尾帧时，不能同时传参考视频或参考音频。
  * 参考音频不能单独使用，必须搭配参考图或参考视频。
  * 真人人脸作为参考素材时可能会被上游内容审核拦截。
</Warning>

<Note>
  提交阶段的错误返回 `{"code": "...", "message": "...", "data": null}` 结构。HTTP 状态码为 429 时，`message` 为「当前分组上游负载已饱和，请稍后再试」，请退避后重试。
</Note>

## 提交响应

<ResponseField name="id" type="string">
  任务 ID，用于 [查询视频任务](/api-reference/videos/task-status)。
</ResponseField>

<ResponseField name="task_id" type="string">
  与 `id` 相同，为兼容旧接口保留。
</ResponseField>

<ResponseField name="object" type="string">
  固定为 `video`。
</ResponseField>

<ResponseField name="model" type="string">
  请求的模型 ID。
</ResponseField>

<ResponseField name="status" type="string">
  固定为 `queued`。
</ResponseField>

<ResponseField name="progress" type="integer">
  固定为 `0`。
</ResponseField>

<ResponseField name="created_at" type="integer">
  提交时间，Unix 时间戳（秒）。
</ResponseField>

## 使用示例

### 图生视频（首帧）

```json theme={null}
{
  "model": "Doubao-Seedance-2.0",
  "content": [
    {"type": "text", "text": "女孩转身微笑，头发随风飘动"},
    {"type": "image_url", "image_url": {"url": "https://example.com/girl.jpg"}, "role": "first_frame"}
  ],
  "ratio": "adaptive",
  "duration": 5
}
```

### 首尾帧

```json theme={null}
{
  "model": "Doubao-Seedance-2.0",
  "content": [
    {"type": "text", "text": "镜头缓慢推进，城市从白天过渡到夜晚"},
    {"type": "image_url", "image_url": {"url": "https://example.com/day.jpg"}, "role": "first_frame"},
    {"type": "image_url", "image_url": {"url": "https://example.com/night.jpg"}, "role": "last_frame"}
  ],
  "ratio": "adaptive",
  "duration": 8
}
```

### 多模态参考（图片 + 视频 + 音频）

```json theme={null}
{
  "model": "Doubao-Seedance-2.0",
  "content": [
    {"type": "text", "text": "图片1中的角色按照视频1的舞蹈动作跳舞，音频1作为背景音乐"},
    {"type": "image_url", "image_url": {"url": "https://example.com/character.png"}, "role": "reference_image"},
    {"type": "video_url", "video_url": {"url": "https://example.com/dance.mp4"}, "role": "reference_video"},
    {"type": "audio_url", "audio_url": {"url": "https://example.com/music.mp3"}, "role": "reference_audio"}
  ],
  "resolution": "720p",
  "ratio": "9:16",
  "duration": 10
}
```

### 连续生成（返回尾帧）

```json theme={null}
{
  "model": "Doubao-Seedance-2.0-fast",
  "content": [
    {"type": "text", "text": "一辆红色跑车在海岸公路上疾驰"}
  ],
  "resolution": "720p",
  "duration": 5,
  "return_last_frame": true
}
```

任务成功后取出尾帧图片，作为下一个任务的 `first_frame` 即可续接画面。

### 联网搜索

```json theme={null}
{
  "model": "Doubao-Seedance-2.0",
  "content": [
    {"type": "text", "text": "介绍今年最新发布的国产电动汽车，产品展示风格"}
  ],
  "tools": [{"type": "web_search"}]
}
```


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