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

# Lumalabs

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

## Prerequisites

```shell theme={null}
export LUMAAI_API_KEY=***
```

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

```shell theme={null}
pip install -U lumaai
```

## Example

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

```python cookbook/tools/lumalabs_tool.py theme={null}
from phi.agent import Agent
from phi.llm.openai import OpenAIChat
from phi.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")
```

## Toolkit Params

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

## Toolkit Functions

| 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. |

## Information

* View on [Github](https://github.com/agno-agi/phidata/blob/main/phi/tools/lumalab.py)
