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

# wan2.7-i2v 视频续写

> 提交一个异步 Ali `wan2.7-i2v` 视频续写任务。

使用 `first_clip` 指定首段视频，可选搭配 `last_frame` 作为尾帧参考。

支持的 `media` 组合：
- `first_clip`
- `first_clip + last_frame`

`prompt` 字段为可选。`size` 仅支持 `720P` 和 `1080P`。`seconds` 仅支持 `2` 到 `15` 的整数字符串。同时支持官方字段 `negative_prompt`、`prompt_extend`、`watermark` 和 `seed`。



## OpenAPI

````yaml api-reference/zh-Hans/zmodelVideo/ali/wan2.7-i2v-video-continuation.json POST /v1/videos
openapi: 3.0.1
info:
  title: Wan 2.7 视频续写
  version: 1.0.0
  description: >-
    Ali `wan2.7-i2v` 视频续写能力文档。统一接口端点为 `/v1/videos`。


    本文档覆盖视频续写场景，使用顶层 `media` 数组来表达上游厂商新的 `input.media` 协议。


    本场景支持的 `media.type` 取值为 `first_clip` 和 `last_frame`。


    支持的 `media` 组合：

    - `first_clip`

    - `first_clip + last_frame`


    `prompt` 字段为可选。`size` 仅支持 `720P` 和 `1080P`。`seconds` 仅支持 `2` 到 `15`
    的整数字符串。同时支持官方字段 `negative_prompt`、`prompt_extend`、`watermark` 和 `seed`。
  license:
    name: 项目许可证
    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 视频
    description: Ali wan2.7-i2v 视频续写能力
