Generate a video
To generate a video, setinput to a text description of the video and set
generation parameters in provider_options.image.
The following example generates a video from a text prompt and saves it as
output-text-to-video.mp4.
- Python
- curl
Send a prompt, decode the returned video data, and save the video:
generate-video.py
Generate a video from an image
To generate a video from an image, setinput to a user message containing:
- An
input_imageblock with an image URL or base64-encoded data URI. - An
input_textblock describing how to animate the image.
input.png, encodes it as a
data URI, and saves the generated video as output-image-to-video.mp4.
- Python
- curl
Encode the input image, send it with a prompt, and save the generated video:
generate-video-from-image.py