Skip to main content
Beta. Realtime speech-to-speech translation is available for testing in the Python and TypeScript SDKs. Event shapes, configuration options, audio formats, and error semantics may change in backwards-incompatible ways before GA. Pin to the SDK version you test against.

Overview

Speak (or stream a file) in one language and receive the translation as live text and synthesized speech over a single WebSocket. The session exposes a typed event dispatcher, a built-in microphone helper, and a forward-compatible on_any subscription for events the server may add in future releases. Key features:
  • Translated text and audio β€” receive incremental translated text (response.text.delta / response.text.done) and translated speech audio (response.audio.delta) as you speak.
  • Typed events β€” a single ServerEventType enum with per-event typed payloads.
  • Microphone + file helpers β€” Microphone (via sounddevice) and FileAudioSource ship with the SDK.
  • Easy extensibility β€” new server event = one enum entry + one payload type + one parser entry.
Audio is PCM16, mono, 24 kHz in both directions β€” the rate the realtime endpoint expects for input and emits for output.

Prerequisites

1

Create an account

Sign up at CAMB.AI Studio if you haven’t already.
2

Get your API key

Go to Settings β†’ API Keys in Studio and copy your key. See Authentication for details.
3

Install the SDK

Skip this step if you’re using the direct API.
4

Set your API key to use in your code


Supported languages

source_language and target_language accept the BCP-47 tags below (case-insensitive). Pick any supported language as the source and any supported language as the target. See the WebSocket API reference for the authoritative list.

Get Started

Create an API Key

Generate a key at CAMB.AI Studio and export it as CAMB_API_KEY for the snippets below.

Install

In Python, sounddevice ships with camb-sdk, so the Microphone and Speaker helpers work out of the box (on Linux you may need PortAudio, e.g. apt install libportaudio2). In Node, microphone capture uses node-record-lpcm16 and audio playback uses the SDK’s SoX-backed speaker β€” both need the host sox binary (e.g. brew install sox).

Quickstart (microphone)

Speak into your mic; the translated speech plays back through your speakers and the translated text prints as it arrives.

Quickstart (file β†’ file)

Useful on machines with no microphone (CI, servers). The input WAV must be 16-bit PCM, mono, 24 kHz; the translated audio is written to an output WAV.
Re-encode any source file to the required format with:
Feed the session clear speech. Music, silence, or noisy/low-quality audio may not be recognized by the speech model, in which case no transcript or translation is produced for that audio.

Events and Payloads

Supported events

All events are exposed through the ServerEventType enum.
Translated text arrives via TEXT_DELTA / TEXT_DONE and translated speech via AUDIO_DELTA. A source-language transcript (TRANSCRIPT_COMPLETED) is not emitted for every session, so don’t rely on it as your only signal.
Catch-all subscription. A future server event the SDK doesn’t model yet is still delivered to any handler registered via session.on_any(...) with the raw payload, so applications stay forward-compatible.

Subscribing to events


Configuration

Voice selection. Translated speech uses a built-in voice for the target language by default. Pass voice_id (voiceId in TypeScript) to synthesize it with one of your cloned voices instead. For the most natural-sounding results, choose a voice whose reference language matches target_language.

More Information

Last modified on June 7, 2026