> ## 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 Image to Video (First and Last Frame)

> Submit an asynchronous Wan 2.2 image-to-video task, generating a video based on a first frame (and optional last frame) image.

After submitting a task, query its status via `GET /ali/api/v1/tasks/{task_id}`.



## OpenAPI

````yaml api-reference/en/zmodelVideo/ali/api/legacy-i2v-first-last-frame.json POST /ali/api/v1/services/aigc/image2video/video-synthesis
openapi: 3.0.1
info:
  title: Wan Image to Video (First and Last Frame)
  version: 1.0.0
  description: >-
    Aliyun Wan 2.2 series first-and-last-frame image-to-video capability
    documentation. The unified API endpoint is
    `/ali/api/v1/services/aigc/image2video/video-synthesis`, used to create
    asynchronous video generation tasks.


    Supported models: `wan2.2-kf2v-flash`, `wan2.1-kf2v-plus`.
  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 Legacy Video
    description: Ali wan 2.2 image-to-video capability
paths:
  /ali/api/v1/services/aigc/image2video/video-synthesis:
    post:
      tags:
        - Wan Legacy Video
      summary: Create Wan image-to-video task (first and last frame)
      description: >-
        Submit an asynchronous Wan 2.2 image-to-video task, generating a video
        based on a first frame (and optional last frame) image.


        After submitting a task, query its status via `GET
        /ali/api/v1/tasks/{task_id}`.
      operationId: aliLegacyI2VFirstLastFrameCreate
      parameters:
        - name: Content-Type
          in: header
          required: true
          schema:
            type: string
          description: Request content type. Must be set to `application/json`.
        - name: X-DashScope-Async
          in: header
          required: true
          schema:
            type: string
          description: >-
            Async processing configuration. HTTP requests only support async
            mode. Must be set to `enable`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LegacyKf2VRequest'
            examples:
              first_last_frame:
                summary: First and last frame (URL)
                value:
                  model: wan2.2-kf2v-flash
                  input:
                    first_frame_url: https://wanx.alicdn.com/material/20250318/first_frame.png
                    last_frame_url: https://wanx.alicdn.com/material/20250318/last_frame.png
                    prompt: >-
                      Realistic style, a small black cat curiously looks up at
                      the sky, the camera gradually rises from eye level,
                      finally looking down at its curious eyes.
                  parameters:
                    resolution: 480P
                    prompt_extend: true
              base64:
                summary: Using Base64
                value:
                  model: wan2.1-kf2v-plus
                  input:
                    first_frame_url: data:image/png;base64,GDU7MtCZzEbTbmRZ......
                    last_frame_url: data:image/png;base64,VBORw0KGgoAAAANSUh......
                    prompt: >-
                      Realistic style, a small black cat curiously looks up at
                      the sky, the camera gradually rises from eye level,
                      finally looking down at its curious eyes.
                  parameters:
                    resolution: 720P
                    prompt_extend: true
              template:
                summary: Using video effect template
                value:
                  model: wan2.1-kf2v-plus
                  input:
                    first_frame_url: >-
                      https://ty-yuanfang.oss-cn-hangzhou.aliyuncs.com/lizhengjia.lzj/tmp/11.png
                    template: hanfu-1
                  parameters:
                    resolution: 720P
                    prompt_extend: true
              negative_prompt:
                summary: Using negative prompt
                value:
                  model: wan2.1-kf2v-plus
                  input:
                    first_frame_url: https://wanx.alicdn.com/material/20250318/first_frame.png
                    last_frame_url: https://wanx.alicdn.com/material/20250318/last_frame.png
                    prompt: >-
                      Realistic style, a small black cat curiously looks up at
                      the sky, the camera gradually rises from eye level,
                      finally looking down at its curious eyes.
                    negative_prompt: Human figures
                  parameters:
                    resolution: 720P
                    prompt_extend: true
      responses:
        '200':
          description: >-
            Submitted successfully. Returns a video task object. Save the
            task_id to query task status and results.
          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: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication failed, e.g. missing or invalid token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit triggered or insufficient account quota.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: An internal error occurred while processing the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    LegacyKf2VRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          enum:
            - wan2.2-kf2v-flash
            - wan2.1-kf2v-plus
          description: >-
            Model name. Example: `wan2.2-kf2v-flash`. See the Bailian console
            for details.
        input:
          $ref: '#/components/schemas/LegacyKf2VInput'
        parameters:
          $ref: '#/components/schemas/LegacyKf2VParameters'
    VideoTaskResponse:
      type: object
      properties:
        output:
          type: object
          properties:
            task_id:
              type: string
              description: Task ID. Valid for querying for 24 hours.
            task_status:
              type: string
              description: |-
                Task status.

                Enum values:
                - `PENDING`: Task is queued
                - `RUNNING`: Task is processing
                - `SUCCEEDED`: Task completed successfully
                - `FAILED`: Task failed
                - `CANCELED`: Task canceled
                - `UNKNOWN`: Task does not exist or status is unknown
            code:
              type: string
              description: Error code for failed requests. Not returned on success.
            message:
              type: string
              description: >-
                Detailed error message for failed requests. Not returned on
                success.
        request_id:
          type: string
          description: >-
            Unique request identifier. Can be used for request tracing and issue
            investigation.
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code.
        message:
          type: string
          description: Error message.
        request_id:
          type: string
          description: Request ID.
    LegacyKf2VInput:
      type: object
      required:
        - first_frame_url
      properties:
        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.
          maxLength: 800
        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.
          maxLength: 500
        first_frame_url:
          type: string
          description: >-
            The URL or Base64-encoded data of the first frame image. The output
            video's aspect ratio will follow this image.


            Image restrictions:

            - Image formats: JPEG, JPG, PNG (no alpha channel), BMP, WEBP.

            - Image resolution: width and height range [240, 8000] pixels.

            - File size: up to 10MB.


            Supported input formats:

            - **Public URL**: HTTP or HTTPS protocol. Example:
            `https://wanx.alicdn.com/xxx/first_frame.png`.

            - **Temporary URL**: OSS protocol, must obtain via file upload.
            Example: `oss://dashscope-instant/xxx/xxx.png`.

            - **Base64-encoded image string**: Format:
            `data:{MIME_type};base64,{base64_data}`. Example:
            `data:image/png;base64,GDU7MtCZzEbTbmRZ......` (truncated for
            brevity).
        last_frame_url:
          type: string
          description: >-
            The URL or Base64-encoded data of the last frame image.


            Image restrictions:

            - Image formats: JPEG, JPG, PNG (no alpha channel), BMP, WEBP.

            - Image resolution: width and height range [240, 8000] pixels. The
            last frame resolution can differ from the first frame; no forced
            alignment required.

            - File size: up to 10MB.


            Supported input formats:

            - **Public URL**: HTTP or HTTPS protocol. Example:
            `https://wanx.alicdn.com/xxxx/last_frame.png`.

            - **Temporary URL**: OSS protocol, must obtain via file upload.
            Example: `oss://dashscope-instant/xxx/xxx.png`.

            - **Base64-encoded image string**: Format:
            `data:{MIME_type};base64,{base64_data}`. Example:
            `data:image/png;base64,GDU7MtCZ......` (truncated for brevity).
        template:
          type: string
          description: >-
            Name of the video effect template. When using this parameter, only
            first_frame_url is required.


            Different models support different effect templates. Refer to Wan
            Image-to-Video Video Effects before calling to avoid failures.


            Example: `hufu-1`, representing the "Tang Yun Pian Ran" effect.
    LegacyKf2VParameters:
      type: object
      properties:
        resolution:
          type: string
          enum:
            - 480P
            - 720P
            - 1080P
          description: >-
            **Important**: resolution directly affects cost. For the same model:
            1080P > 720P > 480P.


            The resolution tier for the generated video. Used to adjust video
            sharpness (total pixels) without changing the aspect ratio. The
            video aspect ratio will match that of the first frame image
            (first_frame_url).


            Default values and available options depend on the model parameter:

            - `wan2.2-kf2v-flash`: Available values: 480P, 720P, 1080P. Default:
            720P.

            - `wan2.1-kf2v-plus`: Available values: 720P. Default: 720P.


            Example: 720P.
        duration:
          type: integer
          description: >-
            **Important**: duration directly affects cost (billed per second).


            Video duration in seconds. Currently fixed at 5 and cannot be
            changed. The model will always generate a 5-second video.
          default: 5
        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.
          minimum: 0
          maximum: 2147483647
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Pass `Authorization: Bearer <token>` in the request header.'

````