Home API Tools Posts Hire Me About
Sign In Create Account
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

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

ParameterTypeRequiredDefaultDescription
textstringrequiredText to convert (max 5,000 chars)
languagestringoptionalenLanguage code: en, ar, fr, de, es, it, pt, ru, ja, ko, zh, tr, nl, pl, sv
speednumberoptional1.0Playback speed (0.25–4.0)

Response Fields

status "success" or "error"
language Language code used
speed Speed multiplier applied
text_length Input character count
chunks Number of text chunks processed
format Always "mp3"
size_bytes / size_human Audio file size
duration_estimate_s Estimated duration in seconds
took_ms Processing time in milliseconds
audio 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.