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

# Wan2 Keyframe-to-Video

> Use Tongyi Wanxiang Wan2.2 keyframe-to-video model (wan2.2-kf2v-flash), only requires first and last frame images, combined with prompt to generate smooth dynamic videos, supports effect templates

Generate smooth dynamic videos by providing just the first and last frame images using [Alibaba Cloud](https://tongyi.aliyun.com/wan)'s Tongyi Wanxiang Keyframe-to-Video model.

**Key Features:**

* **Keyframe Control** - Precise control over video start and end frames
* **Smooth Transition** - Automatically generate silky smooth intermediate frame animations
* **Multi-Resolution** - Support 480P, 720P, 1080P output
* **Smart Rewrite** - Support prompt intelligent rewriting for better results
* **Effect Templates** - Support preset video effect templates


## OpenAPI

````yaml /en/openapi.yaml POST /generate/bailian/wan2-keyframe-to-video
openapi: 3.0.0
info:
  contact:
    email: support@sinancode.com
    name: API Support
    url: https://sinancode.com/support
  description: AI Model Task Scheduling Platform API
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  termsOfService: https://sinancode.com/terms-of-service
  title: TikTomato API
  version: '1.0'
servers:
  - url: https://api.sinancode.com/v1
    description: Production server
security: []
paths:
  /generate/bailian/wan2-keyframe-to-video:
    post:
      tags:
        - public
      summary: Tongyi Wanxiang Wan2 Keyframe-to-Video
      description: >-
        Use Tongyi Wanxiang Wan2.2 keyframe-to-video model (wan2.2-kf2v-flash),
        only requires first and last frame images, combined with prompt to
        generate smooth dynamic videos, supports effect templates
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/bailian.CreateWan2KeyframeToVideoTaskRequest
        description: Task parameters
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dto.CreateTaskResponse'
        '400':
          description: Invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '404':
          description: Model not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
      security:
        - AccessToken: []
components:
  schemas:
    bailian.CreateWan2KeyframeToVideoTaskRequest:
      properties:
        first_frame_url:
          description: |-
            First frame image URL (required)
            Supports public URLs (HTTP/HTTPS) or Base64 encoding
            Image format: JPEG, JPG, PNG (no transparency), BMP, WEBP
            Image resolution: width and height range [360, 2000] pixels
            File size: max 10MB
            Output video aspect ratio will be based on this image
          type: string
        last_frame_url:
          description: >-
            Last frame image URL (optional)

            Same requirements as first frame, resolution can differ from first
            frame

            Not required when using effect template
          type: string
        model:
          description: >-
            Model name (optional, recommended to leave blank)

            When left blank, the latest version will be used and future upgrades
            will be applied automatically

            Current default: wan2.2-kf2v-flash
          enum:
            - wan2.2-kf2v-flash
          type: string
        negative_prompt:
          description: |-
            Negative prompt (optional, max 500 characters)
            Describe content you don't want to see in the video
          maxLength: 500
          type: string
        prompt:
          description: >-
            Text prompt (optional, max 800 characters)

            Describe the elements and visual features you want in the generated
            video

            When the subject/scene changes significantly between first and last
            frames, it's recommended to describe the transition process (e.g.,
            camera movement, subject motion)
          maxLength: 800
          type: string
        prompt_extend:
          description: >-
            Enable smart prompt rewriting (optional, default true)

            When enabled, uses large language model to intelligently rewrite
            input prompts
          type: boolean
        resolution:
          description: |-
            Resolution tier (optional, default 720P)
            wan2.2-kf2v-flash: available values 480P, 720P, 1080P
          enum:
            - 480P
            - 720P
            - 1080P
          type: string
        seed:
          description: Random seed (optional, range 0-2147483647)
          maximum: 2147483647
          minimum: 0
          type: integer
        template:
          description: |-
            Video effect template name (optional)
            When using this parameter, only need to provide first_frame_url
            Different models support different effect templates
          type: string
        watermark:
          description: >-
            Add watermark (optional, default false)

            Watermark is located at bottom right corner with fixed text "AI
            Generated"
          type: boolean
      required:
        - first_frame_url
      type: object
    dto.CreateTaskResponse:
      properties:
        task_id:
          description: Task ID
          example: 01234567-89ab-cdef-0123-456789abcdef
          type: string
      required:
        - task_id
      type: object
    apierror.ErrorResponse:
      properties:
        error_code:
          description: Machine-readable error code (e.g., TASK.INVALID_PARAMS)
          type: string
        message:
          description: User-friendly error message
          type: string
      type: object
  securitySchemes:
    AccessToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Please use your API Token for authentication

````