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

# Wan2.7 视频编辑

> - WAN2.7 (wan2.7-video-edit) 模型支持视频编辑模式，可完成**指令编辑**和**视频迁移**任务
- **必须**上传 1 个视频（`video_urls`），可选上传最多 4 张参考图片（`image_urls`）
- 两种使用方式：
  - **纯指令编辑**：仅传 `video_urls` + `prompt`（如修改风格、为人物换衣）
  - **指令 + 参考图编辑**：传 `video_urls` + `image_urls` + `prompt`（如局部替换为参考图中的元素）
- 音频处理：通过 `keep_original_sound` 控制（`true` 保留原声 / `false` 智能处理）
- 异步处理模式，使用返回的任务ID  [进行查询](/cn/api-manual/task-management/get-task-detail)
- 生成的视频链接，有效期为24小时，请尽快保存
- **计费说明**：采用「输入视频时长 + 输出视频时长」联合计费，仅成功生成视频后计费，失败不收费



## OpenAPI

````yaml cn/api-manual/video-series/wan2.7/wan2.7-video-edit.json POST /v1/videos/generations
openapi: 3.1.0
info:
  title: wan2.7-video-edit接口
  description: 使用WAN2.7模型进行视频编辑，支持上传视频并结合参考图片进行编辑
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.evolink.ai
    description: 生产环境
security:
  - bearerAuth: []
paths:
  /v1/videos/generations:
    post:
      tags:
        - 视频生成
      summary: wan2.7-video-edit接口
      description: >-
        - WAN2.7 (wan2.7-video-edit) 模型支持视频编辑模式，可完成**指令编辑**和**视频迁移**任务

        - **必须**上传 1 个视频（`video_urls`），可选上传最多 4 张参考图片（`image_urls`）

        - 两种使用方式：
          - **纯指令编辑**：仅传 `video_urls` + `prompt`（如修改风格、为人物换衣）
          - **指令 + 参考图编辑**：传 `video_urls` + `image_urls` + `prompt`（如局部替换为参考图中的元素）
        - 音频处理：通过 `keep_original_sound` 控制（`true` 保留原声 / `false` 智能处理）

        - 异步处理模式，使用返回的任务ID 
        [进行查询](/cn/api-manual/task-management/get-task-detail)

        - 生成的视频链接，有效期为24小时，请尽快保存

        - **计费说明**：采用「输入视频时长 + 输出视频时长」联合计费，仅成功生成视频后计费，失败不收费
      operationId: createWan27VideoEditGeneration
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Wan27VideoEditRequest'
            examples:
              instruction_edit:
                summary: 纯指令编辑（修改视频风格）
                value:
                  model: wan2.7-video-edit
                  prompt: 将整个画面转换为黏土风格
                  video_urls:
                    - https://example.com/source.mp4
              instruction_with_reference:
                summary: 指令 + 参考图编辑（局部替换）
                value:
                  model: wan2.7-video-edit
                  prompt: 将视频中女孩的衣服替换为图片中的衣服
                  video_urls:
                    - https://example.com/source.mp4
                  image_urls:
                    - https://example.com/clothes.png
      responses:
        '200':
          description: 视频任务创建成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoGenerationResponse'
        '400':
          description: 请求参数错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: invalid_request
                  message: Invalid request parameters
                  type: invalid_request_error
        '401':
          description: 未认证、Token无效或过期
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: unauthorized
                  message: Invalid or expired token
                  type: authentication_error
        '402':
          description: 配额不足、需要充值
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: insufficient_quota
                  message: Insufficient quota. Please top up your account.
                  type: insufficient_quota
        '403':
          description: 无权限访问
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: model_access_denied
                  message: 'Token does not have access to model: wan2.7-video-edit'
                  type: invalid_request_error
        '429':
          description: 请求频率超限
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: rate_limit_exceeded
                  message: Too many requests, please try again later
                  type: rate_limit_error
        '500':
          description: 服务器内部错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: internal_error
                  message: Internal server error
                  type: api_error
