Wan v2.6 Text-to-Video
Wan v2.6 Text-to-Video is the production-grade text-to-video model in Alibaba Cloud's Wan series, generating cinematic clips up to 15 seconds with automatic multi-shot scene composition and native audio at resolutions up to 1080p. Your use is subject to Alibaba Cloud's Terms & Privacy Policies.
import { experimental_generateVideo as generateVideo } from 'ai';
const result = await generateVideo({ model: 'alibaba/wan-v2.6-t2v', prompt: 'A serene mountain lake at sunrise.'});Getting started
Generate videos with Wan v2.6 Text-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.
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-t2v', prompt: 'A chicken flying into the sunset in the style of 90s anime', });
// 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
Drive the output with the top-level resolution and duration parameters. Wan uses resolution, not aspectRatio.
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-t2v', prompt: 'A chicken flying into the sunset in the style of 90s anime', 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);| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Text description of the video to generate. Max 1500 characters. |
duration | number | No | Video length in seconds. 2-15 seconds. |
resolution | string | No | Resolution ('1280x720', '1920x1080'). |
aspectRatio | string | No | Aspect ratio ('16:9', '9:16', '1:1', '4:3', '3:4'). |
generateAudio | boolean | No | Generate synchronized audio with the video. |
Input limits
| Input | Formats | Sources | Max count | Max size | Limits |
|---|---|---|---|---|---|
| Text | — | — | — | — | Up to 1500 characters |
| Audio | wav, mp3 | url | — | 15 MB | 3-30s |
Provider options
Load the version-agnostic Wan options under providerOptions.alibaba. shotType (v2.6 only) and audioUrl (v2.5 only) are version-specific and documented in the table below.
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-t2v', prompt: 'A chicken flying into the sunset in the style of 90s anime', resolution: '1280x720', duration: 5, providerOptions: { alibaba: { promptExtend: true, 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.
| Parameter | Type | Required | Description |
|---|---|---|---|
promptExtend | boolean | No | Enhance prompt for better quality. Defaults to true. |
negativePrompt | string | No | What to avoid in the video. Max 500 characters. |
audioUrl | string | No | URL to audio file for audio-video sync — see the Input limits table for supported formats, duration, and size. v2.5 only. |
shotType | 'single' | 'multi' | No | 'multi' enables multi-shot cinematic narrative. v2.6 only. |
watermark | boolean | No | Add watermark to the video. Defaults to false. |
pollIntervalMs | number | No | How often to check task status. Defaults to 5000. |
pollTimeoutMs | number | No | Maximum wait time. Defaults to 600000 (10 minutes). |