Voice API

Server-side TTS for AI receptionists and products. Send text in Kinyarwanda, English, or French — get a WAV URL back.

v1 live Create API key

Base URL · https://ijwilab.com

Auth header: Authorization: Bearer ijw_… · Languages: rw en fr

1. Get an API key

  1. Create an account at ijwilab.com
  2. Open Dashboard → API keys
  3. Create a key and copy it once (shown only at creation)

Kinyarwanda is free in the studio. API key usage (rw/en/fr) uses tokens — see pricing.

2. Endpoints

MethodPathAuthPurpose
POST /api/v1/tts.php API key Synthesize speech (WAV URL)
POST /api/v1/tts-stream.php API key Stream PCM for live calls (~500ms first audio)
GET /api/v1/voices.php None List languages & speakers
GET /api/v1/health.php None API readiness

3. Synthesize speech

Request

curl -sS https://ijwilab.com/api/v1/tts.php \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "Muraho, murakaza neza kuri IjwiLab.",
    "language": "rw",
    "speaker_id": 0
  }'

You can also send X-Ijw-Api-Key: YOUR_API_KEY instead of Bearer.

Body fields

FieldTypeRequiredNotes
inputstringyesText to speak (max 10,000 chars)
languagestringnorw (default), en, or fr
speaker_idintno0–2 for rw/fr; 0–4 for en

Success response

{
  "output_url": "https://ijwilab.com/generated/audio_….wav",
  "seconds": 3.42,
  "language": "rw",
  "speaker_id": 0,
  "billing": {
    "kinyarwanda_free": false,
    "api_usage": true,
    "tokens_charged": 1,
    "token_balance": 49,
    "free_uses_remaining": 4
  }
}

Download or stream output_url (WAV) into WhatsApp, your IVR, or any AI receptionist audio channel. For live conversation, use the streaming endpoint instead of waiting for a full WAV.

3b. Realtime stream (live calls)

Built for AI receptionists and telephony. Models stay warm. Audio starts as soon as the first clause is ready — target ~500ms time-to-first-audio for short English/French/Kinyarwanda turns. Keep each reply to one or two sentences.

curl -sS -D - https://ijwilab.com/api/v1/tts-stream.php \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "Hello, thanks for calling. How can I help?",
    "language": "en",
    "speaker_id": 0,
    "format": "pcm16_8k"
  }' \
  --output reply.pcm

Body fields

FieldTypeRequiredNotes
inputstringyesTurn text (max 4,000 chars)
languagestringnorw, en, or fr
speaker_idintnoSame as /tts.php
formatstringnopcm16_8k (default), pcm16_16k, pcm16_24k, or mulaw_8k (Twilio / PSTN)

Response

  • Body is raw audio (not JSON). Play or pipe chunks as they arrive.
  • X-Ijw-Ttfa-Ms — server time-to-first-audio in milliseconds
  • Content-Typeaudio/l16 or audio/basic (μ-law)

Do not wait for a complete file. Feed the stream into your call audio track (8 kHz linear PCM or μ-law). Long scripts still stream, but first-audio stays low only if the first clause is short.

4. Voices

Browse voices: /api/v1/voices.php · machine JSON: ?format=json

Kinyarwanda (rw) · tokens

Free in the studio; API key usage requires tokens

speaker_idNameGroup
0 Ingabire kinyarwanda
1 Irakoze kinyarwanda
2 Mugenzi kinyarwanda

English (en) · tokens

Token billed via API and studio

speaker_idNameGroup
0 Sarah us-english
1 Ryan us-english
2 Emma us-english
3 Amara african-english
4 Kwame african-english

French (fr) · tokens

Token billed via API and studio

speaker_idNameGroup
0 Julie french
1 Thomas french
2 Camille french

5. AI receptionist pattern

  1. Your LLM / NLU decides the reply text and language (rw / en / fr)
  2. POST /api/v1/tts-stream.php with that text + language + speaker + format (mulaw_8k or pcm16_8k)
  3. Play the audio stream on the call as soon as the first bytes arrive (do not wait for the full utterance)

IjwiLab is the voice layer (TTS). Speech-to-text and dialogue logic stay in your stack.

English greeting

curl -sS https://ijwilab.com/api/v1/tts.php \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":"Hello, thank you for calling. How can I help you today?","language":"en","speaker_id":3}'

French greeting

curl -sS https://ijwilab.com/api/v1/tts.php \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":"Bonjour, bienvenue. Comment puis-je vous aider?","language":"fr","speaker_id":0}'

6. Errors

HTTPMeaning
401Missing or invalid API key
402Not enough tokens (rw/en/fr on API) — API top-up (min 289 tokens)
410Voice cloning retired
429Rate limit (max 30 TTS requests/minute per key)
405Wrong HTTP method
503Health check reports backend not ready

Studio / WAV (/tts.php) can take several seconds for long scripts. Live calls should use /tts-stream.php with a 10–15s timeout on first audio.

7. Pricing snapshot

  • Studio Kinyarwanda (rw): free
  • API (rw / en / fr): tokens · $0.04/token
  • API top-up minimum: 289 tokens
  • 5 free short trial generations per account (under 2 min), then tokens

Full details: pricing