Function generateVideo

  • 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.image is provided, the request is routed to IVideoGenerator.imageToVideo for image-to-video generation. Otherwise, IVideoGenerator.generateVideo is used for text-to-video.

    Parameters

    Returns Promise<GenerateVideoResult>

    A promise resolving to the generation result with video data and metadata.

    Example

    // 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'),
    });