> For the complete documentation index, see [llms.txt](https://docs.projectbit.ca/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.projectbit.ca/documentation/tools/modelslabs.md).

# ModelsLabs

### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

You need to install the `requests` library.

```bash
pip install requests
```

Set the `MODELS_LAB_API_KEY` environment variable.

```bash
export MODELS_LAB_API_KEY=****
```

### [​](https://docs.phidata.com/tools/models_labs#example)Example <a href="#example" id="example"></a>

The following agent will use ModelsLabs to generate a video based on a text prompt.

cookbook/tools/models\_labs\_tools.py

```python
from bitca.agent import Agent
from bitca.tools.models_labs import ModelsLabs

# Create an Agent with the ModelsLabs tool
agent = Agent(tools=[ModelsLabs()], name="ModelsLabs Agent")

agent.print_response("Generate a video of a beautiful sunset over the ocean", markdown=True)
```

### [​](https://docs.phidata.com/tools/models_labs#toolkit-params)Toolkit Params <a href="#toolkit-params" id="toolkit-params"></a>

| Parameter             | Type   | Default                                           | Description                                                                |
| --------------------- | ------ | ------------------------------------------------- | -------------------------------------------------------------------------- |
| `api_key`             | `str`  | `None`                                            | The ModelsLab API key for authentication                                   |
| `url`                 | `str`  | `"https://modelslab.com/api/v6/video/text2video"` | The API endpoint URL                                                       |
| `fetch_url`           | `str`  | `https://modelslab.com/api/v6/video/fetch`        | The URL to fetch the video status from                                     |
| `wait_for_completion` | `bool` | `False`                                           | Whether to wait for the video to be ready                                  |
| `add_to_eta`          | `int`  | `15`                                              | Time to add to the ETA to account for the time it takes to fetch the video |
| `max_wait_time`       | `int`  | `60`                                              | Maximum time to wait for the video to be ready                             |
| `file_type`           | `str`  | `"mp4"`                                           | The type of file to generate                                               |

### [​](https://docs.phidata.com/tools/models_labs#toolkit-functions)Toolkit Functions <a href="#toolkit-functions" id="toolkit-functions"></a>

| Function         | Description                                     |
| ---------------- | ----------------------------------------------- |
| `generate_media` | Generates a video or gif based on a text prompt |
