Live
Free tier included
Convert Text to Speech in 15+ Languages
Transform text into natural-sounding speech audio. Full Arabic support, adjustable speed, MP3 output. Perfect for accessibility, e-learning, and voice applications.
15+ Languages
Arabic Support
Speed Control
MP3 Output
Interactive Playground
Try it Free
Type or paste text, choose a language, and listen to the generated speech.
Try Free
Result
Enter text and click Generate Speech
API Documentation
Convert text to natural-sounding speech audio in 15+ languages including Arabic. Adjustable speed, MP3 output, auto-chunking for long texts.
Endpoint
POSThttps://www.mahmoudalhabash.com/api/v1/tts
Send text with language and speed options. The API synthesizes speech and returns a base64-encoded MP3 audio file.
Request Parameters
Response Fields
status "success" or "error"language Language code usedspeed Speed multiplier appliedtext_length Input character countchunks Number of text chunks processedformat Always "mp3"size_bytes / size_human Audio file sizeduration_estimate_s Estimated duration in secondstook_ms Processing time in millisecondsaudio Base64 data URI (audio/mpeg)Code Examples
cURL
curl -X POST https://www.mahmoudalhabash.com/api/v1/tts \
-H "Content-Type: application/json" \
-d '{
"text": "Hello! Welcome to our API.",
"language": "en",
"speed": 1.0
}'
JavaScript (fetch)
const res = await fetch('https://www.mahmoudalhabash.com/api/v1/tts', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
text: 'مرحبا بكم في واجهة البرمجة',
language: 'ar',
speed: 0.75
})
});
const { audio } = await res.json();
const player = new Audio(audio);
player.play();
Error Codes
422 Validation failed — text required (max 5,000 chars)
429 Rate limit exceeded
500 TTS service unavailable
Rate Limits
Unlimited — Free during beta
No API key required. Long texts are automatically chunked into segments. Max 5,000 characters per request. Output is always MP3.