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

# Seedance 视频生成接口

> 兼容 Seedance 官方协议的视频生成接口，支持文生视频、图生视频、参考媒体与同步音频生成

此接口与 Seedance 官方协议一致，请求体可直接复用官方文档中的参数结构。`model` 须为平台模型标识，路由后由网关改写为渠道模型名；`callback_url` 由网关覆盖注入带签名的默认回调地址。

## 功能特性

* 内容元素列表 `content` 支持文本、图片、视频、音频与草稿任务五种类型
* 支持首帧 / 尾帧 / 参考图（2.0 系列 1-9 张）/ 参考视频 / 参考音频输入
* 支持同步音频生成 `generate_audio`（仅 Seedance 2.0 系列与 1.5 Pro）
* 支持在线 / 离线推理 `service_tier` 与任务超时阈值 `execution_expires_after`
* 支持草稿模式 `draft`（仅 1.5 Pro）、尾帧返回 `return_last_frame`、任务优先级 `priority`（仅 2.0）
* 支持视频编辑（仅 2.5），可编辑原视频的画面或音频，在视频中添加、删除或修改物体，或重绘、修复部分画面
* 支持视频延长（仅 2.5），可向前或向后扩展原视频

## 认证方式

在请求头中携带 `Authorization` 字段，格式为 `Bearer YOUR_API_KEY`。

## 支持的视频模型

| 模型标识              | 模型类型  | 模型描述                                          |
| ----------------- | ----- | --------------------------------------------- |
| seedance-2.5      | 参考生视频 | seedance 2.5 是新一代视频创作模型，在长叙事、多模态参考与编辑能力上有重大改进 |
| seedance-2.0      | 参考生视频 | seedance 旗舰视频生成模型                             |
| seedance-2.0-mini | 参考生视频 | 新一代高性价比视频生成模型                                 |
| seedance-2.0-fast | 参考生视频 | 继承了Seedance-2.0的核心功能和优势，速度更快                  |

## 快速示例

<CodeGroup>
  ```python Python theme={null}
  import requests

  url = "https://api.haitoken.ai/v1/seedance/video/generations"
  headers = {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json"
  }
  data = {
      "model": "seedance-2.0",
      "content": [
          {"type": "text", "text": "一只金毛犬在日落的海边奔跑，镜头缓慢跟随"},
          {
              "type": "image_url",
              "image_url": {"url": "https://example.com/images/dog.png"},
              "role": "first_frame"
          }
      ],
      "duration": 5,
      "resolution": "720p",
      "ratio": "16:9",
      "generate_audio": True,
      "watermark": False
  }

  response = requests.post(url, json=data, headers=headers)
  print(response.json())
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.haitoken.ai/v1/seedance/video/generations', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      model: 'seedance-2.0',
      content: [
        { type: 'text', text: '一只金毛犬在日落的海边奔跑，镜头缓慢跟随' },
        {
          type: 'image_url',
          image_url: { url: 'https://example.com/images/dog.png' },
          role: 'first_frame'
        }
      ],
      duration: 5,
      resolution: '720p',
      ratio: '16:9',
      generate_audio: true,
      watermark: false
    })
  });

  const data = await response.json();
  console.log(data);
  ```

  ```curl cURL theme={null}
  curl -X POST 'https://api.haitoken.ai/v1/seedance/video/generations' \
    -H 'Authorization: Bearer YOUR_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
      "model": "seedance-2.0",
      "content": [
        {"type": "text", "text": "一只金毛犬在日落的海边奔跑，镜头缓慢跟随"},
        {
          "type": "image_url",
          "image_url": {"url": "https://example.com/images/dog.png"},
          "role": "first_frame"
        }
      ],
      "duration": 5,
      "resolution": "720p",
      "ratio": "16:9",
      "generate_audio": true,
      "watermark": false
    }'
  ```
</CodeGroup>

创建成功后返回任务 ID：

```json theme={null}
{
  "id": "cgt-20260730120000-a1b2c3"
}
```

## 下一步

* 查看 [查询 Seedance 视频任务](/docs/zh/api-reference/video/seedance-status) 获取生成结果
* 查看 [视频生成](/docs/zh/api-reference/video/generation) 了解统一协议
* 查看 [万相协议](/docs/zh/api-reference/video/wan) 了解阿里万相原生参数
* 查看 [模型列表](/docs/zh/api-reference/models/list-models) 了解可用的视频模型


## OpenAPI

````yaml zh/api-reference/video/seedance/openapi.json POST /v1/seedance/video/generations
openapi: 3.0.1
info:
  title: 默认模块
  description: ''
  version: 1.0.0
servers: []
security: []
tags: []
paths:
  /v1/seedance/video/generations:
    post:
      tags: []
      summary: 创建视频生成任务（seedance 兼容协议）
      description: |-
        <p>
        Body 与 seedance 官方一致；model 须为平台模型标识（路由后改写为渠道模型名），
        callback_url 由网关覆盖注入（带签名）。
      parameters:
        - name: Authorization
          in: header
          description: API Key token (Bearer sk-xxx)
          required: true
          example: 'Bearer '
          schema:
            type: string
        - name: Content-Type
          in: header
          description: ''
          example: application/json
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SeedanceCreateTaskRequest'
              description: ''
            examples: {}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceCreateTaskResponse'
          headers: {}
      deprecated: false
      security: []
