Seedance 2.5
import { experimental_generateVideo as generateVideo } from 'ai';
const result = await generateVideo({ model: 'bytedance/seedance-2.5', prompt: 'A serene mountain lake at sunrise.'});Getting started
Generate videos with Seedance 2.5 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: 'bytedance/seedance-2.5', 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
Exercise the supported top-level params: prompt, aspectRatio, resolution, and duration.
import { experimental_generateVideo as generateVideo } from 'ai';import fs from 'node:fs';import 'dotenv/config';
async function main() { const result = await generateVideo({ model: 'bytedance/seedance-2.5', prompt: 'A chicken flying into the sunset in the style of 90s anime', aspectRatio: '16:9', 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 | No | Text description of the video to generate. |
duration | number | No | Video length in seconds. 4-30 seconds. |
resolution | string | No | Resolution ('854x480', '1280x720'). |
aspectRatio | string | No | Aspect ratio ('16:9', '4:3', '1:1', '3:4', '9:16', '21:9'). |
generateAudio | boolean | No | Generate synchronized audio with the video. |
frameImages | Array<{ image: string; frameType: 'first_frame' | 'last_frame' }> | No | First and last frames of the clip. A first_frame entry replaces prompt.image and wins when both are set, and adding a last_frame transitions between the two. Seedance accepts image URLs only, so host local files on Vercel Blob first. |
inputReferences | Array<{ data: string; mediaType: string }> | No | Reference images and videos, referenced in the prompt as [Image 1], [Video 1], and so on, numbered separately in the order you pass them. Tag every URL with an explicit mediaType — an untyped URL is treated as an image and emits a warning. See the Input limits table for supported counts. |
Input limits
| Input | Formats | Sources | Max count | Max size | Limits |
|---|---|---|---|---|---|
| Image | jpeg, png, webp, bmp, tiff, gif, heic, heif | url | 30 | 30 MB | ≥300px · ≤6000px · aspect 2:5–5:2 |
| Video | mp4, mov | url | 10 | 200 MB | 2-30s · ≥300px · ≤6000px |
| Audio | mp3, wav | url | — | 15 MB | 2-30s |
Provider options (bytedance)
Load the compatible Seedance options under providerOptions.bytedance. Frames and references are passed at the top level through frameImages and inputReferences, which change the call shape and are shown in their own examples below.
import { experimental_generateVideo as generateVideo } from 'ai';import fs from 'node:fs';import 'dotenv/config';
async function main() { const result = await generateVideo({ model: 'bytedance/seedance-2.5', prompt: 'A chicken flying into the sunset in the style of 90s anime', resolution: '1280x720', duration: 5, providerOptions: { bytedance: { seed: 42, 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 these Seedance-specific options under providerOptions.bytedance in your generateVideo call.
| Parameter | Type | Required | Description |
|---|---|---|---|
lastFrameImage | string | No | URL of the last frame image, enabling first+last frame mode. Legacy alternative to the top-level frameImages, used only when frameImages is omitted. |
referenceImages | string[] | No | Reference image URLs for reference-to-video, referenced in the prompt as [Image 1], [Image 2], and so on — see the Input limits table for the supported count. Legacy alternative to the top-level inputReferences, used only when inputReferences is omitted. |
referenceVideos | string[] | No | Reference video URLs for reference-to-video, numbered separately from the images and referenced in the prompt as [Video 1], [Video 2], and so on. Legacy alternative to the top-level inputReferences, used only when inputReferences is omitted. |
referenceAudio | string[] | No | Reference audio URLs, sent alongside the reference images and videos to drive the generated audio. |
seed | number | No | Fix the random seed for reproducible output. |
pollIntervalMs | number | No | How often to check task status. Defaults to 3000. |
pollTimeoutMs | number | No | Maximum wait time. Defaults to 300000 (5 minutes). |
Frames take priority over references
Frames and references are mutually exclusive. When frameImages is set, inputReferences and the legacy providerOptions.bytedance.referenceImages / referenceVideos are dropped with a warning.
The top-level parameters win over their provider-option equivalents: frameImages overrides prompt.image and lastFrameImage, and inputReferences overrides referenceImages and referenceVideos. Set one or the other, not both.
providerOptions.bytedance.referenceAudio has no top-level equivalent, so it stays a provider option and is sent alongside whichever reference path you use.
Reference-to-video
Pass reference media through the top-level inputReferences so the model keeps subjects, style, and composition consistent — see the Input limits table for the supported counts. Reference each one in the prompt with [Image 1], [Video 1], and so on; images and videos are numbered separately in the order you pass them. Tag every URL with an explicit mediaType, since Seedance cannot infer image or video from a bare URL.
import { experimental_generateVideo as generateVideo } from 'ai';import fs from 'node:fs';import 'dotenv/config';
async function main() { const result = await generateVideo({ model: 'bytedance/seedance-2.5', prompt: 'The lion from [Image 1] walks into the clearing from [Video 1], settles in the long grass, and watches the sun go down.', aspectRatio: '16:9', resolution: '1280x720', duration: 30, generateAudio: true, inputReferences: [ { data: 'https://example.com/lion.jpg', mediaType: 'image/jpeg' }, { data: 'https://example.com/clearing.mp4', mediaType: 'video/mp4' }, ], providerOptions: { bytedance: { 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);