> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Video (ModelsLabTools)

> Generate a video from a text prompt with ModelsLabTools and read the result from response.videos.

Create an agent that generates videos using the ModelsLab API.

## Code

```python generate_video_using_models_lab.py theme={null}
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.models_labs import ModelsLabTools

video_agent = Agent(
    model=OpenAIResponses(id="gpt-5.2"),
    tools=[ModelsLabTools()],
    description="You are an AI agent that can generate videos using the ModelsLabs API.",
    instructions=[
        "When the user asks you to create a video, use the `generate_media` tool to create the video.",
        "The video will be displayed in the UI automatically below your response, so you don't need to show the video URL in your response.",
        "Politely and courteously let the user know that the video has been generated and will be displayed below as soon as its ready.",
    ],
    markdown=True,
)

video_agent.print_response("Generate a video of a cat playing with a ball")
# To access the generated videos:
# response = video_agent.run("Generate a video of a cat playing with a ball")
# print(response.videos)
```

## Usage

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno openai requests
    ```
  </Step>

  <Step title="Export your API keys">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
        export OPENAI_API_KEY="your_openai_api_key_here"
        export MODELS_LAB_API_KEY="your_models_lab_api_key_here"
      ```

      ```bash Windows theme={null}
        $Env:OPENAI_API_KEY="your_openai_api_key_here"
        $Env:MODELS_LAB_API_KEY="your_models_lab_api_key_here"
      ```
    </CodeGroup>
  </Step>

  <Step title="Run Agent">
    ```bash theme={null}
    python generate_video_using_models_lab.py
    ```
  </Step>
</Steps>
