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

# Eleven Labs

> Generate speech and sound effects from text using the ElevenLabs API.

**ElevenLabsTools** enable an Agent to perform audio generation tasks using [ElevenLabs](https://elevenlabs.io/docs/product/introduction)

## Prerequisites

You need to install the `elevenlabs` library and an API key which can be obtained from [Eleven Labs](https://elevenlabs.io/)

```bash theme={null}
uv pip install elevenlabs google-genai
```

Set the `ELEVEN_LABS_API_KEY` environment variable.

```bash theme={null}
export ELEVEN_LABS_API_KEY=****
```

## Example

The following agent will use Eleven Labs to generate audio based on a user prompt.

```python cookbook/91_tools/elevenlabs_tools.py theme={null}
import base64

from agno.agent import Agent
from agno.models.google import Gemini
from agno.tools.eleven_labs import ElevenLabsTools
from agno.utils.media import save_base64_data

audio_agent = Agent(
    model=Gemini(id="gemini-2.5-pro"),
    tools=[
        ElevenLabsTools(
            voice_id="21m00Tcm4TlvDq8ikWAM",
            model_id="eleven_multilingual_v2",
        )
    ],
    description="You are an AI agent that can generate audio using the ElevenLabs API.",
    instructions=[
        "Use the `text_to_speech` tool to convert text into natural voice audio.",
        "Use the `generate_sound_effect` tool to create sound effects from text descriptions.",
    ],
    markdown=True,
)

response = audio_agent.run("Generate an audio summary of the french revolution")

if response.audio:
    print("Agent response:", response.content)
    base64_audio = base64.b64encode(response.audio[0].content).decode("utf-8")
    save_base64_data(base64_audio, "tmp/french_revolution.mp3")
```

## Toolkit Params

| Parameter                      | Type            | Default                  | Description                                                                                                                                         |
| ------------------------------ | --------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `api_key`                      | `Optional[str]` | `None`                   | The Eleven Labs API key for authentication                                                                                                          |
| `voice_id`                     | `str`           | `JBFqnCBsd6RMkjVDRZzb`   | The voice ID to use for the audio generation                                                                                                        |
| `target_directory`             | `Optional[str]` | `None`                   | The directory to save the audio file                                                                                                                |
| `model_id`                     | `str`           | `eleven_multilingual_v2` | The model's id to use for the audio generation                                                                                                      |
| `output_format`                | `str`           | `mp3_44100_64`           | The output format to use for the audio generation (see [the docs](https://elevenlabs.io/docs/api-reference/text-to-speech#parameter-output-format)) |
| `enable_text_to_speech`        | `bool`          | `True`                   | Enable the text\_to\_speech functionality.                                                                                                          |
| `enable_generate_sound_effect` | `bool`          | `True`                   | Enable the generate\_sound\_effect functionality.                                                                                                   |
| `enable_get_voices`            | `bool`          | `True`                   | Enable the get\_voices functionality.                                                                                                               |
| `all`                          | `bool`          | `False`                  | Enable all functionality.                                                                                                                           |

## Toolkit Functions

| Function                | Description                                     |
| ----------------------- | ----------------------------------------------- |
| `text_to_speech`        | Convert text to speech                          |
| `generate_sound_effect` | Generate sound effect audio from a text prompt. |
| `get_voices`            | Get the list of voices available                |

## Developer Resources

* [Tools](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/eleven_labs.py)
