Skip to main content

Video Generation

Video generation is an experimental feature. The API may change in future versions.
The AI SDK provides the experimental_generateVideo function to generate videos based on a given prompt using a video model.
You can access the video data using the base64 or uint8Array properties:

Settings

Aspect Ratio

The aspect ratio is specified as a string in the format {width}:{height}. Models only support a few aspect ratios, and the supported aspect ratios are different for each model and provider.

Resolution

The resolution is specified as a string in the format {width}x{height}. Models only support specific resolutions, and the supported resolutions are different for each model and provider.

Duration

Some video models support specifying the duration of the generated video in seconds.

Frames Per Second (FPS)

Some video models allow you to specify the frames per second for the generated video.

Generating Multiple Videos

experimental_generateVideo supports generating multiple videos at once:
experimental_generateVideo will automatically call the model as often as needed (in parallel) to generate the requested number of videos.

Provider Options

Video model settings can be configured using providerOptions for provider-specific parameters:

Response Information

The experimental_generateVideo function returns comprehensive response information:

Retries

The experimental_generateVideo function accepts an optional maxRetries parameter that you can use to set the maximum number of retries. It defaults to 2 retries (3 attempts in total). You can set it to 0 to disable retries.

Abort Signals and Timeouts

The experimental_generateVideo function accepts an optional abortSignal parameter of type AbortSignal that you can use to abort the generation process or set a timeout.

Custom Headers

The experimental_generateVideo function accepts an optional headers parameter that you can use to add custom headers to the request.

Video Providers & Models

Several providers offer video generation models: