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

# 创建视频生成任务

> 异步创建视频生成任务，返回任务 `id`。用「查询任务」轮询结果，或传 `callback_url` 接收回调。参数校验失败不会创建任务，也不扣费。



## OpenAPI

````yaml /openapi/zh/seedance-2-5-flash.json post /api/v3/contents/generations/tasks
openapi: 3.1.0
info:
  description: >-
    DreamTo 开放平台 API。本文件由 Gateway
    源码自动生成（apps/gateway/internal/service/seedance_v3_contract.go），请勿手工修改。
  title: Seedance 2.5 Flash · DreamTo 开放平台 API
  version: v3
servers:
  - url: https://api.dreamto.ai
security:
  - bearerAuth: []
tags:
  - name: Seedance 2 视频生成
paths:
  /api/v3/contents/generations/tasks:
    post:
      tags:
        - Seedance 2 视频生成
      summary: 创建视频生成任务
      description: >-
        异步创建视频生成任务，返回任务 `id`。用「查询任务」轮询结果，或传 `callback_url`
        接收回调。参数校验失败不会创建任务，也不扣费。
      operationId: seedanceCreateTask
      requestBody:
        content:
          application/json:
            examples:
              文生视频:
                description: 仅用文本提示词生成视频。
                summary: 文生视频
                value:
                  model: seedance-2.5-flash
                  content:
                    - type: text
                      text: >-
                        写实风格，晴朗的蓝天之下，一大片白色的雏菊花田，镜头逐渐拉近，最终定格在一朵雏菊花的特写上，花瓣上有几颗晶莹的露珠
                  ratio: '16:9'
                  duration: 5
                  resolution: 720p
                  generate_audio: true
              图生视频（首帧）:
                description: 以一张图片作为视频首帧生成视频。
                summary: 图生视频（首帧）
                value:
                  model: seedance-2.5-flash
                  content:
                    - type: text
                      text: 镜头缓慢推近，人物微笑，头发随微风轻轻飘动，电影感光影
                    - type: image_url
                      image_url:
                        url: https://example.com/portrait.jpg
                      role: first_frame
                  duration: 5
                  resolution: 720p
              首尾帧生视频:
                description: 给定首帧与尾帧，生成两图之间的过渡视频。
                summary: 首尾帧生视频
                value:
                  model: seedance-2.5-flash
                  content:
                    - type: text
                      text: 画面从第一张图自然过渡到第二张图，镜头平稳推进，光影柔和，电影感转场
                    - type: image_url
                      image_url:
                        url: https://example.com/frame_start.jpg
                      role: first_frame
                    - type: image_url
                      image_url:
                        url: https://example.com/frame_end.jpg
                      role: last_frame
                  duration: 5
                  resolution: 720p
              多图参考生视频:
                description: 用多张参考图组合人物、物体与场景。
                summary: 多图参考生视频
                value:
                  model: seedance-2.5-flash
                  content:
                    - type: text
                      text: '[图片1]戴着眼镜穿着蓝色T恤的男生和[图片2]的柯基小狗，坐在[图片3]的草坪上，视频卡通风格'
                    - type: image_url
                      image_url:
                        url: https://example.com/boy.png
                      role: reference_image
                    - type: image_url
                      image_url:
                        url: https://example.com/dog.png
                      role: reference_image
                    - type: image_url
                      image_url:
                        url: https://example.com/grass.png
                      role: reference_image
                  ratio: '16:9'
                  duration: 5
                  resolution: 720p
              视频编辑:
                description: 基于参考视频修改画面内容。
                summary: 视频编辑
                value:
                  model: seedance-2.5-flash
                  content:
                    - type: text
                      text: 将视频1中的房子外立面墙壁刷成蓝色，天气改为雪天
                    - type: video_url
                      video_url:
                        url: https://example.com/house.mp4
                      role: reference_video
                  ratio: adaptive
                  duration: -1
                  resolution: 720p
                  omni_reference_task_type: edit
              视频延长:
                description: 延续参考视频继续生成后续画面。
                summary: 视频延长
                value:
                  model: seedance-2.5-flash
                  content:
                    - type: text
                      text: 延续原片运镜，人物继续向画面右侧走出，光线逐渐转为黄昏
                    - type: video_url
                      video_url:
                        url: https://example.com/clip.mp4
                      role: reference_video
                  ratio: adaptive
                  duration: 5
                  resolution: 720p
                  omni_reference_task_type: extend
              参考音频:
                description: 按参考音频的节奏与氛围生成画面。
                summary: 参考音频
                value:
                  model: seedance-2.5-flash
                  content:
                    - type: text
                      text: '[图片1]中的舞者在霓虹街头起舞，动作与音频1的鼓点同步，快速剪辑'
                    - type: image_url
                      image_url:
                        url: https://example.com/dancer.png
                      role: reference_image
                    - type: audio_url
                      audio_url:
                        url: https://example.com/beat.mp3
                      role: reference_audio
                  ratio: '9:16'
                  duration: 8
                  resolution: 720p
              联网搜索增强:
                description: 开启联网搜索，让模型参考实时信息。
                summary: 联网搜索增强
                value:
                  model: seedance-2.5-flash
                  content:
                    - type: text
                      text: 制作一段介绍当下最热门旅游目的地的短视频
                  ratio: '16:9'
                  duration: 5
                  resolution: 720p
                  tools:
                    - type: web_search
            schema:
              $ref: '#/components/schemas/SeedanceV3CreateTaskRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              examples:
                example:
                  value:
                    id: task_8c1d2e3f4a5b6c7d8e9f0a1b
                    request_id: req_3f9a1c2b7d4e5f60718293a4
              schema:
                $ref: '#/components/schemas/SeedanceV3CreateTaskResponse'
          description: 成功
          headers:
            X-Request-Id:
              description: 本次请求的唯一 ID（`req_` 开头）。所有响应（成功与失败）都带该头，排查问题时请提供该值与任务 `id`。
              schema:
                type: string
        '400':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: invalid_parameter
                      message: >-
                        duration must be an integer from 4 to 30 seconds, or -1
                        (smart duration)
                      type: invalid_request_error
                      http_status: 400
                      request_id: req_3f9a1c2b7d4e5f60718293a4
                      param: duration
                    request_id: req_3f9a1c2b7d4e5f60718293a4
              schema:
                $ref: '#/components/schemas/SeedanceV3ErrorResponse'
          description: >-
            参数错误：`invalid_parameter`（`error.param` 指出出错字段）或
            `invalid_request`。不会创建任务，也不会扣费
        '401':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: unauthorized
                      message: Invalid API key
                      type: authentication_error
                      http_status: 401
                      request_id: req_3f9a1c2b7d4e5f60718293a4
                    request_id: req_3f9a1c2b7d4e5f60718293a4
              schema:
                $ref: '#/components/schemas/SeedanceV3ErrorResponse'
          description: '`unauthorized`：API Key 无效或缺失'
        '402':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: insufficient_balance
                      message: Insufficient balance
                      type: insufficient_balance_error
                      http_status: 402
                      request_id: req_3f9a1c2b7d4e5f60718293a4
                    request_id: req_3f9a1c2b7d4e5f60718293a4
              schema:
                $ref: '#/components/schemas/SeedanceV3ErrorResponse'
          description: '`insufficient_balance`：余额不足，请充值后重试'
        '403':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: forbidden
                      message: No permission to access this resource
                      type: permission_error
                      http_status: 403
                      request_id: req_3f9a1c2b7d4e5f60718293a4
                    request_id: req_3f9a1c2b7d4e5f60718293a4
              schema:
                $ref: '#/components/schemas/SeedanceV3ErrorResponse'
          description: '`forbidden`：无权限访问该资源'
        '404':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: not_found
                      message: Model not found or not enabled
                      type: invalid_request_error
                      http_status: 404
                      request_id: req_3f9a1c2b7d4e5f60718293a4
                    request_id: req_3f9a1c2b7d4e5f60718293a4
              schema:
                $ref: '#/components/schemas/SeedanceV3ErrorResponse'
          description: '`not_found`：任务不存在，或模型不存在 / 未开放'
        '429':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: rate_limit_exceeded
                      message: Rate limit exceeded. Please try again later.
                      type: rate_limit_error
                      http_status: 429
                      request_id: req_3f9a1c2b7d4e5f60718293a4
                    request_id: req_3f9a1c2b7d4e5f60718293a4
              schema:
                $ref: '#/components/schemas/SeedanceV3ErrorResponse'
          description: '`rate_limit_exceeded`：请求过于频繁，请稍后重试'
        '500':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: api_error
                      message: Internal server error, please retry later
                      type: api_error
                      http_status: 500
                      request_id: req_3f9a1c2b7d4e5f60718293a4
                    request_id: req_3f9a1c2b7d4e5f60718293a4
              schema:
                $ref: '#/components/schemas/SeedanceV3ErrorResponse'
          description: '`api_error`：服务器内部错误，可重试'
        '503':
          content:
            application/json:
              examples:
                example:
                  value:
                    error:
                      code: service_unavailable
                      message: Service temporarily unavailable, please retry later
                      type: api_error
                      http_status: 503
                      request_id: req_3f9a1c2b7d4e5f60718293a4
                    request_id: req_3f9a1c2b7d4e5f60718293a4
              schema:
                $ref: '#/components/schemas/SeedanceV3ErrorResponse'
          description: '`service_unavailable`：服务暂时不可用（502 / 503 / 504），可重试'
