SPEECHMA TTS API
Convert text to natural-sounding speech with 580+ AI voices across 60+ languages. Simple REST API - works in any programming language or framework. Monthly subscription, cancel anytime.
Authentication
Every request must include your API key in the header. Get your API key →
Method 1 - X-API-Key header (recommended)
X-API-Key: sm_your_api_key_here
Method 2 - Bearer token
Authorization: Bearer sm_your_api_key_here
Pricing
Monthly subscriptions - auto-renews each month. Cancel anytime from your dashboard. All plans include all 580+ voices and 60+ languages with full commercial use rights.
- 1,000,000 characters / month
- 5,000 chars max per request
- 100 API requests / hour
- 500 API requests / day
- 3 concurrent requests max
- All 580+ AI voices & 60+ languages
- MP3 audio output
- Commercial use included
- 50,000,000 characters / month
- 10,000 chars max per request
- 500 API requests / hour
- 5,000 API requests / day
- 10 concurrent requests max
- All 580+ AI voices & 60+ languages
- MP3 audio output
- Commercial use included
- Priority support
- Custom character limits
- Custom request & concurrency limits
- Custom pricing & billing cycle
- All 580+ AI voices & 60+ languages
- MP3 audio output
- Commercial use included
- Dedicated support & SLA
- White-label options available
All prices in USD · Charged in INR via Razorpay · Contact us for enterprise plans
POST /tts
Convert text to speech. Returns binary MP3 audio data directly in the response body on success.
Request Headers
| Header | Required | Value |
|---|---|---|
X-API-Key | Required | Your SPEECHMA API key |
Content-Type | Required | application/json |
Request Body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
text | string | Required | The text to convert. Max 5,000 chars (Starter) or 10,000 chars (Pro / Business). |
voice | string | Required | Voice ID from /voices - e.g. voice-1 |
pitch | integer | Optional | Pitch adjustment -100 to +100. Default: 0 |
rate | integer | Optional | Speed adjustment -100 to +100. Default: 0 |
Response - Success
# Body is raw MP3 data - save it directly to a .mp3 file
# Response headers show your remaining quota:
Content-Type: audio/mpeg
X-Chars-Used: 250
X-Chars-Remaining: 999750
X-Plan: starter
Response - Error
{
"success": false,
"error": "Quota exceeded",
"code": 429
}
Code Examples
curl -X POST https://speechma.com/api/v1/tts \
-H "X-API-Key: sm_your_api_key" \
-H "Content-Type: application/json" \
-d '{"text":"Hello world!","voice":"voice-1"}' \
--output speech.mp3
import requests
api_key = "sm_your_api_key"
headers = {
"X-API-Key": api_key,
"Content-Type": "application/json",
}
response = requests.post(
"https://speechma.com/api/v1/tts",
headers=headers,
json={"text": "Hello world!", "voice": "voice-1"},
)
if response.status_code == 200:
with open("speech.mp3", "wb") as f:
f.write(response.content)
print("Saved to speech.mp3")
else:
print("Error:", response.json()["error"])
const fs = require('fs');
const response = await fetch('https://speechma.com/api/v1/tts', {
method: 'POST',
headers: {
'X-API-Key': 'sm_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
text: 'Hello world!',
voice: 'voice-1',
}),
});
if (response.ok) {
const buffer = Buffer.from(await response.arrayBuffer());
fs.writeFileSync('speech.mp3', buffer);
console.log('Saved to speech.mp3');
} else {
const err = await response.json();
console.error('Error:', err.error);
}
$ch = curl_init('https://speechma.com/api/v1/tts');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'text' => 'Hello world!',
'voice' => 'voice-1',
]),
CURLOPT_HTTPHEADER => [
'X-API-Key: sm_your_api_key',
'Content-Type: application/json',
],
]);
$audio = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($code === 200) {
file_put_contents('speech.mp3', $audio);
echo "Saved to speech.mp3\n";
}
GET /voices
Returns all 580+ available voices. Use the voice_id values in your TTS requests.
Optional Query Parameter
| Parameter | Required | Example |
|---|---|---|
language | Optional | ?language=English ?language=Spanish ?language=Hindi |
{
"success": true,
"total": 580,
"voices": [
{
"voice_id": "voice-1",
"name": "Adri",
"language": "Afrikaans",
"locale": "af-ZA"
},
// ... 579 more voices
]
}
GET /usage
Check your current month's usage, remaining quota, and billing cycle details.
{
"success": true,
"account": {
"plan": "pro",
"billing_cycle_end": "2026-07-10"
},
"quota": {
"chars_limit": 50000000,
"chars_used": 120450,
"chars_remaining": 49879550,
"usage_percent": 0.24
}
}
Error Codes
All errors return JSON with "success": false, an "error" message, and a numeric "code".
| Code | Meaning | How to fix |
|---|---|---|
400 | Bad Request | Missing or invalid text / voice. Text may exceed your plan's per-request limit. |
401 | Unauthorized | Invalid or missing API key. Check your X-API-Key header value. |
402 | Payment Required | Subscription not active. Complete payment in your dashboard. |
403 | Forbidden | Account suspended. Contact contact@speechma.com |
405 | Method Not Allowed | Use POST for /tts, GET for /voices and /usage. |
429 | Too Many Requests | Hourly request limit or monthly character quota exceeded. Upgrade your plan. |
500 | Server Error | Temporary issue on our end. Wait a moment and retry. |
More Examples
Adjust Speed and Pitch
{
"text": "Slow and deep voice",
"voice": "voice-1",
"pitch": -20,
"rate": -30
}
Check Quota Before Making a Request
import requests
headers = {
"X-API-Key": "sm_your_api_key",
"Content-Type": "application/json",
}
# 1. Check remaining quota
usage = requests.get("https://speechma.com/api/v1/usage", headers=headers).json()
remaining = usage["quota"]["chars_remaining"]
text = "Hello from my app!"
# 2. Only call TTS if quota allows
if len(text) <= remaining:
r = requests.post("https://speechma.com/api/v1/tts",
headers=headers,
json={"text": text, "voice": "voice-1"})
open("output.mp3", "wb").write(r.content)
else:
print("Not enough quota - upgrade your plan")
Ready to start building?
Monthly subscription · Cancel anytime · Instant activation after payment
Get Your API Key →