Skip to main content

Overview

CambTTSService provides high-quality text-to-speech synthesis using Camb AI’s MARS model family with streaming capabilities. The service offers multiple model options optimized for different use cases: mars-flash for fast inference and mars-pro for high-quality output.

Installation

To use Camb AI services, install the required dependencies:
pip install "pipecat-ai[camb]"

Prerequisites

Camb AI Account Setup

Before using Camb AI TTS services, you need:
  1. Camb AI Account: Sign up at Camb AI
  2. API Key: Generate an API key from your account dashboard
  3. Voice Selection: Choose voice IDs from the platform

Required Environment Variables

  • CAMB_API_KEY: Your Camb AI API key for authentication

Configuration

CambTTSService

api_key
str
required
Camb.ai API key for authentication.
voice_id
int
default:"147320"
Voice ID to use for synthesis.
model
str
default:"mars-flash"
TTS model to use. Options: "mars-flash" (fast, 22.05kHz), "mars-pro" (high quality, 48kHz), "mars-instruct" (instruction-following, 22.05kHz).
timeout
float
default:"60.0"
Request timeout in seconds. 60 seconds is the minimum recommended by Camb.ai.
sample_rate
int
default:"None"
Output audio sample rate in Hz. If None, uses the model-specific default (22050 for mars-flash, 48000 for mars-pro).
params
InputParams
default:"None"
Runtime-configurable voice settings. See InputParams below.

InputParams

Voice and generation settings that can be set at initialization via the params constructor argument.
ParameterTypeDefaultDescription
languageLanguageLanguage.ENLanguage for synthesis (BCP-47 format).
user_instructionsstrNoneCustom instructions for mars-instruct model only. Use to control tone, style, or pronunciation. Max 1000 characters. Ignored for other models.

Usage

Basic Setup

from pipecat.services.camb import CambTTSService

tts = CambTTSService(
    api_key=os.getenv("CAMB_API_KEY"),
    model="mars-flash",
)

High Quality with mars-pro

tts = CambTTSService(
    api_key=os.getenv("CAMB_API_KEY"),
    voice_id=12345,
    model="mars-pro",
)

With Language Customization

from pipecat.transcriptions.language import Language

tts = CambTTSService(
    api_key=os.getenv("CAMB_API_KEY"),
    model="mars-flash",
    params=CambTTSService.InputParams(
        language=Language.FR,
    ),
)

Notes

Set the audio_out_sample_rate in PipelineParams to match the model’s sample rate (22050 for mars-flash, 48000 for mars-pro) for optimal quality. See the example implementation for usage.
  • Model-specific sample rates: Each model has a fixed output sample rate. Setting a mismatched sample_rate will produce a warning and may cause audio issues.
  • Text length limit: Input text is limited to 3000 characters per request. Longer text is automatically truncated with a warning.
  • 140+ languages: Camb.ai supports a wide range of languages through BCP-47 codes.