> ## 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 首尾帧生视频

> 使用通义万相 Wan2.2 首尾帧生视频模型（wan2.2-kf2v-flash），仅需提供首帧和尾帧图片，结合提示词即可生成丝滑流畅的动态视频，支持特效模板

使用[阿里云](https://tongyi.aliyun.com/wan)通义万相首尾帧生视频模型，仅需提供首帧和尾帧图片即可生成丝滑流畅的动态视频。

**模型特点：**

* **首尾帧控制** - 精确控制视频起始和结束画面
* **平滑过渡** - 自动生成丝滑流畅的中间帧动画
* **多分辨率** - 支持 480P、720P、1080P 输出
* **智能改写** - 支持 prompt 智能改写优化效果
* **特效模板** - 支持预设视频特效模板


## OpenAPI

````yaml /cn/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 模型任务调度平台 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: 通义万相 Wan2 首尾帧生视频
      description: >-
        使用通义万相 Wan2.2
        首尾帧生视频模型（wan2.2-kf2v-flash），仅需提供首帧和尾帧图片，结合提示词即可生成丝滑流畅的动态视频，支持特效模板
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/bailian.CreateWan2KeyframeToVideoTaskRequest
        description: 任务参数
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dto.CreateTaskResponse'
        '400':
          description: 参数错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '401':
          description: 未授权
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '404':
          description: 模型不存在
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '500':
          description: 服务器错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
      security:
        - AccessToken: []
components:
  schemas:
    bailian.CreateWan2KeyframeToVideoTaskRequest:
      properties:
        first_frame_url:
          description: |-
            首帧图像 URL（必填）
            支持公网 URL（HTTP/HTTPS）或 Base64 编码
            图像格式：JPEG、JPG、PNG（无透明通道）、BMP、WEBP
            图像分辨率：宽度和高度范围为 [360, 2000] 像素
            文件大小：不超过 10MB
            输出视频的宽高比将以此图像为基准
          type: string
        last_frame_url:
          description: |-
            尾帧图像 URL（可选）
            要求同首帧图像，分辨率可与首帧不同
            使用特效模板（template）时无需传入
          type: string
        model:
          description: |-
            模型名称（可选，建议留空）
            留空时使用最新版本模型，后续模型升级会自动应用
            当前默认：wan2.2-kf2v-flash
          enum:
            - wan2.2-kf2v-flash
          type: string
        negative_prompt:
          description: |-
            反向提示词（可选，最大 500 字符）
            用来描述不希望在视频画面中看到的内容
          maxLength: 500
          type: string
        prompt:
          description: |-
            文本提示词（可选，最大 800 字符）
            用来描述生成视频中期望包含的元素和视觉特点
            首尾帧主体/场景变化较大时，建议描写变化过程（如运镜、主体运动）
          maxLength: 800
          type: string
        prompt_extend:
          description: |-
            是否开启 prompt 智能改写（可选，默认 true）
            开启后使用大模型对输入 prompt 进行智能改写
          type: boolean
        resolution:
          description: |-
            分辨率档位（可选，默认 720P）
            wan2.2-kf2v-flash：可选值 480P、720P、1080P
          enum:
            - 480P
            - 720P
            - 1080P
          type: string
        seed:
          description: 随机种子（可选，范围 0-2147483647）
          maximum: 2147483647
          minimum: 0
          type: integer
        template:
          description: |-
            视频特效模板名称（可选）
            使用此参数时，仅需传入 first_frame_url
            不同模型支持不同的特效模板
          type: string
        watermark:
          description: |-
            是否添加水印（可选，默认 false）
            水印位于视频右下角，文案固定为"AI生成"
          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: 请使用您的 API Token 进行认证

````