Seedance 2.0 Mini
import { experimental_generateVideo as generateVideo } from 'ai';
const result = await generateVideo({ model: 'bytedance/seedance-2.0-mini', prompt: 'A serene mountain lake at sunrise.'});Getting started
Generate videos with Seedance 2.0 Mini 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: 'bytedance/seedance-2.0-mini', 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: 'bytedance/seedance-2.0-mini', 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);| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Text description of the video to generate. |
duration | number | No | Video length in seconds. |
aspectRatio | string | No | Aspect ratio, e.g. 16:9. |
resolution | string | No | Output resolution as {width}x{height}. |
Provider options
Pass provider-specific options under providerOptions.bytedance.
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: 'bytedance/seedance-2.0-mini', prompt: 'A drone shot of a coastal cliff with crashing waves at golden hour.', duration: 5, 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);Pass these under providerOptions.bytedance in your generateVideo call.
| Parameter | Type | Required | Description |
|---|---|---|---|
providerOptions.bytedance.pollIntervalMs | number | No | How often to check task status. Defaults to 5000. |
providerOptions.bytedance.pollTimeoutMs | number | No | Maximum wait time. Defaults to 600000 (10 minutes). |