components:
  schemas:
    SeedanceV3CreateTaskRequest:
      additionalProperties: false
      description: '只接受下列字段，其他字段返回 400 `unsupported parameter: xxx`。'
      properties:
        model:
          default: seedance-2.5-flash
          description: '**必填**，固定为 `seedance-2.5-flash`。账号未开通该模型时返回 404。'
          enum:
            - seedance-2.5-flash
          examples:
            - seedance-2.5-flash
          type: string
        content:
          description: >-
            **必填**。至少 1 个 `text` 提示词，可附带参考图片 / 视频 / 音频。


            - 素材地址：公网 `http(s)` 地址、`asset://<素材Id>` 或 Base64
            `data:<类型>/<格式>;base64,<数据>`（单个解码后不超过 45 MB，整个请求体不超过 64 MB）

            - 提示词中用「图片1」「视频1」「音频1」按顺序引用素材

            - 本模型上限：图片 10、视频 5、音频 5，超出时任务失败

            - 带参考视频即为视频编辑 / 延长


            缺少 `content` 或没有 `text` 项返回 400。
          items:
            discriminator:
              mapping:
                audio_url: '#/components/schemas/SeedanceV3AudioContent'
                image_url: '#/components/schemas/SeedanceV3ImageContent'
                text: '#/components/schemas/SeedanceV3TextContent'
                video_url: '#/components/schemas/SeedanceV3VideoContent'
              propertyName: type
            oneOf:
              - $ref: '#/components/schemas/SeedanceV3TextContent'
              - $ref: '#/components/schemas/SeedanceV3ImageContent'
              - $ref: '#/components/schemas/SeedanceV3VideoContent'
              - $ref: '#/components/schemas/SeedanceV3AudioContent'
          minItems: 1
          type: array
        ratio:
          default: adaptive
          description: |-
            输出宽高比，默认 `adaptive`。有首帧 / 尾帧图片时跟随图片比例。

            **可选值：**
            - `adaptive`：自适应（默认）：有参考图片 / 视频时按素材比例输出，纯文本时由模型选择合适的比例
            - `16:9`：横屏宽屏，适合电脑、电视与大多数视频平台
            - `9:16`：竖屏，适合短视频与手机全屏播放
            - `1:1`：方形，适合社交媒体信息流与头像类内容
            - `4:3`：传统横屏比例
            - `3:4`：竖版比例，适合人像与商品展示
            - `21:9`：超宽银幕，电影感画面
          enum:
            - adaptive
            - '16:9'
            - '9:16'
            - '1:1'
            - '4:3'
            - '3:4'
            - '21:9'
          type: string
        duration:
          default: -1
          description: >-
            视频时长（秒），不传时为 `-1`（智能时长）。


            - `4` ~ `30` 的整数：生成指定秒数

            - `-1`：智能时长，由模型在 4 ~ 30 秒内自选，按实际用量计费，实际时长见查询结果的 `duration`

            - 小数、字符串或范围外的值：400 `duration must be an integer from 4 to 30
            seconds, or -1 (smart duration)`
          enum:
            - -1
            - 4
            - 5
            - 6
            - 7
            - 8
            - 9
            - 10
            - 11
            - 12
            - 13
            - 14
            - 15
            - 16
            - 17
            - 18
            - 19
            - 20
            - 21
            - 22
            - 23
            - 24
            - 25
            - 26
            - 27
            - 28
            - 29
            - 30
          format: int64
          type: integer
        resolution:
          default: 720p
          description: >-
            输出分辨率，默认 `720p`，本模型支持 `480p` / `720p`。分辨率越高，生成耗时与费用越高。其他值返回 400
            `resolution must be one of: 480p, 720p`。


            **可选值：**

            - `480p`：标清，生成最快、费用最低，适合预览与快速试错

            - `720p`：高清（默认），画质与速度均衡
          enum:
            - 480p
            - 720p
          type: string
        generate_audio:
          default: true
          description: 是否生成音频（音效、配乐、人声），默认 `true`；`false` 输出无声视频。
          type: boolean
        output_format:
          description: |-
            输出格式，默认 `mp4`。

            **可选值：**
            - `mp4`：MP4（默认），兼容性最好
            - `mov`：QuickTime MOV，便于导入剪辑软件
          enum:
            - mp4
            - mov
          type: string
        watermark:
          default: false
          description: 是否加水印，默认 `false`。
          type: boolean
        seed:
          description: 随机种子。相同种子和参数通常得到相近结果，便于复现；不保证完全一致。
          format: int64
          type: integer
        return_last_frame:
          description: 是否返回尾帧。`true` 时成功后在 `content.last_frame_url` 返回最后一帧，可作下一段的首帧。
          type: boolean
        callback_url:
          description: 任务结束后的回调地址（`http(s)`）。详见 [任务完成回调](/webhooks/task-callback)。
          format: uri
          type: string
        tools:
          description: '工具列表。目前只支持联网搜索：`[{"type": "web_search"}]`。'
          items:
            $ref: '#/components/schemas/SeedanceV3Tool'
          type: array
        priority:
          description: 任务优先级（整数），由模型侧调度。
          format: int64
          type: integer
        service_tier:
          description: 服务档位，由模型侧决定。
          type: string
        execution_expires_after:
          description: 执行超时（秒），超时未完成的任务可能被终止。
          format: int64
          type: integer
        safety_identifier:
          description: 终端用户标识，用于内容安全审核。建议传哈希后的用户 ID，不要传明文个人信息。
          type: string
        omni_reference_task_type:
          description: >-
            参考任务类型，不传时按 `content` 中的素材自动判定。`edit` / `extend` 须在 `content`
            中带参考视频。取值区分大小写，其他值返回 400 `omni_reference_task_type must be one of:
            auto, reference, edit, extend`。


            **可选值：**

            - `auto`：自动：按 `content` 中的素材判定

            - `reference`：参考生成：按参考素材生成新视频

            - `edit`：视频编辑：修改参考视频的画面内容，须带参考视频

            - `extend`：视频延长：延续参考视频继续生成，须带参考视频
          enum:
            - auto
            - reference
            - edit
            - extend
          type: string
      required:
        - model
        - content
      type: object
    SeedanceV3CreateTaskResponse:
      additionalProperties: false
      description: 创建成功的响应。
      properties:
        id:
          description: 任务 ID，以 `task_` 开头。用它调用「查询任务」获取状态与结果，回调体中的 `taskId` 也是该值。
          examples:
            - task_8c1d2e3f4a5b6c7d8e9f0a1b
          type: string
        request_id:
          description: 本次请求 ID（`req_` 开头），与响应头 `X-Request-Id` 相同。排查问题时请提供该值与任务 `id`。
          examples:
            - req_3f9a1c2b7d4e5f60718293a4
          type: string
      required:
        - id
        - request_id
      type: object
    SeedanceV3ErrorResponse:
      additionalProperties: false
      description: >-
        错误响应。建议先按 HTTP 状态码分支（可重试 / 需改参数 / 需充值），再用 `error.code` 与 `error.param`
        细分。
      properties:
        error:
          $ref: '#/components/schemas/SeedanceV3ErrorBody'
          description: 错误对象。
        request_id:
          description: 本次请求 ID（`req_` 开头），与响应头 `X-Request-Id` 相同。排查问题时请提供该值与任务 `id`。
          examples:
            - req_3f9a1c2b7d4e5f60718293a4
          type: string
      required:
        - error
        - request_id
      type: object
    SeedanceV3AudioContent:
      additionalProperties: false
      description: 参考音频，例如配乐、旁白或节奏参考。最多 3 个；wav / mp3，时长 2 ~ 15 秒，单个最大 15 MB。
      properties:
        type:
          description: 内容类型，固定为 `audio_url`。
          enum:
            - audio_url
          type: string
        audio_url:
          $ref: '#/components/schemas/SeedanceV3MediaURL'
          description: 音频地址对象。
        role:
          description: 固定为 `reference_audio`（参考音频），可省略；其他值返回 400。
          enum:
            - reference_audio
          type: string
      required:
        - type
        - audio_url
      title: 音频
      type: object
    SeedanceV3ImageContent:
      additionalProperties: false
      description: >-
        参考图片。最多 9 张；支持 jpeg / png / webp / bmp / tiff / gif，宽高比 0.4 ~ 2.5，边长 300
        ~ 6000 px，单张最大 30 MB。
      properties:
        type:
          description: 内容类型，固定为 `image_url`。
          enum:
            - image_url
          type: string
        image_url:
          $ref: '#/components/schemas/SeedanceV3MediaURL'
          description: 图片地址对象。
        role:
          description: >-
            图片在生成中的作用。取值区分大小写，其他值返回 400 `content[n].role must be one of:
            reference_image, first_frame, last_frame`。


            **可选值：**

            - `reference_image`：参考图：提取其中的主体、风格或场景，可传多张，在提示词中用「图片1」「图片2」引用

            - `first_frame`：首帧：视频从这张图开始

            - `last_frame`：尾帧：视频在这张图结束，通常与 `first_frame` 搭配实现两图之间的过渡
          enum:
            - reference_image
            - first_frame
            - last_frame
          type: string
      required:
        - type
        - image_url
      title: 图片
      type: object
    SeedanceV3TextContent:
      additionalProperties: false
      description: 文本提示词。content 中至少要有一个。
      properties:
        type:
          description: 内容类型，固定为 `text`。
          enum:
            - text
          type: string
        text:
          description: >-
            视频描述提示词，去除首尾空白后长度 3 ~ 20000 个字符，否则返回 400 `prompt text must be 3 to
            20000 characters`。


            建议写法：主体 + 动作，背景 + 动作，镜头 +
            运动（推进、拉远、环绕等）；用「图片1」「视频1」「音频1」引用参考素材，不要在提示词里写素材 Id。
          maxLength: 20000
          minLength: 3
          type: string
      required:
        - type
        - text
      title: 文本
      type: object
    SeedanceV3VideoContent:
      additionalProperties: false
      description: >-
        参考视频，用于视频编辑或延长。最多 3 个；mp4 / mov，480p / 720p，时长 2 ~ 15 秒，24 ~ 60 FPS，单个最大
        50 MB。
      properties:
        type:
          description: 内容类型，固定为 `video_url`。
          enum:
            - video_url
          type: string
        video_url:
          $ref: '#/components/schemas/SeedanceV3MediaURL'
          description: 视频地址对象。
        role:
          description: 固定为 `reference_video`（参考视频），可省略；其他值返回 400。
          enum:
            - reference_video
          type: string
      required:
        - type
        - video_url
      title: 视频
      type: object
    SeedanceV3Tool:
      additionalProperties: false
      description: 工具。
      properties:
        type:
          description: 工具类型，当前仅支持 `web_search`（联网搜索）。
          enum:
            - web_search
          type: string
      required:
        - type
      type: object
    SeedanceV3ErrorBody:
      additionalProperties: false
      description: 错误对象。
      properties:
        code:
          description: >-
            错误码：`invalid_parameter`（参数校验失败）、`invalid_request`、`unauthorized`、`insufficient_balance`、`forbidden`、`not_found`、`rate_limit_exceeded`、`api_error`、`service_unavailable`。
          examples:
            - invalid_parameter
          type: string
        message:
          description: 可读的错误描述，可直接展示给用户。
          type: string
        type:
          description: >-
            错误类别：`invalid_request_error`、`authentication_error`、`insufficient_balance_error`、`permission_error`、`rate_limit_error`、`api_error`。
          examples:
            - invalid_request_error
          type: string
        http_status:
          description: 与响应 HTTP 状态码相同。
          examples:
            - 400
          format: int64
          type: integer
        request_id:
          description: 本次请求 ID，与响应头 `X-Request-Id` 相同，排查问题时请提供。
          examples:
            - req_3f9a1c2b7d4e5f60718293a4
          type: string
        param:
          description: 出错的请求字段，仅参数校验失败时返回，例如 `duration`、`content[1]`。
          examples:
            - duration
          type: string
      required:
        - code
        - message
        - type
        - http_status
        - request_id
      type: object
    SeedanceV3MediaURL:
      additionalProperties: false
      description: 素材地址。
      properties:
        url:
          description: >-
            素材地址，**必填**，三选一：


            - 可公网访问的 `http` / `https` 地址（不能需要鉴权或仅内网可达）

            - 素材库引用 `asset://<素材Id>`：素材须属于当前账号且状态为 `Active`；未就绪、不存在或已删除时返回
            400，不扣费

            - Base64 内联数据 `data:<类型>/<格式>;base64,<数据>`，类型须与条目一致（`image_url` 用
            `image`、`video_url` 用 `video`、`audio_url` 用 `audio`），例如
            `data:image/png;base64,iVBORw0...`；解码后单个不超过 45 MB（整个请求体不超过 64
            MB），数据无效返回 400 `content[n].image_url.url is not valid base64
            data`。网关会先转存为 URL 再提交，建议较大的视频、音频直接传 URL


            其他协议返回 400 `content[n].image_url.url must be an http/https URL,
            asset://<asset Id> or data:image/<format>;base64,<data>`。
          examples:
            - https://example.com/portrait.jpg
          type: string
      required:
        - url
      type: object
  securitySchemes:
    bearerAuth:
      description: >-
        在请求头携带 `Authorization: Bearer <API Key>`。API Key 在 DreamTo
        控制台创建，同一账号下的多个 Key 共享素材库。
      scheme: bearer
      type: http

````

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