> ## 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.

# 创建视频生成任务

> 创建异步视频生成任务：文生视频、图生视频（首帧 / 首尾帧）、全能参考生视频（图片 / 视频 / 音频 / 文档 / 网页）、视频编辑与延长。请求头必须带 `X-DashScope-Async: enable`。成功返回 `task_id`，再调用查询任务获取结果。参数错误返回 400，不建任务、不扣费；任务失败不扣费。



## OpenAPI

````yaml /openapi/zh/wan-3-0.json post /api/v1/services/aigc/video-generation/video-synthesis
openapi: 3.1.0
info:
  description: >-
    万相 Wan 3.0 视频生成：创建文生视频、图生视频（首帧 /
    首尾帧）、全能参考生视频、视频编辑与延长任务，并查询任务结果。请求与响应和阿里云百炼官方 DashScope 协议一致。
  title: 万相 Wan 3.0 视频生成 API
  version: v1
servers:
  - url: https://api.dreamto.ai
security:
  - bearerAuth: []
tags:
  - name: Wan 3.0
paths:
  /api/v1/services/aigc/video-generation/video-synthesis:
    post:
      tags:
        - Wan 3.0
      summary: 创建视频生成任务
      description: >-
        创建异步视频生成任务：文生视频、图生视频（首帧 / 首尾帧）、全能参考生视频（图片 / 视频 / 音频 / 文档 /
        网页）、视频编辑与延长。请求头必须带 `X-DashScope-Async: enable`。成功返回
        `task_id`，再调用查询任务获取结果。参数错误返回 400，不建任务、不扣费；任务失败不扣费。
      operationId: wanCreateVideoSynthesis
      parameters:
        - description: 异步调用开关，必须为 `enable`；缺少时返回 403 `AccessDenied`。
          example: enable
          in: header
          name: X-DashScope-Async
          required: true
          schema:
            enum:
              - enable
            examples:
              - enable
            type: string
      requestBody:
        content:
          application/json:
            examples:
              文生视频:
                description: 只用提示词生成。
                summary: 文生视频
                value:
                  model: wan3.0-video
                  input:
                    prompt: 清晨的雨后街道，一只红色纸船顺着积水漂流，特写镜头，柔和晨光。
                  parameters:
                    resolution: 720P
                    ratio: '16:9'
                    duration: 5
              图生视频（首帧）:
                description: 图片严格作为视频第一帧。
                summary: 图生视频（首帧）
                value:
                  model: wan3.0-video
                  input:
                    prompt: 镜头缓慢推近，热气从拉面碗里升起。
                    media:
                      - type: first_frame
                        url: https://your-cdn.example.com/first-frame.jpg
                  parameters:
                    resolution: 1080P
                    duration: 5
              首尾帧:
                description: 从首帧自然过渡到尾帧。首尾帧模式不支持音频输入。
                summary: 首尾帧
                value:
                  model: wan3.0-video
                  input:
                    prompt: 人物从窗边走到门口，镜头跟随。
                    media:
                      - type: first_frame
                        url: https://your-cdn.example.com/first-frame.jpg
                      - type: last_frame
                        url: https://your-cdn.example.com/last-frame.jpg
                  parameters:
                    resolution: 720P
                    duration: 6
              全能参考（图 + 视频 + 音频）:
                description: 提示词中用「图1」「视频1」「音频1」指代素材。
                summary: 全能参考（图 + 视频 + 音频）
                value:
                  model: wan3.0-video
                  input:
                    prompt: 图1中的人物站在视频1的场景里，用音频1的声音说：欢迎来到未来。
                    media:
                      - type: reference_image
                        url: https://your-cdn.example.com/person.png
                      - type: reference_video
                        url: https://your-cdn.example.com/scene.mp4
                      - type: reference_audio
                        url: https://your-cdn.example.com/voice.mp3
                  parameters:
                    resolution: 1080P
                    ratio: '16:9'
                    duration: 8
              视频延长:
                description: '`ratio` 须为 `adaptive`，提示词写明延长意图；输入视频时长计入计费时长。'
                summary: 视频延长
                value:
                  model: wan3.0-video
                  input:
                    prompt: 延长视频：纸船继续向前漂流，最后漂出画面。
                    media:
                      - type: reference_video
                        url: https://your-cdn.example.com/source.mp4
                  parameters:
                    resolution: 720P
                    ratio: adaptive
                    duration: 5
              文档生成视频:
                description: '`file` 可与参考图组合；`prompt_extend` 必须为 `true`。'
                summary: 文档生成视频
                value:
                  model: wan3.0-video
                  input:
                    prompt: 根据文档制作一段 15 秒的产品介绍视频，产品外观参考图1。
                    media:
                      - type: file
                        url: https://your-cdn.example.com/product-brief.pdf
                      - type: reference_image
                        url: https://your-cdn.example.com/product.png
                  parameters:
                    resolution: 1080P
                    ratio: '9:16'
                    duration: 15
                    prompt_extend: true
              高速版 · 智能时长:
                description: '`wan3.0-video-prime` 能力相同、更快；`duration` 为 `-1` 时由模型决定时长。'
                summary: 高速版 · 智能时长
                value:
                  model: wan3.0-video-prime
                  input:
                    prompt: 一盏纸灯笼缓缓升入星空，镜头慢慢上摇。
                  parameters:
                    resolution: 480P
                    ratio: '9:16'
                    duration: -1
                    audio: true
                    seed: 42
                    watermark: false
            schema:
              $ref: '#/components/schemas/WanVideoSynthesisRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              examples:
                example:
                  value:
                    output:
                      task_status: PENDING
                      task_id: 0385dc79-5ff8-4d82-bcb6-bc5ae0ed7a4f
                    request_id: req_3f9a1c2b7d4e5f60718293a4
              schema:
                $ref: '#/components/schemas/WanVideoCreateResponse'
          description: 任务已创建。
          headers:
            X-Request-Id:
              description: 请求 Id，联系支持时请提供。
              schema:
                type: string
        '400':
          content:
            application/json:
              examples:
                example:
                  value:
                    request_id: req_3f9a1c2b7d4e5f60718293a4
                    code: InvalidParameter
                    message: >-
                      Input should be '1080P', '720P' or '480P':
                      parameters.resolution
              schema:
                $ref: '#/components/schemas/WanVideoErrorResponse'
          description: 参数错误（`InvalidParameter`）。
        '401':
          content:
            application/json:
              examples:
                example:
                  value:
                    request_id: req_3f9a1c2b7d4e5f60718293a4
                    code: InvalidApiKey
                    message: Invalid API-key provided.
              schema:
                $ref: '#/components/schemas/WanVideoErrorResponse'
          description: 缺少或无效的 API Key（`InvalidApiKey`）。
        '402':
          content:
            application/json:
              examples:
                example:
                  value:
                    request_id: req_3f9a1c2b7d4e5f60718293a4
                    code: Arrearage
                    message: >-
                      Access denied, please make sure your account is in good
                      standing.
              schema:
                $ref: '#/components/schemas/WanVideoErrorResponse'
          description: 账户余额不足（`Arrearage`）。
        '403':
          content:
            application/json:
              examples:
                example:
                  value:
                    request_id: req_3f9a1c2b7d4e5f60718293a4
                    code: AccessDenied
                    message: current user api does not support synchronous calls
              schema:
                $ref: '#/components/schemas/WanVideoErrorResponse'
          description: '缺少 `X-DashScope-Async: enable` 请求头，或无权使用该模型（`AccessDenied`）。'
        '429':
          content:
            application/json:
              examples:
                example:
                  value:
                    request_id: req_3f9a1c2b7d4e5f60718293a4
                    code: Throttling.RateQuota
                    message: Requests rate limit exceeded, please try again later.
              schema:
                $ref: '#/components/schemas/WanVideoErrorResponse'
          description: 触发限流，稍后重试（`Throttling.RateQuota`）。
        '500':
          content:
            application/json:
              examples:
                example:
                  value:
                    request_id: req_3f9a1c2b7d4e5f60718293a4
                    code: InternalError
                    message: >-
                      An internal error has occured, please try again later or
                      contact service support.
              schema:
                $ref: '#/components/schemas/WanVideoErrorResponse'
          description: 服务端错误，稍后重试（`InternalError`）。