paths:
  /v1/videos:
    post:
      tags:
        - Wan 2.7 视频
      summary: 创建 Wan 2.7 视频续写任务
      description: >-
        提交一个异步 Ali `wan2.7-i2v` 视频续写任务。


        使用 `first_clip` 指定首段视频，可选搭配 `last_frame` 作为尾帧参考。


        支持的 `media` 组合：

        - `first_clip`

        - `first_clip + last_frame`


        `prompt` 字段为可选。`size` 仅支持 `720P` 和 `1080P`。`seconds` 仅支持 `2` 到 `15`
        的整数字符串。同时支持官方字段 `negative_prompt`、`prompt_extend`、`watermark` 和 `seed`。
      operationId: aliWan27I2VVideoContinuation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Wan27VideoContinuationRequest'
            examples:
              first_clip_only:
                summary: 仅首段视频
                value:
                  model: wan2.7-i2v
                  prompt: 角色继续自然地向前行走，保持与输入片段相同的风格。
                  media:
                    - type: first_clip
                      url: https://example.com/assets/input.mp4
                  seconds: '5'
                  size: 1080P
              first_clip_with_last_frame:
                summary: 首段视频 + 尾帧
                value:
                  model: wan2.7-i2v
                  prompt: 角色从行走自然过渡到站立姿势。
                  media:
                    - type: first_clip
                      url: https://example.com/assets/input.mp4
                    - type: last_frame
                      url: https://example.com/assets/end-pose.png
                  seconds: '5'
                  size: 1080P
      responses:
        '200':
          description: 提交成功。返回一个 OpenAI 兼容的视频任务对象。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoTaskResponse'
        '400':
          description: 请求参数无效，例如不支持的 `media` 组合，或 `size` / `seconds` 超出支持范围。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_request:
                  summary: 非法请求
                  value:
                    error:
                      message: unsupported wan2.7-i2v media combination
                      type: invalid_request_error
                      code: invalid_request
        '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:
    Wan27VideoContinuationRequest:
      type: object
      required:
        - model
        - media
      properties:
        model:
          type: string
          enum:
            - wan2.7-i2v
          description: 模型名称。可用值：`wan2.7-i2v`。
        prompt:
          type: string
          description: >-
            描述期望视频内容与视觉特征的文本提示词。支持中英文，最多 5000 个字符（每个汉字、字母、数字、标点均计为 1
            个字符）。超出部分会自动截断。
        size:
          type: string
          enum:
            - 720P
            - 1080P
          description: |-
            指定输出分辨率档位，用于控制视频清晰度（总像素数）。

            模型会根据所选分辨率档位自动缩放到相近的总像素数。视频宽高比会尽量保持与输入素材（首帧或首段视频）一致。
          default: 1080P
        seconds:
          type: string
          description: 视频时长（字符串形式）。支持 `2` 到 `15` 的整数字符串。
          default: '5'
          enum:
            - '2'
            - '3'
            - '4'
            - '5'
            - '6'
            - '7'
            - '8'
            - '9'
            - '10'
            - '11'
            - '12'
            - '13'
            - '14'
            - '15'
        negative_prompt:
          type: string
          description: >-
            负向提示词，描述不希望出现的视频内容。支持中英文，最多 500
            个字符。超出部分会自动截断。示例：`低分辨率、最差质量、变形、多余手指、比例失调`。
        prompt_extend:
          type: boolean
          description: >-
            是否开启智能改写提示词。开启后，会使用大模型对输入提示词进行智能改写，对短提示词效果提升显著，但会增加处理耗时。`true`（默认）：开启。`false`：关闭。
        watermark:
          type: boolean
          description: 是否添加水印。水印位于右下角，文字为“AI生成”。`false`（默认）：不添加。`true`：添加。
          default: false
        seed:
          type: integer
          minimum: 0
          maximum: 2147483647
          description: >-
            随机种子，范围 [0,
            2147483647]。未指定时系统自动生成随机种子。为了获得更稳定的复现效果，建议设置固定种子。注意：由于模型生成具有概率性，即使相同种子也不能保证每次结果完全一致。
        media:
          type: array
          description: |-
            用于视频生成的媒体资源（图片、音频、视频）列表。每个元素都是一个包含 `type` 和 `url` 的媒体对象。

            支持的组合（非法组合会返回错误）：
            - **仅首段视频**：`first_clip`
            - **首段视频 + 尾帧**：`first_clip` + `last_frame`

            数组中每个 `type` 最多出现一次。
          items:
            $ref: '#/components/schemas/Wan27MediaInput'
    VideoTaskResponse:
      type: object
      properties:
        id:
          type: string
          description: 公开任务 ID。
        task_id:
          type: string
          description: 公开任务 ID 的向后兼容别名。
        object:
          type: string
          example: video
        model:
          type: string
          description: 模型名称。
        status:
          type: string
          enum:
            - queued
            - in_progress
            - completed
            - failed
            - unknown
          description: 统一视频任务状态。
        progress:
          type: integer
          description: 任务进度百分比。
        created_at:
          type: integer
          format: int64
          description: 创建时间，Unix 时间戳（秒）。
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
    Wan27MediaInput:
      type: object
      required:
        - type
        - url
      properties:
        type:
          type: string
          enum:
            - first_clip
            - last_frame
          description: |-
            媒体资源类型。
            - `first_clip`：首段视频。
            - `last_frame`：尾帧图片。

            每个类型在单次请求中最多出现一次（例如不能包含两个 `first_clip` 条目）。
        url:
          type: string
          description: |-
            媒体资源 URL。支持图片和视频。

            **视频**（type=`first_clip`）

            视频文件的 URL。模型将基于该视频内容进行续写生成，续写时长的上限由 duration 参数控制。

            例如：当duration=15时，输入视频 3 秒，则模型续写生成 12 秒，最终输出视频总时长 15 秒， 按 15 秒计费。

            视频限制：

            - 格式：mp4、mov。
            - 时长：2～10s。
            - 分辨率：宽和高的范围为[240, 4096]像素。
            - 宽高比：1:8～8:1。
            - 文件大小：不超过100MB。

            支持输入的格式：

            公网URL：

            支持 HTTP 和 HTTPS 协议。

            示例值：`https://xxx/xxx.mp4`。

            临时URL：

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

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

            **图片**（type=`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: API Key
      description: '在请求头中传递 `Authorization: Bearer <token>`。'

````