Veo2 (Text-to-Video)

This documentation is valid for the following list of our models:

  • veo2

Overview

Googleโ€™s cutting-edge AI model designed to generate highly realistic and cinematic video content from textual prompts or a combination of text and images. Leveraging advanced machine learning techniques, Veo2 excels in creating videos with natural motion, realistic physics, and professional-grade visual fidelity.

Key Features:

  • Text-to-Video (T2V): Converts descriptive text into dynamic video content.

  • High Resolution Support: Generates videos up to 4K resolution for professional-grade outputs.

  • Multimodal Input Encoding: Integrates text and image inputs seamlessly for creative flexibility.

Setup your API Key

If you donโ€™t have an API key for the AI/ML API yet, feel free to use our Quickstart guide.

How to Make a Call

Generating a video using this model involves sequentially calling two endpoints:

  • The first one is for creating and sending a video generation task to the server (returns a generation ID).

  • The second one is for requesting the generated video from the server using the generation ID received from the first endpoint.

Below, you can find two corresponding API schemas and examples for both endpoint calls.

API Schemas

Video Generation

You can generate a video using this API. In the basic setup, you only need a prompt, the aspect ratio, and the desired duration (5, 6, 7, or 8 seconds).

Fetch the video

Examples

Video generation

import requests


def main():
    url = "https://api.aimlapi.com/v2/generate/video/google/generation"
    payload = {
        "model": "veo2",
        "prompt": "A DJ on the stand is playing, around a World War II battlefield, lots of explosions, thousands of dancing soldiers, between tanks shooting, barbed wire fences, lots of smoke and fire, black and white old video: hyper realistic, photorealistic, photography, super detailed, very sharp, on a very white background",
        "aspect_ratio": "16:9",
        "duration": "5",
    }
    headers = {"Authorization": "Bearer <YOUR_AIMLAPI_KEY>", "Content-Type": "application/json"}

    response = requests.post(url, json=payload, headers=headers)
    print("Generation:", response.json())


if __name__ == "__main__":
    main()

Fetch the video

import requests


def main():
    url = "https://api.aimlapi.com/v2/generate/video/google/generation"
    params = {
        "generation_id": "<YOUR_GENERATION_ID>",
    }
    headers = {"Authorization": "Bearer <YOUR_AIMLAPI_KEY>", "Content-Type": "application/json"}

    response = requests.get(url, params=params, headers=headers)
    print("Generation:", response.json())


if __name__ == "__main__":
    main()

Last updated

Was this helpful?