Video generation options.
A promise resolving to the generation result with video data and metadata.
// Text-to-video
const result = await generateVideo({
prompt: 'A drone flying over a misty forest at sunrise',
provider: 'runway',
durationSec: 5,
});
console.log(result.videos[0].url);
// Image-to-video
const i2v = await generateVideo({
prompt: 'Camera slowly zooms out',
image: fs.readFileSync('input.png'),
});
// Image by URL, with resolution, reference images and a model input
const clip = await generateVideo({
provider: 'fal',
model: 'fal-ai/minimax/hailuo-02/standard/image-to-video',
prompt: 'The lantern swings',
image: 'https://cdn.example.com/start.png',
resolution: '768P',
providerOptions: { fal: { end_image_url: 'https://cdn.example.com/end.png' } },
});
Generates a video using a provider-agnostic interface.
Resolves provider credentials via explicit options or environment variable auto-detection, initialises the matching video provider (optionally wrapped in a fallback chain), and returns a normalised GenerateVideoResult.
When
opts.imageis provided (aBufferor a non-empty URL), the request is routed to IVideoGenerator.imageToVideo for image-to-video generation. Otherwise, IVideoGenerator.generateVideo is used for text-to-video.