> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://murf.ai/api/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://murf.ai/api/docs/_mcp/server.

# LiveKit and Murf

Murf is available as an official TTS plugin for [LiveKit Agents](https://docs.livekit.io/agents/), a framework for building voice and multimodal conversational AI applications. Install the `livekit-plugins-murf` plugin to use Murf as a TTS provider in your LiveKit Agents, with high-quality voice synthesis and real-time streaming.

## Murf AI TTS plugin

The Murf plugin integrates Murf's text-to-speech capabilities with [LiveKit Agents](https://docs.livekit.io/agents/). Use it inside an `AgentSession` or as a standalone speech generator to add natural-sounding voice synthesis to LiveKit-powered conversational AI applications.

#### [LiveKit Murf AI plugin](https://docs.livekit.io/agents/models/tts/murf/)

Official Murf AI TTS plugin guide for LiveKit Agents

#### [livekit-plugins-murf](https://pypi.org/project/livekit-plugins-murf/)

Python package on PyPI

## Installation

Install the Murf plugin from PyPI as an extra of `livekit-agents`:

### Using pip

```bash
pip install "livekit-agents[murf]~=1.5"
```

### Using uv

```bash
uv add "livekit-agents[murf]~=1.5"
```

This installs `livekit-plugins-murf` alongside a compatible `livekit-agents` release.

## For Existing LiveKit Projects

If you already have a LiveKit project, you can quickly integrate Murf TTS by simply initializing the `murf.TTS()` class in your existing `AgentSession`. Make sure you have your Murf API key configured in your environment variables. You can get your Murf API key from the [Murf API Dashboard](https://murf.ai/api/dashboard):

```python
from livekit.plugins import murf

# Add Murf TTS to your existing session
session = AgentSession(
    stt="your-stt-provider",  # e.g., "deepgram/nova-3"
    llm="your-llm-provider",  # e.g., "openai/gpt-4o"
    tts=murf.TTS(voice="Gordon", style="Conversation", model="falcon-2")
    # ... your existing configuration
)
```

[View all configuration parameters →](#configuration)

## Guide to Building Voice Agents with Murf and LiveKit

This guide provides setup instructions and examples for building your first LiveKit Agent with Murf TTS.

## Setup & Requirements

Before running the examples above, ensure you have everything configured properly:

### Requirements

* Python >= 3.10
* livekit-agents\[murf] \~= 1.5

### Required Packages

The examples in this guide use the Murf TTS integration along with specific LiveKit plugins for speech-to-text (Deepgram), language models (OpenAI), and voice activity detection (Silero). Install all packages used in the examples:

```bash
pip install "livekit-agents[murf,openai,deepgram,silero]~=1.5" python-dotenv
```

### API Keys

You'll need API keys for the services used in your LiveKit Agent:

* **Murf API Key**: Sign up at the [Murf API Dashboard](https://murf.ai/api/dashboard) and generate your API key
* **LiveKit API Credentials**: Get your LiveKit server URL, API key, and secret from [LiveKit Cloud](https://cloud.livekit.io/).
* **Additional Services**: Depending on your setup, you may need API keys for STT (e.g., Deepgram) and LLM (e.g., OpenAI) services

### Environment Variables

To keep your API keys secure, it's recommended to use environment variables. Create a `.env` file in your project root:

```env
LIVEKIT_URL=wss://your-livekit-server.livekit.cloud  # Your LiveKit server URL
LIVEKIT_API_KEY=your_livekit_api_key_here           # Your LiveKit API key
LIVEKIT_API_SECRET=your_livekit_api_secret_here     # Your LiveKit API secret
MURF_API_KEY=your_murf_api_key_here
DEEPGRAM_API_KEY=your_deepgram_api_key_here         # Required for STT
OPENAI_API_KEY=your_openai_api_key_here             # Required for LLM
```

Then load these variables in your Python code using `python-dotenv`:

```python
from dotenv import load_dotenv
load_dotenv()
```

### Quick Start Example

Here's a simple example of how to create a LiveKit Agent Worker with Murf TTS:

```python
import logging
import os
from dotenv import load_dotenv

load_dotenv()

from livekit.agents import (
    Agent,
    AgentServer,
    AgentSession,
    JobContext,
    JobProcess,
    MetricsCollectedEvent,
    cli,
    metrics,
    room_io,
)
from livekit.plugins import silero, deepgram, murf
from livekit.plugins import openai as openai_plugin

logger = logging.getLogger("murf-agent")

class MyAgent(Agent):
    def __init__(self) -> None:
        super().__init__(
            instructions="You are a voice agent built using Murf TTS. Keep responses short and natural."
        )

    async def on_enter(self):
        await self.session.say(
            "Hi, I am a voice agent powered by Murf, how can I help you?"
        )

server = AgentServer()

def prewarm(proc: JobProcess):
    proc.userdata["vad"] = silero.VAD.load()

server.setup_fnc = prewarm

@server.rtc_session()
async def entrypoint(ctx: JobContext):
    ctx.log_context_fields = {"room": ctx.room.name}

    session = AgentSession(
        stt="deepgram/nova-3",
        llm="openai/gpt-4o",
        tts=murf.TTS(voice="Gordon", style="Conversation"),
        vad=ctx.proc.userdata["vad"],
        preemptive_generation=True,
        resume_false_interruption=True,
        false_interruption_timeout=1.0,
    )

    usage_collector = metrics.UsageCollector()

    @session.on("metrics_collected")
    def on_metrics(ev: MetricsCollectedEvent):
        metrics.log_metrics(ev.metrics)
        usage_collector.collect(ev.metrics)

    async def log_usage():
        logger.info(f"Usage: {usage_collector.get_summary()}")

    ctx.add_shutdown_callback(log_usage)

    await session.start(
        agent=MyAgent(),
        room=ctx.room,
        room_options=room_io.RoomOptions(
            audio_input=room_io.AudioInputOptions()
        ),
    )

if __name__ == "__main__":
    cli.run_app(server)
```

Save this code as `agent.py` and run it with:

```bash
python agent.py console
```

This will start the agent in console where you can directly speak with the agent in the terminal and hear responses in Murf's natural voice.

![Livekit terminal Session](/api/docs/_fern-img/6dac2ab25d723a1c209f1495f61a81c094d130a55e1dfea7f736cb46a89d31a5.webp)

## Configuration

The `murf.TTS` class provides extensive configuration options to customize the voice output according to your needs.

### TTS Parameters Reference

| Parameter | Type  | Default          | Range/Options                    | Description                                     |
| --------- | ----- | ---------------- | -------------------------------- | ----------------------------------------------- |
| `voice`   | `str` | `"Gordon"`       | Any valid Murf voice ID          | Voice identifier for TTS synthesis              |
| `style`   | `str` | `"Conversation"` | Voice-specific styles            | Voice style (e.g., "Conversation", "Narration") |
| `speed`   | `int` | `0`              | `-50` to `50`                    | Speech rate adjustment                          |
| `pitch`   | `int` | `0`              | `-50` to `50`                    | Pitch adjustment                                |
| `model`   | `str` | `"falcon-2"`     | `"falcon-2"`, `"gen2"`           | The model to use for audio output               |
| `locale`  | `str` | `None`           | Language codes (e.g., `"en-US"`) | Locale for language-specific voice synthesis    |

### Complete Example with Custom Configuration

Here's a more advanced example showing how to customize the Murf TTS configuration with metrics and error handling:

```python
import logging
import os
from dotenv import load_dotenv

load_dotenv()

from livekit.agents import (
    Agent,
    AgentServer,
    AgentSession,
    JobContext,
    JobProcess,
    MetricsCollectedEvent,
    cli,
    metrics,
    room_io,
)
from livekit.plugins import silero, deepgram, murf
from livekit.plugins import openai as openai_plugin

logger = logging.getLogger("murf-agent")

class CustomAgent(Agent):
    def __init__(self) -> None:
        super().__init__(
            instructions="You are a helpful assistant with a natural speaking style. Provide detailed but concise responses."
        )

    async def on_enter(self):
        await self.session.say(
            "Hello! I'm powered by Murf's high-quality voice synthesis. How can I assist you today?"
        )

server = AgentServer()

def prewarm(proc: JobProcess):
    proc.userdata["vad"] = silero.VAD.load()

server.setup_fnc = prewarm

@server.rtc_session()
async def entrypoint(ctx: JobContext):
    ctx.log_context_fields = {"room": ctx.room.name}

    session = AgentSession(
        stt="deepgram/nova-3",
        llm="openai/gpt-4o",
        tts=murf.TTS(
            voice="Gordon",
            style="Conversation",
            speed=5,
            pitch=0,
            model="falcon-2",
            sample_rate=24000,
            locale="en-US",
        ),
        vad=ctx.proc.userdata["vad"],
        preemptive_generation=True,
        resume_false_interruption=True,
        false_interruption_timeout=1.0,
    )

    usage_collector = metrics.UsageCollector()

    @session.on("metrics_collected")
    def on_metrics(ev: MetricsCollectedEvent):
        metrics.log_metrics(ev.metrics)
        usage_collector.collect(ev.metrics)

    async def log_usage():
        summary = usage_collector.get_summary()
        logger.info(f"Session usage: {summary}")

    ctx.add_shutdown_callback(log_usage)

    await session.start(
        agent=CustomAgent(),
        room=ctx.room,
        room_options=room_io.RoomOptions(
            audio_input=room_io.AudioInputOptions()
        ),
    )

if __name__ == "__main__":
    cli.run_app(server)
```

> 💡 **Try it out**: For complete working examples and deployment guides, see the [LiveKit Murf AI plugin guide](https://docs.livekit.io/agents/models/tts/murf/).

## Features

The Murf TTS integration for LiveKit Agents provides a comprehensive set of features for building voice applications:

* **High-Quality Voice Synthesis**: Leverage Murf's advanced TTS technology with access to over 150 voices across 35+ languages
* **Real-time Streaming**: WebSocket-based streaming for low-latency audio generation, perfect for interactive conversations
* **Voice Customization**: Control voice style, rate and  pitch to match your application's needs
* **Multi-Language Support**: Multiple languages and locales with native speaker quality
* **Agent Framework Integration**: Seamless integration with LiveKit's Agent framework for building conversational AI
* **Flexible Configuration**: Comprehensive audio format and quality options including sample rate, channel type, and output formats

## Available Voices

#### [Find your Perfect Voice](https://murf.ai/api/products/text-to-speech/Falcon?utm_source=murf_api_docs)

Explore, preview, and select from 150+ voices in 20+ expressive styles

## Support

If you encounter any issues or have questions:

* **Murf API**: [Documentation](https://murf.ai/api/docs) · [support@murf.ai](mailto:support@murf.ai)
* **LiveKit plugin**: [Plugin guide](https://docs.livekit.io/agents/models/tts/murf/) · [Plugin reference](https://docs.livekit.io/reference/python/livekit/plugins/murf/index.html) · [Source](https://github.com/livekit/agents)