Skip to content
Dashboard

Wan v2.6 Image-to-Video

Wan v2.6 Image-to-Video is Alibaba Cloud's image-to-video model that animates still images into high-fidelity video clips up to 1080p and 15 seconds, with optional audio and precise motion control from text guidance. Your use is subject to Alibaba Cloud's Terms & Privacy Policies.

image-to-video
import { experimental_generateVideo as generateVideo } from 'ai';
const result = await generateVideo({
model: 'alibaba/wan-v2.6-i2v',
prompt: 'A serene mountain lake at sunrise.'
});
Read docs

Getting started

Generate videos with Wan v2.6 Image-to-Video using the experimental_generateVideo function from AI SDK 6 or later. AI Gateway handles routing and polls until the video is ready.

Install the AI SDK (pnpm add ai dotenv), create an API key from the API Keys page, and set it as AI_GATEWAY_API_KEY in your environment. Full setup is covered in the video generation quickstart.

index.ts
import { experimental_generateVideo as generateVideo } from 'ai';
import fs from 'node:fs';
import 'dotenv/config';
async function main() {
const result = await generateVideo({
model: 'alibaba/wan-v2.6-i2v',
prompt: {
image: 'https://example.com/cat.png',
text: 'The cat waves hello and smiles',
},
});
// Save the generated video
fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
console.log('Video saved to output.mp4');
}
main().catch(console.error);

Top-level parameters

Control the output with the top-level resolution and duration parameters. Wan uses resolution, not aspectRatio.

wan-image-to-video-top-level.ts
import { experimental_generateVideo as generateVideo } from 'ai';
import fs from 'node:fs';
import 'dotenv/config';
async function main() {
const result = await generateVideo({
model: 'alibaba/wan-v2.6-i2v',
prompt: {
image: 'https://example.com/cat.png',
text: 'The cat waves hello and smiles',
},
resolution: '1280x720',
duration: 5,
});
// Save the generated video
fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
console.log('Video saved to output.mp4');
}
main().catch(console.error);
ParameterTypeRequiredDescription
prompt.imagestringYesURL of the image to animate.
prompt.textstringNoDescription of the motion or animation. Max 1500 characters.
durationnumberNoVideo length in seconds. 2-15 seconds.
resolutionstringNoResolution ('1280x720', '1920x1080').
aspectRatiostringNoAspect ratio ('16:9', '9:16', '1:1', '4:3', '3:4').
generateAudiobooleanNoGenerate synchronized audio with the video.
frameImagesArray<{ image: string; frameType: 'first_frame' }>NoOpening frame of the clip, as a single first_frame entry. Replaces prompt.image and wins when both are set. URLs only. Wan does not interpolate to an ending image, so a last_frame entry is ignored with a warning.

Input limits

InputFormatsSourcesMax countMax sizeLimits
TextUp to 1500 characters
Imagejpeg, jpg, png, bmp, webpurl120 MB≥240px · ≤8000px
Audiowav, mp3url15 MB3-30s

Provider options

Load the Wan options under providerOptions.alibaba. audioUrl (an external audio track for lip-sync) is a separate workflow and is documented in the table below.

wan-image-to-video-provider-options.ts
import { experimental_generateVideo as generateVideo } from 'ai';
import fs from 'node:fs';
import 'dotenv/config';
async function main() {
const result = await generateVideo({
model: 'alibaba/wan-v2.6-i2v',
prompt: {
image: 'https://example.com/cat.png',
text: 'The cat waves hello and smiles',
},
duration: 5,
generateAudio: true,
providerOptions: {
alibaba: {
negativePrompt: 'blurry, low quality',
watermark: false,
pollIntervalMs: 5000,
pollTimeoutMs: 600000,
},
},
});
// Save the generated video
fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
console.log('Video saved to output.mp4');
}
main().catch(console.error);

Pass Wan-specific options under providerOptions.alibaba in your generateVideo call.

ParameterTypeRequiredDescription
negativePromptstringNoWhat to avoid in the video. Max 500 characters.
audioUrlstringNoURL to audio file for audio-video sync — see the Input limits table for supported formats, duration, and size.
audiobooleanNoGenerate audio with the video. Provider-side alias for the top-level generateAudio, which wins when both are set. v2.6 only — v2.7 always generates audio and ignores it with a warning.
watermarkbooleanNoAdd watermark to the video. Defaults to false.
pollIntervalMsnumberNoHow often to check task status. Defaults to 5000.
pollTimeoutMsnumberNoMaximum wait time. Defaults to 600000 (10 minutes).

Reference-to-video vs image-to-video

Reference-to-video uses the top-level inputReferences to show the model what your characters look like, then generates a brand-new scene from your prompt. The reference media never becomes the video content; reference each one in the prompt with character1, character2, and so on (first entry maps to character1).

Image-to-video instead animates the actual image you pass in frameImages or prompt.image. The image you provide becomes the video content, and you add motion to that exact scene.