Skip to main content
Integration with LiveKit is currently being reviewed

Overview

The livekit-plugins-camb package enables you to integrate Camb.ai’s MARS text-to-speech models into your LiveKit voice agents. This integration provides high-quality, low-latency voice synthesis for real-time conversational AI applications.

Key Features

  • MARS Models: Access to Camb.ai’s latest generation TTS models (mars-flash, mars-pro)
  • Multilingual: Up to 312 languages depending on the MARS model — see Language Support
  • Real-time Streaming: HTTP chunked streaming for low-latency audio
  • Voice Customization: Voice selection and enhanced pronunciation for names/places
  • Model-specific Sample Rates: 22.05kHz (mars-flash) or 48kHz (mars-pro)

Installation

Prerequisites

  • Python 3.9 or higher
  • A Camb.ai API key (get one here)
  • LiveKit Cloud account or self-hosted LiveKit server

Install the Plugin

For a complete voice agent setup with VAD (Voice Activity Detection):

Quick Start

1. Set Up Environment Variables

Create a .env file in your project directory:

2. Create Your Voice Agent

3. Run Your Agent

Development mode (with LiveKit Agents Playground):
Production mode:

Configuration

TTS Options

The camb.TTS class accepts the following parameters:

Available Models

Language Support

Camb.ai supports up to 312 languages depending on the MARS model — see Language Support for the full per-model locale list. Specify the language using BCP-47 codes:

Advanced Usage

Dynamic Option Updates

Update TTS settings during a session:

Function Tools

Add custom capabilities to your agent using the @function_tool decorator. The LLM automatically discovers these functions and calls them based on user conversation.
For more details, see the LiveKit Function Tools documentation.

Custom HTTP Session

For advanced use cases, provide your own aiohttp session:

Metrics and Logging

Track usage and performance:

Full Voice Agent Example

Here’s a full example combining all features.

Installation

Code

Run

Development mode (opens playground in browser):
Production mode:
Then connect via the LiveKit Agents Playground.

Troubleshooting

Common Issues

Ensure your CAMB_API_KEY environment variable is set correctly:
Or pass it directly:
The voice ID must be an integer. Use list_voices() to find available voices:
TTS synthesis can take time for longer texts. The plugin automatically uses a minimum 60-second timeout.For very long texts, consider breaking them into smaller chunks.
  • Use mars-pro for highest quality (48kHz) or mars-flash for best latency (22.05kHz)
  • Ensure your network connection is stable
  • Use pcm_s16le format for lowest latency
Check that you can reach the Camb.ai API:

Debug Logging

Enable debug logging for detailed information:

Resources