Overview
While SDKs and frameworks provide convenience, sometimes you need direct control over API calls. This tutorial shows how to call the Camb.ai TTS API directly using HTTP requests.When to Use Direct API
- Building integrations in languages without an SDK
- Need fine-grained control over request/response handling
- Debugging or testing API behavior
- Building custom streaming implementations
Listen to an Example
Prerequisites
Create an account
Sign up at CAMB.AI Studio if you haven’t already.
Get your API key
Go to Settings → API Keys in Studio and copy your key. See Authentication for details.
Install the SDK
Basic TTS Request
Streaming Response
For real-time applications, stream audio chunks as they’re generated:Request Parameters
Required Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | Text to convert to speech (min 3 characters) |
voice_id | integer | Voice ID to use |
Optional Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
language | string | "en-us" | BCP-47 language code |
speech_model | string | "mars-flash" | Model: mars-flash, mars-pro, mars-instruct (mars-instruct supports expressive text cues) |
output_configuration | object | {} | Output format settings |
enhance_named_entities | boolean | false | Better pronunciation for names/places |
Expressive Input with mars-instruct
When you use speech_model: "mars-instruct", you can encode expression directly in the text field by adding short emotion or pacing cues.
English examples:
[speaking slowly] This is very important. Please pay close attention.[excited] We shipped the feature, and the response has been fantastic!Let's pause for a moment <break time="400ms"/> and continue clearly.
user_instructions.
For a comprehensive guide on emotional expression, pauses, and prosody control, see the Emotional Voice Control tutorial.
Listing Voices
Get available voices:Error Handling
Handle common errors gracefully:Playing Audio
Next Steps
Python SDK
Use the SDK for simpler integration
API Reference
Complete API documentation
Voice Agents
Build real-time voice applications
Voice Library
Browse available voices