Overview
The Camb.ai Rust SDK provides a simple interface to integrate high-quality text-to-speech into your applications. This quickstart will have you generating speech in under 5 minutes.Installation
Add the following to yourCargo.toml:
Authentication
Get your API key from CAMB.AI Studio and set it as an environment variable:Quick Start
Streaming Text-to-Speech
Generate and stream speech in real-time. The SDK usestokio for async and returns a stream of bytes:
Using the Helper Function
You can easily wrap the stream processor into a helper function:Choosing a Model
Camb.ai offers three MARS models optimized for different use cases:MARS Flash
Sample rate: 22.05kHz
MARS Pro
Sample rate: 48kHz
MARS Instruct
Sample rate: 22.05kHz
Listing Available Voices
Discover available voices for your application:Language Support
Camb.ai supports 140+ languages. Specify the language using theCreateStreamTtsRequestPayloadLanguage enum:
Languages supported by each model mentioned at MARS Models.
Error Handling
Handle common errors gracefully:Using Custom Provider
For more details check this guide Custom Cloud ProvidersBaseten Deployment
Initialize the client with your API key and the specific model URL. Baseten Provider ExampleNext Steps
Voice Agents
Build real-time voice agents with Pipecat
LiveKit Integration
Create voice agents with LiveKit
API Reference
Explore the full TTS API
Voice Library
Browse available voices