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

# Lumalabs

**LumaLabTools** 允许 Agent 使用 [Lumalabs 平台](https://lumalabs.ai/dream-machine) 生成媒体。

## 先决条件

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

以下示例需要 `lumaai` 库。要安装 Lumalabs 客户端，请运行以下命令：

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

## 示例

下面的 Agent 将使用 Lumalabs 根据用户请求生成任何视频。

```python cookbook/tools/lumalabs_tool.py theme={null}
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.lumalab import LumaLabTools

luma_agent = Agent(
    name="Luma Video Agent",
    model=OpenAIChat(id="gpt-4o"),
    tools=[LumaLabTools()],  # 使用我们创建的 LumaLab 工具
    markdown=True,
    debug_mode=True,
    show_tool_calls=True,
    instructions=[
        "你是一个用于使用 Luma AI API 生成视频的 Agent。",
        "你可以通过两种方式生成视频：",
        "1. 文本到视频生成：",
        "2. 图像到视频生成：",
        "根据用户提供的是图片 URL 还是仅提示词来选择合适的函数。",
        "视频将自动显示在你的响应下方的 UI 中，因此你无需在响应中显示视频 URL。",
    ],
    system_message=(
        "对于文本到视频请求使用 generate_video，对于基于图像的生成使用 image_to_video。"
        "除非特别要求，否则不要修改默认参数。 "
        "始终提供关于视频生成状态的清晰反馈。"
    ),
)

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

## Toolkit 参数

| 参数名       | 类型    | 默认值    | 描述                        |
| --------- | ----- | ------ | ------------------------- |
| `api_key` | `str` | `None` | 如果你想手动提供 Lumalabs API 密钥。 |

## Toolkit 功能

| 功能               | 描述                  |
| ---------------- | ------------------- |
| `generate_video` | 从提示词生成视频。           |
| `image_to_video` | 从提示词、起始图像和结束图像生成视频。 |

## 开发者资源

* 查看 [Tools](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/lumalabs.py)
* 查看 [Cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/tools/lumalabs_tools.py)
