Developer API

Text to Speech API

Add natural-sounding AI voices to your applications with our simple REST API. 17 voices, low latency, flexible pricing. Get started in minutes.

100 requests/hour free • No credit card required

New to voiceovers? See how to create text-to-speech audio in the web app first, then integrate with the API.

API Features

🔌

RESTful API

Simple HTTP endpoints that work with any programming language or platform.

🎙️

17 AI Voices

Access all voices via API - American, British, and Australian accents.

Low Latency

Fast response times optimized for real-time applications.

High Quality

Neural TTS powered by Google Cloud for natural-sounding output.

📦

Flexible Output

JSON responses include base64-encoded MP3 ready to decode or save to disk.

📊

Usage Tracking

Monitor your character usage and API calls in real-time.

API Documentation

Simple REST endpoints to generate speech from text. Works with any language or framework.

POST/api/tts

Generate speech from text

Request Body

{
  "text": string,     // Required. Text to convert (max 5000 characters per request)
  "voice": string,    // Required. Voice ID (e.g., "af_heart")
  "speed": number     // Optional. Speed multiplier (0.5-2.0, default 1.0)
}

Response

{
  "success": true,
  "audio": string,      // Base64-encoded audio data
  "format": "mp3",      // Audio format
  "voice": "af_heart",  // Voice used
  "characters": 13      // Characters processed
}

Available Voice IDs

af_heartaf_bellaaf_sarahaf_nicoleaf_emilyam_adamam_michaelam_jamesam_thomasbf_emmabf_isabellabm_georgebm_lewisaus_sophiaaus_graceaus_jackaus_oliver
GET/api/voices

List all available voices

{
  "voices": [
    {
      "id": "af_heart",
      "name": "Heart",
      "gender": "female",
      "accent": "American",
      "style": "warm"
    },
    // ... more voices
  ]
}

Code Examples

$ cURL
curl -X POST https://speaklucid.com/api/tts \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "text": "Hello, world!",
    "voice": "af_heart",
    "speed": 1.0
  }'
JS JavaScript / Node.js
const response = await fetch('https://speaklucid.com/api/tts', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_API_KEY',
  },
  body: JSON.stringify({
    text: 'Hello, world!',
    voice: 'af_heart',
    speed: 1.0
  })
});

const { audio, format } = await response.json();
// audio is base64-encoded MP3
🐍 Python
import requests
import base64

response = requests.post(
    'https://speaklucid.com/api/tts',
    headers={'Authorization': 'Bearer YOUR_API_KEY'},
    json={
        'text': 'Hello, world!',
        'voice': 'af_heart',
        'speed': 1.0
    }
)

data = response.json()
audio_bytes = base64.b64decode(data['audio'])

with open('output.mp3', 'wb') as f:
    f.write(audio_bytes)

Text to Speech API – Frequently Asked Questions

How do I authenticate with the SpeakLucid TTS API?

POST /api/tts requires a signed-in session (browser cookie) or Authorization: Bearer / X-API-Key with an API key from your Dashboard. The main API does not accept unauthenticated calls. On speaklucid.com, guests can try the playground in the browser (1,000 characters) without an API client.

What does the free text to speech API tier include?

The free tier includes up to 100 API requests per hour and character allowances for signed-in users per the Free plan (see Pricing for current limits). All 17 AI voices are available—ideal for testing and small projects.

What is the maximum text length per API request?

Each request can include up to 5,000 characters of input text (aligned with Google Cloud TTS limits). Split longer scripts into multiple requests.

What HTTP status codes and errors does the API return?

Successful synthesis returns 200 with JSON { success, audio, format, voice, characters }. 400 means bad input (missing text, unknown voice, text too long, speed outside 0.5–2.0). 429 means your account exceeded its character budget for the current period—see upgradeUrl in the response. 503 usually means TTS credentials are not configured on the server.

Can I call the API from the browser (CORS)?

The API responds to OPTIONS with CORS headers for simple integrations. For production, prefer calling the API from your backend so your app secrets and session handling stay server-side, then stream or deliver audio to clients.

What audio format does the API return?

Successful responses include base64-encoded MP3 in the audio field, plus format: "mp3". Decode base64 to bytes and write a .mp3 file or pipe to a player. The web app uses the same synthesis path.

What programming languages does the TTS API support?

Any language that can send HTTPS POST with JSON works. We document cURL, JavaScript (fetch), and Python (requests); the same contract applies to PHP, Go, Ruby, etc.

How fast is the text to speech API?

Most requests complete in a few seconds depending on length. Latency includes neural synthesis; keep requests reasonably sized for responsive UX.

What happens if I pick an invalid voice ID?

The API returns 400 with a message listing valid voice IDs. Use GET /api/voices to retrieve names, accents, and IDs before generating.

Does the API support SSML or custom pronunciation?

The documented contract uses plain text plus voice and speed. For advanced SSML or custom lexicons, contact us about enterprise workflows.

Get more free characters & tips

Create a free account for 5,000 chars/month and stay updated on new voices.

API Pricing

Start free and scale as you grow. All plans include full API access.

Free

$0

100/hour requests

5,000/month chars

Starter

$9/mo

500/hour requests

100,000/month chars

Pro

$29/mo

5,000/hour requests

500,000/month chars

Enterprise

$99/mo

10,000/hour requests

2,000,000/month chars

Ready to integrate TTS into your app?

Get started with our free tier - 100 requests/hour, no credit card required.