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

# 万相2.7-图生视频

> 提交一个异步的阿里云万相 `wan2.7-i2v` 图生视频任务。通过 `input.media` 指定首帧图像、尾帧图像、驱动音频或首帧视频片段。

提交任务后，请通过 `GET /ali/api/v1/tasks/{task_id}` 查询任务状态。



## OpenAPI

````yaml api-reference/zh-Hans/zmodelVideo/ali/api/wan2.7-i2v.json POST /ali/api/v1/services/aigc/video-generation/video-synthesis
openapi: 3.0.1
info:
  title: 万相2.7-图生视频
  version: 1.0.0
  description: >-
    阿里云万相 `wan2.7-i2v` 图生视频能力文档。平台统一接口端点为
    `/ali/api/v1/services/aigc/video-generation/video-synthesis`，用于创建异步视频生成任务。
  license:
    name: Project License
    url: https://github.com/QuantumNous/new-api/blob/main/LICENSE
servers:
  - url: https://api.powertokens.ai
    description: baze平台 API 服务端点
security: []
tags:
  - name: Wan 2.7 Video
    description: 阿里云万相 wan2.7-i2v 图生视频能力
paths:
  /ali/api/v1/services/aigc/video-generation/video-synthesis:
    post:
      tags:
        - Wan 2.7 Video
      summary: 创建 wan2.7-i2v 图生视频任务
      description: >-
        提交一个异步的阿里云万相 `wan2.7-i2v` 图生视频任务。通过 `input.media`
        指定首帧图像、尾帧图像、驱动音频或首帧视频片段。


        提交任务后，请通过 `GET /ali/api/v1/tasks/{task_id}` 查询任务状态。
      operationId: aliWan27I2VCreate
      parameters:
        - name: Content-Type
          in: header
          required: true
          description: 请求内容类型。此参数必须设置为 application/json。
          schema:
            type: string
            enum:
              - application/json
        - name: X-DashScope-Async
          in: header
          required: true
          description: 异步处理配置参数。HTTP请求只支持异步，必须设置为 enable。
          schema:
            type: string
            enum:
              - enable
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Wan27I2VRequest'
            examples:
              首帧生视频:
                summary: 首帧生视频
                value:
                  model: wan2.7-i2v-2026-04-25
                  input:
                    prompt: >-
                      一幅都市奇幻艺术的场景。一个充满动感的涂鸦艺术角色。一个由喷漆所画成的少年，正从一面混凝土墙上活过来。他一边用极快的语速演唱一首英文rap，一边摆着一个经典的、充满活力的说唱歌手姿势。场景设定在夜晚一个充满都市感的铁路桥下。灯光来自一盏孤零零的街灯，营造出电影般的氛围，充满高能量和惊人的细节。视频的音频部分完全由rap构成，没有其他对话或杂音。
                    media:
                      - type: first_frame
                        url: >-
                          https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png
                      - type: driving_audio
                        url: >-
                          https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3
                  parameters:
                    resolution: 720P
                    duration: 10
                    prompt_extend: true
                    watermark: true
              首尾帧生视频:
                summary: 首尾帧生视频
                value:
                  model: wan2.7-i2v-2026-04-25
                  input:
                    prompt: 写实风格,一只小黑猫好奇地仰望天空,镜头从平视角度逐渐升高,最后以俯视角度捕捉到它好奇的眼神。
                    media:
                      - type: first_frame
                        url: >-
                          https://wanx.alicdn.com/material/20250318/first_frame.png
                      - type: last_frame
                        url: >-
                          https://wanx.alicdn.com/material/20250318/last_frame.png
                  parameters:
                    resolution: 720P
                    duration: 10
                    prompt_extend: false
                    watermark: true
              视频续写:
                summary: 视频续写
                value:
                  model: wan2.7-i2v-2026-04-25
                  input:
                    prompt: 一个女孩对镜自拍，自拍结束后背着书包出门
                    media:
                      - type: first_clip
                        url: >-
                          https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/hfugmr/wan-r2v-role1.mp4
                  parameters:
                    resolution: 720P
                    duration: 10
                    prompt_extend: true
                    watermark: true
      responses:
        '200':
          description: 提交成功，返回视频任务对象。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoTaskResponse'
              example:
                output:
                  task_status: PENDING
                  task_id: 0385dc79-5ff8-4d82-bcb6-xxxxxx
                request_id: 4909100c-7b5a-9f92-bfe5-xxxxxx
        '400':
          description: 请求参数不合法。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 鉴权失败，例如未提供令牌或令牌无效。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: 触发速率限制或账户额度不足。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: 服务端处理请求时发生内部错误。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    Wan27I2VRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          enum:
            - wan2.7-i2v
          description: 模型名称。可选值：`wan2.7-i2v`。
        input:
          $ref: '#/components/schemas/Wan27I2VInput'
        parameters:
          $ref: '#/components/schemas/Wan27I2VParameters'
    VideoTaskResponse:
      type: object
      properties:
        output:
          type: object
          properties:
            task_id:
              type: string
              description: 任务ID。查询有效期24小时。
            task_status:
              type: string
              description: |-
                任务状态。

                **枚举值：**
                - `PENDING`：任务排队中
                - `RUNNING`：任务处理中
                - `SUCCEEDED`：任务执行成功
                - `FAILED`：任务执行失败
                - `CANCELED`：任务已取消
                - `UNKNOWN`：任务不存在或状态未知
        request_id:
          type: string
          description: 请求唯一标识。可用于请求明细溯源和问题排查。
        code:
          type: string
          description: 请求失败的错误码。请求成功时不会返回此参数。
        message:
          type: string
          description: 请求失败的详细信息。请求成功时不会返回此参数。
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: 错误码。
        message:
          type: string
          description: 错误信息。
        request_id:
          type: string
          description: 请求 ID。
    Wan27I2VInput:
      type: object
      required:
        - media
      properties:
        prompt:
          type: string
          description: >-
            文本提示词。用来描述生成视频中期望包含的元素和视觉特点。支持中英文，长度不超过5000个字符。每个汉字/字母占一个字符，超过部分会自动截断。
          maxLength: 5000
        negative_prompt:
          type: string
          description: >-
            反向提示词，用来描述不希望在视频画面中看到的内容，可以对视频画面进行限制。支持中英文，长度不超过500个字符，超过部分会自动截断。示例值：低分辨率、错误、最差质量、低质量、残缺、多余的手指、比例不良等。
          maxLength: 500
        media:
          type: array
          description: |-
            媒体素材列表，用于指定视频生成所需的参考素材（图像、音频和视频）。数组的每个元素为一个媒体对象，包含 type 与 url 字段。

            素材组合（仅支持以下特定的组合，非法组合将报错）：
            - **首帧生视频**：`first_frame`
            - **首帧+音频**：`first_frame` + `driving_audio`
            - **首尾帧生视频**：`first_frame` + `last_frame`
            - **首尾帧+音频**：`first_frame` + `last_frame` + `driving_audio`
            - **视频续写**：`first_clip`
            - **首段视频+尾帧续写**：`first_clip` + `last_frame`

            每种 type 在 media 数组中最多出现一次（例如：不可同时传入两个 first_frame）。
          items:
            $ref: '#/components/schemas/Wan27I2VMedia'
    Wan27I2VParameters:
      type: object
      properties:
        resolution:
          type: string
          enum:
            - 720P
            - 1080P
          description: >-
            重要：resolution 直接影响费用，请在调用前确认模型价格。


            指定生成的视频分辨率档位，用于控制视频的清晰度（总像素）。模型根据选择的分辨率档位，自动缩放至相近总像素。视频宽高比尽量与输入素材（首帧或首段视频）保持一致。


            可选值：

            - `720P`

            - `1080P`（默认值）
          default: 1080P
        duration:
          type: integer
          description: |-
            重要：duration 直接影响费用，按秒计费，请在调用前确认模型价格。

            生成视频的时长，单位为秒。取值为 [2, 15] 之间的整数。默认值为5。
          minimum: 2
          maximum: 15
          default: 5
        prompt_extend:
          type: boolean
          description: >-
            是否开启 prompt 智能改写。开启后使用大模型对输入 prompt 进行智能改写。对于较短的 prompt
            生成效果提升明显，但会增加耗时。`true`（默认值）：开启智能改写。`false`：不开启智能改写。
          default: true
        watermark:
          type: boolean
          description: 是否添加水印标识，水印位于视频右下角，文案固定为 "AI生成"。`false`（默认值）：不添加水印。`true`：添加水印。
          default: false
        seed:
          type: integer
          description: >-
            随机数种子，取值范围为 [0, 2147483647]。未指定时，系统自动生成随机种子。若需提升生成结果的可复现性，建议固定 seed
            值。请注意，由于模型生成具有概率性，即使使用相同 seed，也不能保证每次生成结果完全一致。
          minimum: 0
          maximum: 2147483647
    Wan27I2VMedia:
      type: object
      required:
        - type
        - url
      properties:
        type:
          type: string
          enum:
            - first_frame
            - last_frame
            - driving_audio
            - first_clip
          description: |-
            媒体素材类型。可选值为：
            - `first_frame`：首帧。
            - `last_frame`：尾帧。
            - `driving_audio`：驱动音频。
            - `first_clip`：首视频片段。

            使用限制：每种 type 在 media 数组中最多出现一次（例如：不可同时传入两个 first_frame）。
        url:
          type: string
          description: |-
            媒体素材URL。素材包括图像、音频和视频。

            **传入图像（type=first_frame或last_frame）**

            首帧或尾帧URL，或 Base64 编码数据。目前支持首帧生视频、首尾帧生视频。

            图像限制：

            - 格式：JPEG、JPG、PNG（不支持透明通道）、BMP、WEBP。
            - 分辨率：宽和高的范围为[240, 8000]像素。
            - 宽高比：1:8～8:1。
            - 文件大小：不超过20MB。

            支持输入的格式：

            公网URL：

            支持 HTTP 或 HTTPS 协议。

            示例值：https://xxx/xxx.png。

            临时URL：

            支持OSS协议，必须通过上传文件获取临时 URL。

            示例值：oss://dashscope-instant/xxx/xxx.png。

            Base64 编码图像后的字符串：

            数据格式：data:{MIME_type};base64,{base64_data}。

            示例值：data:image/png;base64,GDU7MtCZzEbTbmRZ......（示例已截断，仅做演示）。

            Base64编码数据格式

            格式： data:{MIME_type};base64,{base64_data} 。

            {base64_data}：图像文件经过 Base64 编码后的字符串。

            {MIME_type}：图像的媒体类型，需与文件格式对应。

            图像格式与MIME Type对照

            | 图像格式 | MIME Type |
            | --- | --- |
            | JPEG | image/jpeg |
            | JPG | image/jpeg |
            | PNG | image/png |
            | BMP | image/bmp |
            | WEBP | image/webp |
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: '在请求头中传入 `Authorization: Bearer <token>`。'

````