SPEECHMAAPI

SPEECHMA API
Site
← Back to Main App Dashboard Get API Key →
Getting Started
Introduction Authentication Pricing
Endpoints
POST /tts GET /voices GET /usage
Reference
Error Codes Examples ⚡ API Tester →
⚡ REST API · JSON · MP3 Output

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.

580+
AI Voices
60+
Languages
From $9
Per Month
<2s
Response
Base URL https://speechma.com/api/v1

Authentication

Every request must include your API key in the header. Get your API key →

Method 1 - X-API-Key header (recommended)

HTTP Header
X-API-Key: sm_your_api_key_here

Method 2 - Bearer token

HTTP Header
Authorization: Bearer sm_your_api_key_here
⚠️
Keep your API key private. Never include it in front-end JavaScript or commit it to GitHub repositories.

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.

⚡ One-time payment  ·  31 days access  ·  Secured by Razorpay  ·  INR & USD accepted
Starter
$9
per month  ·  ≈ ₹864 INR
1M
Chars / month
100
Req / hour
 
Get Started →
  • 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
Enterprise
Custom
fully tailored to your needs
Custom chars
Custom limits
✦ Best rate per character
Talk to us →
  • 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.

POST https://speechma.com/api/v1/tts

Request Headers

HeaderRequiredValue
X-API-KeyRequiredYour SPEECHMA API key
Content-TypeRequiredapplication/json

Request Body (JSON)

FieldTypeRequiredDescription
textstringRequiredThe text to convert. Max 5,000 chars (Starter) or 10,000 chars (Pro / Business).
voicestringRequiredVoice ID from /voices - e.g. voice-1
pitchintegerOptionalPitch adjustment -100 to +100. Default: 0
rateintegerOptionalSpeed adjustment -100 to +100. Default: 0

Response - Success

✓  200 OK - audio/mpeg binary
# 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

✕  Error - application/json
{
  "success": false,
  "error":   "Quota exceeded",
  "code":    429
}

Code Examples

cURL
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
Python
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"])
JavaScript (Node.js)
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);
}
PHP
$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.

GET https://speechma.com/api/v1/voices

Optional Query Parameter

ParameterRequiredExample
languageOptional?language=English   ?language=Spanish   ?language=Hindi
Response JSON
{
  "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.

GET https://speechma.com/api/v1/usage
Response JSON
{
  "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".

CodeMeaningHow to fix
400Bad RequestMissing or invalid text / voice. Text may exceed your plan's per-request limit.
401UnauthorizedInvalid or missing API key. Check your X-API-Key header value.
402Payment RequiredSubscription not active. Complete payment in your dashboard.
403ForbiddenAccount suspended. Contact contact@speechma.com
405Method Not AllowedUse POST for /tts, GET for /voices and /usage.
429Too Many RequestsHourly request limit or monthly character quota exceeded. Upgrade your plan.
500Server ErrorTemporary issue on our end. Wait a moment and retry.

More Examples

Adjust Speed and Pitch

JSON Request Body
{
  "text":  "Slow and deep voice",
  "voice": "voice-1",
  "pitch": -20,
  "rate":  -30
}

Check Quota Before Making a Request

Python
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 →
⚡ Interactive Playground
Try the API live — no code needed
Paste your API key and test all 3 endpoints directly in your browser. Hear real audio output instantly.
Open API Tester →