components:
  schemas:
    SeedanceCreateTaskRequest:
      type: object
      properties:
        callback_url:
          type: string
          description: 结果回调地址（任务状态变更时上游 POST 通知；网关配置回调后覆盖注入带签名的默认地址）
        return_last_frame:
          type: boolean
          description: |-
            是否返回生成视频的尾帧图（PNG，与视频同分辨率且无水印），默认 false；
            可用于以上一视频尾帧作为下一任务首帧，快速生成多段连续视频
        service_tier:
          type: string
          description: |-
            服务层级：default 在线推理（默认）/ flex 离线推理（价格为在线 50%）；
            Seedance 2.0 系列仅支持在线推理，不支持配置该参数
        execution_expires_after:
          type: integer
          description: |-
            任务超时阈值（秒），自 created_at 起算，取值 [3600, 259200]，默认 172800（48 小时）；
            超时后任务自动终止并标记为 expired
        camera_fixed:
          type: boolean
          description: 是否固定镜头，默认 false；参考图场景与 Seedance 2.0 系列不支持
        generate_audio:
          type: boolean
          description: |-
            是否生成与画面同步的音频（人声/音效/背景音乐），默认 true；
            仅 Seedance 2.0 系列与 1.5 Pro 支持
        safety_identifier:
          type: string
          description: |-
            终端用户唯一标识（用于平台安全审计，英文且长度不超过 64 字符，
            建议传入用户名/用户ID/邮箱的哈希值，避免泄露隐私）
        model:
          type: string
          description: 平台模型标识（如 seedance-2.0），路由后由网关改写为渠道模型名
        content:
          type: array
          items:
            $ref: '#/components/schemas/ContentItem'
            description: 内容元素
          description: 内容元素列表（文本提示词 / 图片 / 视频 / 音频 / 草稿任务ID）
        resolution:
          type: string
          description: |-
            生成视频分辨率：480p / 720p / 1080p / 4k；
            Seedance 2.0 系列与 1.5 Pro 默认 720p，1.0 Pro / Pro Fast 默认 1080p；
            1080p 不支持 2.0 Fast / 2.0 Mini，4k 仅支持 Seedance 2.0
        ratio:
          type: string
          description: 生成视频宽高比：16:9 / 4:3 / 1:1 / 3:4 / 9:16 / 21:9 / adaptive（按输入智能选择）
        duration:
          type: integer
          description: |-
            生成视频时长（整数秒），与 frames 二选一且 frames 优先，默认 5；
            Seedance 1.0 Pro / Pro Fast：[2, 12]；1.5 Pro：[4, 12] 或 -1（模型智能选择时长）；
            Seedance 2.0 系列：[4, 15] 或 -1
        frames:
          type: integer
          description: |-
            生成视频帧数（与 duration 二选一且优先），用于生成小数千秒的时长；
            仅 Seedance 1.0 Pro / Pro Fast 支持（2.0 系列与 1.5 Pro 不支持），
            取值 [29, 289] 且满足 25 + 4n（帧率 24，帧数 = 秒数 × 24）
        seed:
          type: integer
          description: 随机种子，取值 [-1, 2^32-1]，默认 -1（随机）；Seedance 2.0 系列不支持
          format: int64
        watermark:
          type: boolean
          description: 生成视频是否带 "AI Generated" 水印，默认 false
        draft:
          type: boolean
          description: |-
            是否启用草稿模式（480p 预览视频，费用更低，用于快速验证），默认 false；
            仅 Seedance 1.5 Pro 支持；草稿模式不支持尾帧返回与离线推理
        priority:
          type: integer
          description: |-
            任务执行优先级 0-9，值越大排队越靠前，默认 0；
            仅 Seedance 2.0 支持，仅作用于同一 Endpoint 的排队顺序，离线推理（flex）不支持
      required:
        - model
    SeedanceCreateTaskResponse:
      type: object
      properties:
        id:
          type: string
          description: 任务ID
    ContentItem:
      type: object
      properties:
        image_url:
          $ref: '#/components/schemas/MediaRef'
          description: >-
            图片输入（type=image_url，url 支持公网 URL / base64 data URI /
            asset://<ASSET_ID>）
        video_url:
          $ref: '#/components/schemas/MediaRef'
          description: >-
            视频输入（type=video_url，仅 Seedance 2.0 系列支持，url 支持公网 URL /
            asset://<ASSET_ID>）
        audio_url:
          $ref: '#/components/schemas/MediaRef'
          description: |-
            音频输入（type=audio_url，仅 Seedance 2.0 系列支持，不能单独输入音频，
            需至少包含 1 个参考视频或图片）
        draft_task:
          $ref: '#/components/schemas/DraftTaskRef'
          description: |-
            草稿任务输入（type=draft_task，仅 Seedance 1.5 Pro 支持；
            基于草稿任务ID复用其输入生成正式视频）
        type:
          type: string
          description: 元素类型：text / image_url / video_url / audio_url / draft_task
        text:
          type: string
          description: 文本提示词（type=text，建议 1000 词以内）
        role:
          type: string
          description: >-
            媒体元素的位置/用途（条件必填）：first_frame 首帧 / last_frame 尾帧 /

            reference_image 参考图（2.0 系列 1-9 张）/ reference_video 参考视频 /
            reference_audio 参考音频
      required:
        - type
    MediaRef:
      type: object
      properties:
        url:
          type: string
          description: 媒体公网 URL / base64 data URI（base64 由网关转存 OBS 后替换）/ asset://<ASSET_ID>
      required:
        - url
    DraftTaskRef:
      type: object
      properties:
        id:
          type: string
          description: |-
            草稿任务 ID（ModelArk 自动复用草稿任务的 model / text / image_url /
            generate_audio / seed / ratio / duration / camera_fixed 输入生成正式视频）
      required:
        - id

````