ByteDance text-to-video generation example
Example of generating a video from a text prompt: import { byteDance, type ByteDanceVideoModelOptions } from '@ai-sdk/bytedance'; import { experimental_generateVideo as generateVideo } from 'ai'; const { video } = await generateVideo({ model: byteDance.video('seedance-1-0-pro-250528'), prompt: 'Photorealistic style: Under a clear blue sky, a vast expanse of white daisy fields stretches out. The camera gradually zooms in and fixates on a close-up of a single daisy.', aspectRatio: '16:9', duration: 5, providerOptions: { bytedance: { watermark: false, } satisfies ByteDanceVideoModelOptions, }, }); console.log(video.url);
ByteDance image-to-video generation example
Example of generating a video from a first-frame image with optional text prompt: import { byteDance, type ByteDanceVideoModelOptions } from '@ai-sdk/bytedance'; import { experimental_generateVideo as generateVideo } from 'ai'; const { video } = await generateVideo({ model: byteDance.video('seedance-1-5-pro-251215'), prompt: { image: 'https://example.com/first-frame.png', text: 'The cat slowly turns its head and blinks', }, duration: 5, providerOptions: { bytedance: { watermark: false, } satisfies ByteDanceVideoModelOptions, }, });
ByteDance image-to-video with audio example
Example of generating video with synchronized audio (Seedance 1.5 Pro): import { byteDance, type ByteDanceVideoModelOptions } from '@ai-sdk/bytedance'; import { experimental_generateVideo as generateVideo } from 'ai'; const { video } = await generateVideo({ model: byteDance.video('seedance-1-5-pro-251215'), prompt: { image: 'https://example.com/pianist.png', text: 'A young man sits at a piano, playing calmly. Gentle piano music plays in sync with his movements.', }, duration: 5, providerOptions: { bytedance: { generateAudio: true, watermark: false, } satisfies ByteDanceVideoModelOptions, }, });
ByteDance first-and-last frame video example
Example of generating smooth transitions between starting and ending keyframe images: import { byteDance, type ByteDanceVideoModelOptions } from '@ai-sdk/bytedance'; import { experimental_generateVideo as generateVideo } from 'ai'; const { video } = await generateVideo({ model: byteDance.video('seedance-1-5-pro-251215'), prompt: { image: 'https://example.com/first-frame.jpg', text: 'Create a 360-degree orbiting camera shot based on this photo', }, duration: 5, providerOptions: { bytedance: { lastFrameImage: 'https://example.com/last-frame.jpg', generateAudio: true, watermark: false, } satisfies ByteDanceVideoModelOptions, }, });
ByteDance multi-reference image-to-video example
Example using Seedance 1.0 Lite I2V with multiple reference images (1-4): import { byteDance, type ByteDanceVideoModelOptions } from '@ai-sdk/bytedance'; import { experimental_generateVideo as generateVideo } from 'ai'; const { video } = await generateVideo({ model: byteDance.video('seedance-1-0-lite-i2v-250428'), prompt: 'A boy wearing glasses and a blue T-shirt from [Image 1] and a corgi dog from [Image 2], sitting on the lawn from [Image 3], in 3D cartoon style', aspectRatio: '16:9', duration: 5, providerOptions: { bytedance: { referenceImages: ['https://example.com/boy.png', 'https://example.com/corgi.png', 'https://example.com/lawn.png'], watermark: false, } satisfies ByteDanceVideoModelOptions, }, });
ByteDance reference video example
Example of using reference videos to guide style, motion, or composition (Seedance 2.0): import { byteDance, type ByteDanceVideoModelOptions } from '@ai-sdk/bytedance'; import { experimental_generateVideo as generateVideo } from 'ai'; const { video } = await generateVideo({ model: byteDance.video('dreamina-seedance-2-0-260128'), prompt: 'First-person perspective promotional ad, using the composition and camera movement from the reference video', aspectRatio: '16:9', duration: 4, providerOptions: { bytedance: { referenceVideos: ['https://example.com/reference-video.mp4'], watermark: false, } satisfies ByteDanceVideoModelOptions, }, });
ByteDance reference audio example
Example of using reference audio as background music or sound (Seedance 2.0): import { byteDance, type ByteDanceVideoModelOptions } from '@ai-sdk/bytedance'; import { experimental_generateVideo as generateVideo } from 'ai'; const { video } = await generateVideo({ model: byteDance.video('dreamina-seedance-2-0-260128'), prompt: 'A serene mountain landscape at sunrise with gentle camera movement', aspectRatio: '16:9', duration: 4, providerOptions: { bytedance: { referenceAudio: ['https://example.com/background-music.mp3'], generateAudio: true, watermark: false, } satisfies ByteDanceVideoModelOptions, }, });