Skip to main content

Getting started with the CAMB.AI API

Get an API key, make your first request with the Python SDK and choose a speech model.

The CAMB.AI API lets you add our speech, dubbing and translation models to your own apps. This guide covers getting an API key, making your first request with the Python SDK, and where to go next in the developer docs.

What you can build

  • Text-to-Speech: streaming speech in hundreds of languages and locales.

  • Dubbing: dub a video or audio file into other languages.

  • Translation and transcription: translate text, transcribe audio and create subtitles.

  • Voices: list voices, create custom voices and generate a voice from a text description.

  • Audio tools: audio separation and sound generation from text.

The full list of endpoints is in the developer docs.

Step 1: Get your API key

  1. Sign in to CAMB.AI Studio.

  2. Open the API section (from the Home page, or Settings › API Keys).

  3. Create or copy your API key.

Treat your key like a password: don't share it or put it in client-side code. API requests use credits, like generating in Studio.

Step 2: Authenticate

Send your key in the x-api-key header on every request. (The API does not use a Bearer token.)

x-api-key: YOUR_API_KEY

The base URL is https://client.camb.ai/apis. If the key is missing or invalid you'll get a 401 error.

Step 3: Make your first request (Python)

Install the SDK (Python 3.9 or later):

pip install camb-sdk

Save your key as an environment variable:

export CAMB_API_KEY="your_api_key_here"

Then generate speech and save it to a file:

import os from camb.client import CambAI, save_stream_to_file  client = CambAI(api_key=os.getenv("CAMB_API_KEY"))  stream = client.text_to_speech.tts(     text="Hello from Camb.ai.",     language="en-us",     voice_id=147320,     speech_model="mars-flash", ) save_stream_to_file(stream, "output.wav")

Using Node.js? Install the TypeScript SDK with npm install @camb-ai/sdk. See the SDK guides for both.

Choose a speech model

Set the model with the speech_model parameter:

  • mars-flash: lowest latency, for real-time voice agents and call centres.

  • mars-pro: balanced speed and quality, for dubbing, audiobooks and media.

  • mars-instruct: fine control over emotion and delivery, for TV and film (not real-time).

  • mars-8.1-flash-beta and mars-8.1-pro-beta: the newest MARS8.1 models, with the widest language coverage.

For a plain-language comparison, see Which speech model should I choose? and Supported languages.

Long jobs: create, check, fetch

Streaming Text-to-Speech returns audio straight away. Longer jobs (dubbing, translation, transcription, subtitles and others) run as tasks:

  1. Create the task. You get back a task_id.

  2. Check the status every few seconds until it is SUCCESS.

  3. Fetch the result using the run_id from the status response.

Troubleshooting

  • 401: the API key is missing or wrong. Check the x-api-key header.

  • 403: your key doesn't have access to that resource.

  • 429: too many requests. Wait and try again more slowly.

Next steps

Need help? Contact us from the chat on this page.

Did this answer your question?