Skip to main content
You can access video generation models and interact with them through a REST API. This page explains how to use the v1/responses endpoint to generate videos from text prompts, with examples for each input type. Before you start, check the supported models page to see which video generation models are available via shared endpoints (available out of the box) versus dedicated endpoints (custom deployments), since not every model or endpoint supports every modality.

Call the v1/responses endpoint

The v1/responses endpoint provides a unified interface for diverse AI tasks including video generation, with structured input and output handling. It’s built on Open Responses, an open-source initiative to create a standardized, provider-agnostic API specification that works across different AI providers and model backends.

Generate from a text prompt

For text-to-video generation, set input to a plain string describing the video you want. The model returns the generated video as base64-encoded data in output[0].content[0].image_data:
Pass a text string as the input field and read back the base64-encoded video data:

Configure generation parameters

The provider_options argument is an extension point in the Open Responses spec that lets each API provider expose parameters beyond the standard request fields. It’s used here to surface video generation controls such as dimensions and denoising steps. The following parameters are available under provider_options.image: Height and width: Video dimensions must be a multiple of 16 and are automatically scaled to a multiple of 16 if an incompatible integer is provided. Steps: steps has the greatest effect on generation time. Diffusion models work by iteratively refining a noisy initial state. More steps produce higher-quality results but take proportionally longer. You can experiment with steps when considering the tradeoffs of speed and quality. If you encounter memory errors, try reducing your output video dimensions or the number of denoising steps:

Generate a video from text

Generate a video from a text description by sending a request to the v1/responses endpoint. The input field is a text string describing the desired video, and provider_options controls generation parameters. You can send requests using either the OpenAI Python SDK or curl:
Send the prompt and write the decoded video to a file:
generate-video.py
Run the script to generate the video:
The model saves the generated video to output-text-to-video.mp4 in your current directory.
Your output should look similar to the following: