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

# Wan 首尾帧图生视频 

> wan2.1-kf2v-plus

适用于 Wan 系列首尾帧图生视频模型。提交任务后，请通过 `GET /v1/videos/{task_id}` 查询状态。

公开字段：`model`、`images`、`prompt`、`seconds`、`size`、`prompt_extend`、`watermark`、`seed` 与 `negative_prompt`。其中 `images` 必须按顺序传入 2 张图：`images[0]` 为首帧，`images[1]` 为尾帧。首帧决定基础构图，尾帧用于控制收束画面。



## OpenAPI

````yaml api-reference/zh-Hans/zmodelVideo/ali/video-first-last-frame2.json POST /v1/videos
openapi: 3.0.1
info:
  title: wan2.1-kf2v-plus 首尾帧图生视频
  version: 1.0.0
  description: Wan 系列首尾帧图生视频能力文档。公开统一入口为 `/v1/videos`，用于创建异步视频生成任务。该场景通过首帧与尾帧图像来驱动生成的视频内容。
  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 Video
    description: Wan 系列首尾帧视频能力
paths:
  /v1/videos:
    post:
      tags:
        - Wan Video
      summary: wan2.1-kf2v-plus 首尾帧图生视频
      description: >-
        wan2.1-kf2v-plus


        适用于 Wan 系列首尾帧图生视频模型。提交任务后，请通过 `GET /v1/videos/{task_id}` 查询状态。


        公开字段：`model`、`images`、`prompt`、`seconds`、`size`、`prompt_extend`、`watermark`、`seed`
        与 `negative_prompt`。其中 `images` 必须按顺序传入 2 张图：`images[0]` 为首帧，`images[1]`
        为尾帧。首帧决定基础构图，尾帧用于控制收束画面。
      operationId: aliFirstLastFrameToVideo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FirstLastFrameVideoRequest'
            examples:
              first_last_frame_video:
                summary: 首尾帧图生视频
                value:
                  model: wan2.1-kf2v-plus
                  images:
                    - https://example.com/first-frame.png
                    - https://example.com/last-frame.png
                  prompt: 写实风格，一只黑色小猫好奇地看向天空，镜头从平视逐渐上升，最后俯拍它的好奇的眼神。
                  seconds: '5'
                  size: 720P
                  prompt_extend: true
              with_negative_prompt:
                summary: 使用反向提示词
                value:
                  model: wan2.1-kf2v-plus
                  images:
                    - https://example.com/first-frame.png
                    - https://example.com/last-frame.png
                  prompt: 写实风格，小猫从草地跑向花园
                  negative_prompt: 人物
                  size: 720P
                  prompt_extend: true
      responses:
        '200':
          description: 提交成功，返回视频任务对象。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoTaskResponse'
        '400':
          description: 请求参数不合法。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_request:
                  summary: 参数错误
                  value:
                    error:
                      message: 请求体格式错误或字段取值非法
                      type: invalid_request_error
                      code: bad_request_body
                      param: ''
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: 未授权
                  value:
                    error:
                      message: 无效的令牌
                      type: api_error
                      code: access_denied
                      param: ''
          description: 鉴权失败，例如未提供令牌或令牌无效。
        '413':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                request_too_large:
                  summary: 请求体过大
                  value:
                    error:
                      message: 请求体过大，请缩小输入后重试
                      type: api_error
                      code: read_request_body_failed
                      param: ''
          description: 请求体过大。
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                quota_exceeded:
                  summary: 额度不足或速率受限
                  value:
                    error:
                      message: 当前账户额度不足，请稍后重试
                      type: api_error
                      code: insufficient_user_quota
                      param: ''
          description: 触发速率限制或账户额度不足。
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: 内部处理失败
                  value:
                    error:
                      message: 服务内部处理失败，请稍后重试
                      type: api_error
                      code: gen_relay_info_failed
                      param: ''
          description: 服务端处理请求时发生内部错误。
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                bad_gateway:
                  summary: 上游响应异常
                  value:
                    error:
                      message: 上游服务返回了无效响应
                      type: api_error
                      code: bad_response_status_code
                      param: ''
          description: 上游服务返回异常响应。
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                service_unavailable:
                  summary: 服务暂不可用
                  value:
                    error:
                      message: 当前模型暂时无可用渠道，请稍后重试
                      type: api_error
                      code: get_channel_failed
                      param: ''
          description: 上游服务暂不可用，或当前模型暂无可用渠道。
      security:
        - BearerAuth: []
components:
  schemas:
    FirstLastFrameVideoRequest:
      type: object
      required:
        - model
        - prompt
        - images
      properties:
        model:
          type: string
          enum:
            - wan2.1-kf2v-plus
          description: 模型名称。
        images:
          type: array
          minItems: 2
          maxItems: 2
          items:
            type: string
          description: >-
            首尾帧图像 URL 数组，必须按顺序传入 2 张图：`images[0]` 为首帧，`images[1]`
            为尾帧。输出视频的宽高比与首帧图像保持一致，尾帧会被裁剪适配为首帧的宽高比。
        prompt:
          type: string
          description: |-
            文本提示词。支持中英文，长度不超过800个字符，每个汉字/字母占一个字符，超过部分会自动截断。

            如果首尾帧的主体和场景变化较大，建议描写变化过程，例如运镜过程（镜头向左移动）或者主体运动过程（人向前奔跑）。

            示例值：一只黑色小猫好奇地看向天空，镜头从平视逐渐上升，最后俯拍它的好奇的眼神。
        seconds:
          type: string
          description: 视频生成时长（秒）的字符串形式。当前固定为 `"5"`。
          default: '5'
          enum:
            - '5'
        size:
          type: string
          enum:
            - 720P
          description: >-
            生成视频的分辨率档位。wan2.2-kf2v-flash 支持 480P/720P/1080P，wan2.1-kf2v-plus 支持
            720P。
          default: 720P
        prompt_extend:
          type: boolean
          description: |-
            是否开启prompt智能改写。开启后使用大模型对输入prompt进行智能改写。对于较短的prompt生成效果提升明显，但会增加耗时。

            - `true`：默认值，开启智能改写。
            - `false`：不开启智能改写。

            示例值：true。
          default: true
        watermark:
          type: boolean
          description: |-
            是否添加水印标识，水印位于图片右下角，文案为「AI生成」。

            - `false`：默认值，不添加水印。
            - `true`：添加水印。

            示例值：false。
          default: false
        seed:
          type: integer
          description: |-
            随机数种子，取值范围为[0, 2147483647]。

            未指定时，系统自动生成随机种子。若需提升生成结果的可复现性，建议固定seed值。

            请注意，由于模型生成具有概率性，即使使用相同 seed，也不能保证每次生成结果完全一致。
        negative_prompt:
          type: string
          description: |-
            反向提示词，用来描述不希望在视频画面中看到的内容，可以对视频画面进行限制。

            支持中英文，长度不超过500个字符，超过部分会自动截断。

            示例值：低分辨率、错误、最差质量、低质量、残缺、多余的手指、比例不良等。
    VideoTaskResponse:
      type: object
      properties:
        id:
          type: string
        task_id:
          type: string
        object:
          type: string
          example: video
        model:
          type: string
        status:
          type: string
          enum:
            - pending
            - queued
            - running
            - succeeded
            - failed
            - cancelled
        progress:
          type: integer
        created_at:
          type: integer
          format: int64
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
              description: 错误类型，例如 `invalid_request_error`、`api_error` 或上游兼容错误类型。
            code:
              type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: '在请求头中传入 `Authorization: Bearer <token>`。'

````