Skip to content
Dashboard

Wan v3.0 Video

All-in-one video generation model supporting text-to-video, image-to-video, first/last-frame, and omni-modal reference-based generation (image, video, and audio references) with synchronized audio, at up to 30 seconds per clip. Your use is subject to Alibaba Cloud's Terms & Privacy Policies.

text-to-videoimage-to-videoreference-to-videoaudio-generationVision (Image)Video Inputaudio-input
import { experimental_generateVideo as generateVideo } from 'ai';
const result = await generateVideo({
model: 'alibaba/wan-v3.0-video',
prompt: 'A serene mountain lake at sunrise.'
});
Read docs

Getting started

Generate videos with Wan v3.0 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-v3.0-video',
prompt: 'A drone shot of a coastal cliff with crashing waves at golden hour.',
});
// 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

Load the common, top-level parameters supported across video models.

top-level-params.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-v3.0-video',
prompt: 'A drone shot of a coastal cliff with crashing waves at golden hour.',
duration: 5,
aspectRatio: '16:9',
resolution: '1280x720',
});
// Save the generated video
fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
console.log('Video saved to output.mp4');
}
main().catch(console.error);
ParameterTypeRequiredDescription
promptstringNoText description of the video to generate. Max 20000 characters.
durationnumberNoVideo length in seconds. 2-30 seconds.
resolutionstringNoResolution ('854x480', '1280x720', '1920x1080').
aspectRatiostringNoAspect ratio ('16:9', '4:3', '1:1', '3:4', '9:16').

Input limits

InputFormatsSourcesMax countMax sizeLimits
TextUp to 20000 characters
Imagejpeg, jpg, png, bmp, webpurl, base641020 MB≥240px · ≤8000px · aspect 1:8–8:1
Videomp4, movurl5100 MB1-15s · ≥240px · ≤4096px
Audiowav, mp3url15 MB1-15s

Provider options

Pass provider-specific options under providerOptions.alibaba.

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-v3.0-video',
prompt: 'A drone shot of a coastal cliff with crashing waves at golden hour.',
duration: 5,
providerOptions: {
alibaba: {
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 these under providerOptions.alibaba in your generateVideo call.

ParameterTypeRequiredDescription
providerOptions.alibaba.pollIntervalMsnumberNoHow often to check task status. Defaults to 5000.
providerOptions.alibaba.pollTimeoutMsnumberNoMaximum wait time. Defaults to 600000 (10 minutes).