components:
  schemas:
    Wan27VideoEditRequest:
      required:
        - model
        - video_urls
      type: object
      properties:
        model:
          type: string
          description: 模型名称，固定为 `wan2.7-video-edit`
          enum:
            - wan2.7-video-edit
          example: wan2.7-video-edit
        prompt:
          type: string
          description: 视频编辑的文本提示词，描述期望的编辑效果。支持中英文，每个汉字/字母占 1 个字符，超过部分会自动截断，最大长度 5000 字符
          maxLength: 5000
          example: 为人物换上酷闪的衣服，再戴参考图里的帽子
        negative_prompt:
          type: string
          description: 负面提示词，描述不希望在视频画面中出现的内容。支持中英文，最大长度 500 字符，超过部分会自动截断
          maxLength: 500
          example: 模糊, 低质量
        video_urls:
          type: array
          items:
            type: string
            format: uri
          description: |-
            待编辑视频 URL 数组。**必须传入且仅 1 个**

            **视频限制：**
            - 格式：mp4、mov
            - 时长：`2 ~ 10` 秒
            - 分辨率：宽和高的范围为 `[240, 4096]` 像素
            - 宽高比：1:8 ～ 8:1
            - 文件大小：不超过 `100MB`
          minItems: 1
          maxItems: 1
          example:
            - https://example.com/source.mp4
        image_urls:
          type: array
          items:
            type: string
            format: uri
          description: |-
            参考图片 URL 数组，最多 4 张。可用于「指令 + 参考图编辑」场景，例如将视频中的服饰、道具替换为参考图中的元素

            **图像限制：**
            - 格式：JPEG、JPG、PNG（不支持透明通道）、BMP、WEBP
            - 分辨率：宽和高的范围为 `[240, 8000]` 像素
            - 宽高比：1:8 ～ 8:1
            - 文件大小：不超过 `20MB`
          maxItems: 4
          example:
            - https://example.com/ref.jpg
        keep_original_sound:
          type: boolean
          description: >-
            视频声音处理方式，默认 `false`


            - `false`：智能模式。模型根据 `prompt`
            内容自动判断——若提示词涉及声音描述，可能重新生成音频；否则可能保留输入视频的原声

            - `true`：强制保留输入视频的原声，不重新生成
          default: false
          example: true
        quality:
          type: string
          description: |-
            视频清晰度，默认为`720p`

            **说明：**
            - `720p`: 标准清晰度，标准价格，此为默认值
            - `1080p`: 高清晰度，价格会提升
          enum:
            - 720p
            - 1080p
          default: 720p
          example: 720p
        aspect_ratio:
          type: string
          description: >-
            视频宽高比（可选）


            **生效逻辑：**

            - 不传：以输入视频的宽高比生成近似比例的视频

            - 传入：按指定 `aspect_ratio` 生成视频


            **不同档位输出分辨率：**


            | 分辨率档位 | 16:9 | 9:16 | 1:1 | 4:3 | 3:4 |

            | --- | --- | --- | --- | --- | --- |

            | 720p | 1280×720 | 720×1280 | 960×960 | 1104×832 | 832×1104 |

            | 1080p | 1920×1080 | 1080×1920 | 1440×1440 | 1648×1248 | 1248×1648
            |
          enum:
            - '16:9'
            - '9:16'
            - '1:1'
            - '4:3'
            - '3:4'
          example: '16:9'
        duration:
          type: number
          description: |-
            视频时长（秒）

            **使用规则：**
            - 默认值为 `0`：沿用输入视频时长，**不进行截断**（仅在希望显式截断视频时才需要配置本字段）
            - 显式指定时范围为 `2 ~ 10`：系统会从原视频的 0 秒起，截取至 `duration` 设置的长度
          minimum: 0
          maximum: 10
          default: 0
          example: 0
        seed:
          type: integer
          description: |-
            随机种子，默认随机

            **说明：**
            - 取值范围：`1` ~ `2147483647`
            - 固定 seed 可在调试 prompt 时降低参数变化的干扰，提升结果可复现性
          minimum: 1
          maximum: 2147483647
          example: 42
        prompt_extend:
          type: boolean
          description: |-
            是否开启prompt智能改写，开启后将使用大模型优化正向提示词，对描述性不足、较为简单的prompt提升效果较明显。

            **注意：** 默认值为 `false`，不传或传 `false` 时不会触发改写，如需开启请显式传 `true`
          default: false
          example: false
        callback_url:
          type: string
          description: |-
            任务完成后的HTTPS回调地址

            **回调时机：**
            - 任务完成（completed）、失败（failed）或取消（cancelled）时触发
            - 在计费确认完成后发送

            **安全限制：**
            - 仅支持HTTPS协议
            - 禁止回调到内网IP地址（127.0.0.1、10.x.x.x、172.16-31.x.x、192.168.x.x等）
            - URL长度不超过`2048`字符

            **回调机制：**
            - 超时时间：`10`秒
            - 失败后最多重试`3`次（会分别在失败的`1`秒/`2`秒/`4`秒后进行重试）
            - 回调响应体格式与任务查询接口返回的格式一致
            - 回调地址若返回2xx状态码视为成功，其他状态码会触发重试
          format: uri
          example: https://your-domain.com/webhooks/video-task-completed
    VideoGenerationResponse:
      type: object
      properties:
        created:
          type: integer
          description: 任务创建时间戳
          example: 1757169743
        id:
          type: string
          description: 任务ID
          example: task-unified-1757169743-7cvnl5zw
        model:
          type: string
          description: 实际使用的模型名称
          example: wan2.7-video-edit
        object:
          type: string
          enum:
            - video.generation.task
          description: 任务的具体类型
        progress:
          type: integer
          description: 任务进度百分比 (0-100)
          minimum: 0
          maximum: 100
          example: 0
        status:
          type: string
          description: 任务状态
          enum:
            - pending
            - processing
            - completed
            - failed
          example: pending
        task_info:
          $ref: '#/components/schemas/VideoTaskInfo'
          description: 视频任务详细信息
        type:
          type: string
          enum:
            - text
            - image
            - audio
            - video
          description: 任务的输出类型
          example: video
        usage:
          $ref: '#/components/schemas/Usage'
          description: 使用量和计费信息
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: 错误代码标识符
            message:
              type: string
              description: 错误描述信息
            type:
              type: string
              description: 错误类型
    VideoTaskInfo:
      type: object
      properties:
        can_cancel:
          type: boolean
          description: 任务是否可以取消
          example: true
        estimated_time:
          type: integer
          description: 预估完成时间（秒）
          minimum: 0
          example: 120
    Usage:
      type: object
      description: 使用量和计费信息
      properties:
        billing_rule:
          type: string
          description: 计费规则
          enum:
            - per_call
            - per_token
            - per_second
          example: per_call
        credits_reserved:
          type: number
          description: 预估消耗积分数
          minimum: 0
          example: 5
        user_group:
          type: string
          description: 用户组类别
          enum:
            - default
            - vip
          example: default
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        ##所有接口均需要使用Bearer Token进行认证##

        **获取 API Key ：**

        访问 [API Key 管理页面](https://evolink.ai/dashboard/keys) 获取您的 API Key

        **使用时在请求头中添加：**
        ```
        Authorization: Bearer YOUR_API_KEY
        ```

````