> 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/lumalabs.md).

# Lumalabs

**LumaLabTools** enables an Agent to generate media using the [Lumalabs platform](https://lumalabs.ai/dream-machine).

### [​](https://docs.phidata.com/tools/lumalabs#prerequisites)Prerequisites <a href="#prerequisites" id="prerequisites"></a>

```shell
export LUMAAI_API_KEY=***
```

The following example requires the `lumaai` library. To install the Lumalabs client, run the following command:

```shell
pip install -U lumaai
```

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

The following agent will use Lumalabs to generate any video requested by the user.

cookbook/tools/lumalabs\_tool.py

```python
from bitca.agent import Agent
from bitca.llm.openai import OpenAIChat
from bitca.tools.lumalab import LumaLabTools

luma_agent = Agent(
    name="Luma Video Agent",
    llm=OpenAIChat(model="gpt-4o"),
    tools=[LumaLabTools()],  # Using the LumaLab tool we created
    markdown=True,
    debug_mode=True,
    show_tool_calls=True,
    instructions=[
        "You are an agent designed to generate videos using the Luma AI API.",
        "You can generate videos in two ways:",
        "1. Text-to-Video Generation:",
        "2. Image-to-Video Generation:",
        "Choose the appropriate function based on whether the user provides image URLs or just a text prompt.",
        "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.",
    ],
    system_message=(
        "Use generate_video for text-to-video requests and image_to_video for image-based "
        "generation. Don't modify default parameters unless specifically requested. "
        "Always provide clear feedback about the video generation status."
    ),
)

luma_agent.run("Generate a video of a car in a sky")
```

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

| Parameter | Type  | Default | Description                                          |
| --------- | ----- | ------- | ---------------------------------------------------- |
| `api_key` | `str` | `None`  | If you want to manually supply the Lumalabs API key. |

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

| Function         | Description                                                           |
| ---------------- | --------------------------------------------------------------------- |
| `generate_video` | Generate a video from a prompt.                                       |
| `image_to_video` | Generate a video from a prompt, a starting image and an ending image. |
