Skip to main content
POST
/
generate
/
bailian
/
wan2-keyframe-to-video
Tongyi Wanxiang Wan2 Keyframe-to-Video
curl --request POST \
  --url https://api.sinancode.com/v1/generate/bailian/wan2-keyframe-to-video \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "first_frame_url": "<string>",
  "last_frame_url": "<string>",
  "model": "wan2.2-kf2v-flash",
  "negative_prompt": "<string>",
  "prompt": "<string>",
  "prompt_extend": true,
  "resolution": "480P",
  "seed": 1073741823,
  "template": "<string>",
  "watermark": true
}
'
{
  "task_id": "01234567-89ab-cdef-0123-456789abcdef"
}
Generate smooth dynamic videos by providing just the first and last frame images using Alibaba Cloud’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

Authorizations

Authorization
string
header
required

Please use your API Token for authentication

Body

application/json

Task parameters

first_frame_url
string
required

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

last_frame_url
string

Last frame image URL (optional) Same requirements as first frame, resolution can differ from first frame Not required when using effect template

model
enum<string>

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

Available options:
wan2.2-kf2v-flash
negative_prompt
string

Negative prompt (optional, max 500 characters) Describe content you don't want to see in the video

Maximum string length: 500
prompt
string

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)

Maximum string length: 800
prompt_extend
boolean

Enable smart prompt rewriting (optional, default true) When enabled, uses large language model to intelligently rewrite input prompts

resolution
enum<string>

Resolution tier (optional, default 720P) wan2.2-kf2v-flash: available values 480P, 720P, 1080P

Available options:
480P,
720P,
1080P
seed
integer

Random seed (optional, range 0-2147483647)

Required range: 0 <= x <= 2147483647
template
string

Video effect template name (optional) When using this parameter, only need to provide first_frame_url Different models support different effect templates

watermark
boolean

Add watermark (optional, default false) Watermark is located at bottom right corner with fixed text "AI Generated"

Response

OK

task_id
string
required

Task ID

Example:

"01234567-89ab-cdef-0123-456789abcdef"