components:
  schemas:
    WanVideoSynthesisRequest:
      additionalProperties: false
      description: 创建视频生成任务的请求体。
      properties:
        model:
          default: wan3.0-video
          description: |-
            模型名称：`wan3.0-video`（标准版）或 `wan3.0-video-prime`（高速版，能力相同、端到端更快）。

            **可选值：**
            - `wan3.0-video`：万相 3.0 标准版。
            - `wan3.0-video-prime`：万相 3.0 高速版：能力与标准版相同，端到端更快。
          enum:
            - wan3.0-video
            - wan3.0-video-prime
          type: string
        input:
          $ref: '#/components/schemas/WanVideoInput'
          description: 输入的提示词与素材。
        parameters:
          $ref: '#/components/schemas/WanVideoParameters'
          description: 生成参数，均可省略。
      required:
        - model
        - input
      type: object
    WanVideoCreateResponse:
      additionalProperties: false
      description: 创建任务的响应。
      properties:
        output:
          $ref: '#/components/schemas/WanVideoCreateOutput'
          description: 任务信息。
        request_id:
          description: 请求 Id。
          type: string
      required:
        - output
        - request_id
      type: object
    WanVideoErrorResponse:
      additionalProperties: false
      description: 错误响应。
      properties:
        request_id:
          description: 请求 Id，联系支持时请提供。
          type: string
        code:
          description: 错误码，如 `InvalidParameter`、`InvalidApiKey`。
          type: string
        message:
          description: 错误信息（英文）。
          type: string
      required:
        - request_id
        - code
        - message
      type: object
    WanVideoInput:
      additionalProperties: false
      description: 输入内容。`prompt` 与 `media` 至少填一项。
      properties:
        prompt:
          description: >-
            文本提示词，支持中英文，最多 20000 个字符，超出部分自动截断。全能参考模式下可用「图1」「视频1」「音频1」等指代 `media`
            中对应顺序的素材。
          type: string
        media:
          description: >-
            输入素材数组，每项包含 `type` 和 `url`。组合规则：不传为文生视频；`first_frame` / `last_frame`
            只能单独或一起使用，不能与其他类型混用（首尾帧模式不支持音频）；`reference_image` /
            `reference_video` / `reference_audio` 可自由组合；`file` 与 `link`
            二选一，可与参考素材组合；视频编辑与延长须包含 `reference_video`。
          items:
            $ref: '#/components/schemas/WanVideoMedia'
          type: array
      type: object
    WanVideoParameters:
      additionalProperties: false
      description: 生成参数。
      properties:
        resolution:
          default: 1080P
          description: |-
            输出分辨率档位，默认 `1080P`；决定计费单价。

            **可选值：**
            - `1080P`：1080P。
            - `720P`：720P。
            - `480P`：480P。
          enum:
            - 1080P
            - 720P
            - 480P
          type: string
        ratio:
          default: adaptive
          description: |-
            画面宽高比，默认 `adaptive`。视频延长时须为 `adaptive`。

            **可选值：**
            - `adaptive`：自适应：按输入素材或由模型决定。
            - `21:9`：21:9 超宽屏。
            - `16:9`：16:9 横屏。
            - `4:3`：4:3 横屏。
            - `1:1`：1:1 方形。
            - `3:4`：3:4 竖屏。
            - `9:16`：9:16 竖屏。
          enum:
            - adaptive
            - '21:9'
            - '16:9'
            - '4:3'
            - '1:1'
            - '3:4'
            - '9:16'
          type: string
        duration:
          default: 5
          description: >-
            输出视频时长（秒），默认 `5`。无视频输入时 `2` ~ `30`；有视频输入时，输入视频时长加输出时长不超过 30 秒；传 `-1`
            由模型自动决定时长。
          format: int64
          maximum: 30
          minimum: -1
          type: integer
        audio:
          default: true
          description: 是否生成音频，默认 `true`。开关同价。
          type: boolean
        seed:
          description: 随机种子，`-1` 或 `0` ~ `2147483647`；不传则随机。相同种子也不保证结果完全一致。
          format: int64
          maximum: 2147483647
          minimum: -1
          type: integer
        prompt_extend:
          default: true
          description: 是否开启提示词智能改写，默认 `true`，会增加耗时。使用 `file` 或 `link` 时必须为 `true`。
          type: boolean
        watermark:
          default: false
          description: 是否添加水印，默认 `false`。
          type: boolean
      type: object
    WanVideoCreateOutput:
      additionalProperties: false
      description: 新建任务。
      properties:
        task_status:
          description: |-
            任务状态，新建时为 `PENDING`。

            **可选值：**
            - `PENDING`：排队中。
            - `RUNNING`：生成中。
            - `SUCCEEDED`：成功，从 `video_url` 下载视频。
            - `FAILED`：失败，从 `code` / `message` 读取原因，不扣费。
            - `CANCELED`：已取消，不扣费。
            - `UNKNOWN`：任务不存在、不属于当前账号，或已超过 24 小时查询有效期。
          enum:
            - PENDING
            - RUNNING
            - SUCCEEDED
            - FAILED
            - CANCELED
            - UNKNOWN
          type: string
        task_id:
          description: 任务 Id，用于查询任务，24 小时内有效。
          type: string
      required:
        - task_status
        - task_id
      type: object
    WanVideoMedia:
      additionalProperties: false
      description: 一个输入素材。
      properties:
        type:
          description: >-
            素材类型。


            **可选值：**

            - `first_frame`：首帧图片，严格作为视频第一帧，最多 1 张。

            - `last_frame`：尾帧图片，严格作为视频最后一帧，最多 1 张。

            - `reference_image`：参考图片，最多 10 张。JPEG / JPG / PNG（不含透明通道）/ BMP /
            WEBP，单边 240 ~ 8000 像素，宽高比 ≤ 8:1，≤ 20 MB。

            - `reference_video`：参考视频，最多 5 段。MP4 / MOV，每段 1 ~ 15 秒且总时长 ≤ 15 秒，≥
            16 fps，单边 240 ~ 4096 像素，≤ 100 MB。

            - `reference_audio`：参考音频，最多 5 段。WAV / MP3，每段 1 ~ 15 秒且总时长 ≤ 15 秒，≤
            15 MB。

            - `file`：文档，最多 1
            个：docx、doc、xlsx、xls、pptx、ppt、pdf、txt、key、pages、numbers、md，≤ 100
            MB（部分格式 ≤ 50 页）。不能与 `link` 同时使用。

            - `link`：网页链接，最多 1 个，仅支持无需登录的公开网页。不能与 `file` 同时使用。
          enum:
            - first_frame
            - last_frame
            - reference_image
            - reference_video
            - reference_audio
            - file
            - link
          type: string
        url:
          description: >-
            素材地址：公网可访问的 `http(s)` 地址；图片（`first_frame` / `last_frame` /
            `reference_image`）也可传 Base64 数据 `data:{MIME};base64,{数据}`。
          minLength: 1
          type: string
      required:
        - type
        - url
      type: object
  securitySchemes:
    bearerAuth:
      description: '在请求头 `Authorization: Bearer <API Key>` 中携带 DreamTo API Key。'
      scheme: bearer
      type: http

````

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