Before You Begin

Before you begin, ensure you have a CAMB.AI account and have created an API key. You can find your API key in your CAMB.AI workspace API Keys dashboard. If you don’t have an account, you can sign up for one at CAMB.AI Studio.

Authentication

All API requests require authentication using your unique API key. You’ll need to include this key in the header of every request you make to any endpoint in CAMB.AI APIs.

headers = {
    "x-api-key": "your_api_key_here",
    "Accept": "application/json"
}

API Key Management

Your API key is available from your CAMB.AI workspace API Keys dashboard. Remember to keep this key secure and never expose it in client-side code.

Understanding Resource Usage

All API calls share a common quota based on your subscription plan. Resources are consumed based on:

  • Characters processed (for TTS, Translated TTS, Audio Separation, Transaled Stories and Translation).
  • Minutes of media processed/generated (for Dubbing, Stories and Text To Sound).

Working with Languages and Voices

Discovering Available Languages

Before using our translation or speech services, you’ll want to know which languages are supported:

import requests
import json

headers = {
    "x-api-key": "your_api_key_here",
    "Accept": "application/json"
}

print("Fetching available source languages...")
# Getting source languages
response = requests.get(
    "https://client.camb.ai/apis/source-languages",
    headers=headers
)
source_languages = response.json()
print(f"Retrieved {len(source_languages)} source languages")
print("First 3 languages:", json.dumps(source_languages[:3], indent=2))

print("\nFetching available target languages...")
# Getting target languages
response = requests.get(
    "https://client.camb.ai/apis/target-languages",
    headers=headers
)
target_languages = response.json()
print(f"Retrieved {len(target_languages)} target languages")
print("First 3 languages:", json.dumps(target_languages[:3], indent=2))

Exploring Available Voices

Each voice in our system has unique characteristics. Browse available voices with:

import requests
import json

headers = {
    "x-api-key": "your_api_key_here",
    "Accept": "application/json"
}

print("Fetching available voice options...")
response = requests.get(
    "https://client.camb.ai/apis/list-voices",
    headers=headers
)
voices = response.json()
print(f"Retrieved {len(voices)} voices")

# Display some sample voice information
if voices and len(voices) > 0):
    sample_voice = voices[0]
    print(f"Sample voice details: {json.dumps(sample_voice, indent=2)}")

Asynchronous Operations

Many of our APIs perform complex processing that takes time to complete. These operations follow an asynchronous pattern:

  1. Submit a request and receive a task_id.
  2. Poll the task status using the task_id.
  3. Once complete, retrieve results using the run_id.

This pattern is consistent across our non-Streaming APIs.

Next Steps

Ready to dive deeper? Continue exploring our detailed documentation for each API: