Adding Arabic speech to a product comes down to three choices: which model, which voice, and which audio format. This guide walks through each with the Hakim API, plus the settings for streaming and realtime use.
The request
Every synthesis call goes to one endpoint:
curl https://api.tryhakim.ai/v1/audio/speech \
-H "Authorization: Bearer $HAKIM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"hakim-fast-v1","input":"أهلًا وسهلًا، طلبك في الطريق.","voice":"VOICE_ID","response_format":"mp3"}' \
--output reply.mp3
The request shape will look familiar if you have used other speech APIs: model, input, voice, response_format. The official Node.js and Python SDKs wrap the same call.
1. Pick a model
Hakim has three text-to-speech tiers, all called through the same endpoint:
- Hakim Saree' v1.3 (
hakim-fast-v1) is the default. It starts returning audio in about 113 ms p95 and covers Modern Standard Arabic, 15 regional dialects and 32 languages. Use it for voice agents, IVR, notifications and anything interactive. - Hakim Faseeh v2 (
hakim-v2) is the premium-quality tier, with non-verbal tags such as[laugh],[breath]and[whisper]written straight into the text. Use it for narration, audiobooks, ads and podcasts, where naturalness matters more than the last few milliseconds. - Hakim Mulhim v3 (
hakim-v3) addsvoice_prompt: describe the delivery in plain language, or design a new voice from a description and save it.
Pricing is per character of input: 1.0, 1.5 and 2.0 credits for the three tiers. Tags and prompts a tier does not support are stripped before billing, so you never pay for ignored text.
2. Pick a voice
List the voices available to your workspace with GET /v1/audio/voices, filtering by language, Arabic dialect, gender or voice type (conversational, narrative, news, customer service, e-learning and more). Your own cloned voices appear in the same list.
Two tips:
- Match the dialect to your audience. A Gulf customer-service line should sound Gulf; a pan-Arab news product may prefer MSA. The voice carries its dialect and register into everything it reads.
- Use the voice
id, not the slug, in production. Ids are unique and stable; slugs are for readability.
3. Pick a format
response_format:mp3for web and apps,opusfor low bandwidth,wavorpcmwhen you process the audio yourself.sample_rate: 24000 by default. Use 8000 for telephony, and 44100 or 48000 for video and studio work.speed: 0.5 to 2.0, default 1.0.
Streaming and realtime
For long text, add "stream": true and play audio as it arrives instead of waiting for the whole file.
For voice agents that speak a language model's output sentence by sentence, open the realtime socket at wss://api.tryhakim.ai/v1/audio/speech/stream. Set defaults once with session.update, then send one speech.create per sentence. Audio comes back as 24 kHz PCM. Set trailing_silence_ms: 0 so sentences join without gaps. The streaming guide has the full protocol and a complete agent recipe.
Getting the text right
Arabic synthesis is only as good as the text you send. Write numbers, dates and prices the way you want them read when the context is ambiguous. Add diacritics to the few words that are easy to misread, such as names. Keep each request to a natural unit: a sentence or a short paragraph.
Start with the free tier, 10,000 credits a month with no card, and listen to your own scripts in your own dialect. That tells you more than any demo.