> ## 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 First-Last Frame to Video

> wan2.2-kf2v-flash

Applies to Wan series first-last-frame image-to-video models. After submitting a task, query its status via `GET /v1/videos/{task_id}`.

Public fields: `model`, `images`, `prompt`, `seconds`, `size`, `prompt_extend`, `watermark`, `seed`, and `negative_prompt`. The `images` array must contain exactly 2 images in order: `images[0]` is the first frame and `images[1]` is the last frame. The first frame determines the base composition, while the last frame controls the closing scene.



## OpenAPI

````yaml api-reference/en/zmodelVideo/ali/video-first-last-frame.json POST /v1/videos
openapi: 3.0.1
info:
  title: Wan first-last-frame image-to-video
  version: 1.0.0
  description: >-
    Wan series first-last-frame image-to-video capability documentation. The
    unified API endpoint is `/v1/videos`, used to create asynchronous video
    generation tasks. This scenario uses a first frame and a last frame image to
    drive the generated video.
  license:
    name: Project License
    url: https://github.com/QuantumNous/new-api/blob/main/LICENSE
servers:
  - url: https://api.powertokens.ai
    description: Baze API server endpoint
security: []
tags:
  - name: Wan Video
    description: Wan first-last-frame video capability
paths:
  /v1/videos:
    post:
      tags:
        - Wan Video
      summary: Wan first-last-frame image-to-video
      description: >-
        wan2.2-kf2v-flash


        Applies to Wan series first-last-frame image-to-video models. After
        submitting a task, query its status via `GET /v1/videos/{task_id}`.


        Public fields: `model`, `images`, `prompt`, `seconds`, `size`,
        `prompt_extend`, `watermark`, `seed`, and `negative_prompt`. The
        `images` array must contain exactly 2 images in order: `images[0]` is
        the first frame and `images[1]` is the last frame. The first frame
        determines the base composition, while the last frame controls the
        closing scene.
      operationId: aliFirstLastFrameToVideo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FirstLastFrameVideoRequest'
            examples:
              first_last_frame_video:
                summary: First-last-frame image-to-video
                value:
                  model: wan2.2-kf2v-flash
                  images:
                    - https://example.com/first-frame.png
                    - https://example.com/last-frame.png
                  prompt: >-
                    Realistic style, a black kitten curiously looks up at the
                    sky, the camera gradually rises from eye level, ending with
                    a top-down shot of its curious eyes.
                  seconds: '5'
                  size: 720P
                  prompt_extend: true
              with_negative_prompt:
                summary: With negative prompt
                value:
                  model: wan2.2-kf2v-flash
                  images:
                    - https://example.com/first-frame.png
                    - https://example.com/last-frame.png
                  prompt: Realistic style, a kitten runs from the grass to the garden
                  negative_prompt: human figures
                  size: 720P
                  prompt_extend: true
      responses:
        '200':
          description: Submitted successfully. Returns a video task object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoTaskResponse'
        '400':
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_request:
                  summary: Parameter error
                  value:
                    error:
                      message: Malformed request body or invalid field value
                      type: invalid_request_error
                      code: bad_request_body
                      param: ''
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Unauthorized
                  value:
                    error:
                      message: Invalid token
                      type: api_error
                      code: access_denied
                      param: ''
          description: Authentication failed, e.g. missing or invalid token.
        '413':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                request_too_large:
                  summary: Request body too large
                  value:
                    error:
                      message: >-
                        Request body too large, please reduce the input and
                        retry
                      type: api_error
                      code: read_request_body_failed
                      param: ''
          description: Request body too large.
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                quota_exceeded:
                  summary: Insufficient quota or rate limited
                  value:
                    error:
                      message: Insufficient account quota, please try again later
                      type: api_error
                      code: insufficient_user_quota
                      param: ''
          description: Rate limit triggered or insufficient account quota.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: Internal processing failure
                  value:
                    error:
                      message: Internal processing failed, please try again later
                      type: api_error
                      code: gen_relay_info_failed
                      param: ''
          description: An internal error occurred while processing the request.
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                bad_gateway:
                  summary: Upstream provider response error
                  value:
                    error:
                      message: The upstream provider returned an invalid response
                      type: api_error
                      code: bad_response_status_code
                      param: ''
          description: The upstream provider returned an abnormal response.
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                service_unavailable:
                  summary: Service temporarily unavailable
                  value:
                    error:
                      message: >-
                        No available channel for the current model, please try
                        again later
                      type: api_error
                      code: get_channel_failed
                      param: ''
          description: >-
            The upstream provider is temporarily unavailable, or no channel is
            currently available for this model.
      security:
        - BearerAuth: []
components:
  schemas:
    FirstLastFrameVideoRequest:
      type: object
      required:
        - model
        - prompt
        - images
      properties:
        model:
          type: string
          enum:
            - wan2.2-kf2v-flash
          description: 'Model name. '
        images:
          type: array
          minItems: 2
          maxItems: 2
          items:
            type: string
          description: >-
            First-last-frame image URL array. Must contain exactly 2 images in
            order: `images[0]` is the first frame, `images[1]` is the last
            frame. The output video aspect ratio matches the first frame image;
            the last frame is cropped to fit the first frame aspect ratio.
        prompt:
          type: string
          description: >-
            Text prompt. Supports Chinese and English, up to 800 characters
            (each Chinese character or letter counts as one character). Excess
            characters will be automatically truncated.


            If the subject and scene change significantly between the first and
            last frames, it is recommended to describe the transition, such as
            camera movement (e.g., camera panning left) or subject motion (e.g.,
            a person running forward).


            Example: A small black cat curiously looks up at the sky, the camera
            gradually rises from eye level, finally looking down at its curious
            eyes.
        seconds:
          type: string
          description: Video duration (seconds) as a string. Currently fixed at `"5"`.
          enum:
            - '5'
          default: '5'
        size:
          type: string
          enum:
            - 480P
            - 720P
            - 1080P
          description: >-
            Output video resolution tier. wan2.2-kf2v-flash supports
            480P/720P/1080P, wan2.1-kf2v-plus supports 720P.
          default: 720P
        prompt_extend:
          type: boolean
          description: >-
            Whether to enable intelligent prompt rewriting. When enabled, a
            large language model rewrites the input prompt intelligently.
            Significantly improves results for short prompts, but increases
            processing time.


            - `true`: Default, enable intelligent rewriting.

            - `false`: Disable intelligent rewriting.


            Example: true.
          default: true
        watermark:
          type: boolean
          description: >-
            Whether to add a watermark. The watermark appears at the
            bottom-right corner with the text "AI Generated".


            - `false`: Default, no watermark.

            - `true`: Add watermark.


            Example: false.
          default: false
        seed:
          type: integer
          description: >-
            Random seed, range [0, 2147483647].


            When not specified, a random seed is automatically generated. To
            improve reproducibility of results, it is recommended to fix the
            seed value.


            Note: Due to the probabilistic nature of model generation, even with
            the same seed, results may not be identical every time.
        negative_prompt:
          type: string
          description: >-
            Negative prompt describing content you do not want in the video,
            used to restrict the video output.


            Supports Chinese and English, up to 500 characters. Excess
            characters will be automatically truncated.


            Example: Low resolution, error, worst quality, low quality,
            disfigured, extra fingers, bad proportions, etc.
    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: >-
                Error type, e.g. `invalid_request_error`, `api_error`, or
                upstream-compatible error types.
            code:
              type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Pass `Authorization: Bearer <token>` in the request header.'

````