Skip to main content
Get started with the Camb.ai Browser SDK in minutes

Overview

The Camb.ai Browser SDK is designed for client-side applications, providing a simple, type-safe interface to integrate high-quality text-to-speech directly into your web apps.

Installation

Authentication

[!CAUTION] Security Warning: Hardcoding your API key in client-side code (HTML/JS) is not secure. Anyone visiting your site can inspect the source code and steal your key, which can lead to unauthorized usage and charges.
For production applications, it is highly recommended to route requests through a secure backend proxy:
  1. Store your Camb.ai API key securely on your server (e.g., in environment variables).
  2. Set up an endpoint on your server that forwards requests to Camb.ai and adds the x-api-key header.
  3. Implement authentication on your server to control who can use the TTS services.
Initialize the client to point to your proxy URL:

Development Only (Direct Client)

Use the API key directly only for local development or prototyping:

Quick Start

Streaming Text-to-Speech

Generate and play speech directly in the browser: (Assumes client is initialized as shown in the Authentication section).

Using the Helper Function

The SDK’s tts method returns binary data that can be easily converted to a URL for playback:

Choosing a Model

Camb.ai offers MARS models optimized for different use cases:

TTS Options

client.textToSpeech.tts(...) accepts a payload with the core request fields plus optional controls for model behavior and output format.

Listing Available Voices

Discover available voices for your application:

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 the Languages enum exports:

Using Custom Provider

For more details check this guide Custom Cloud Providers

Baseten Deployment

Initialize the client with provider configuration. Baseten Provider Example

Next 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

Resources

Last modified on June 18, 2026