# Naija Speech API > Speech to text, text to speech, translation and speech translation for Hausa, Igbo, Yoruba and Nigerian English. > OpenAI-style REST API, free for non-commercial use. Base URL: https://asr.naijallm.com/v1 Auth: `Authorization: Bearer nlb_...` (create a key at https://asr.naijallm.com/dashboard after signing up) Language codes: ha (Hausa), ig (Igbo), yo (Yoruba), en (Nigerian English); hau, ibo, yor, eng also accepted. Errors: JSON `{"error": {"type", "message", "code", "param", "request_id"}}`, OpenAI-style; `param` names the field at fault. Branch on `code`, not `message`. Every response has an X-Request-Id header; 405 includes Allow. Retry 429/500/503 with backoff (429: Retry-After is 30 for the per-minute limit, 3600 for daily limits); don't retry other 4xx. Use a client timeout of at least 300 s (a cold start can take a minute or two). Error codes: 400 missing_text|missing_input|missing_file|missing_language|missing_source|missing_target, invalid_body|invalid_json| invalid_content_type|invalid_multipart|invalid_text|invalid_input, unsupported_language|same_language|language_model_mismatch, model_not_found|voice_not_found|voice_language_mismatch|unsupported_response_format|unsupported_timestamp_granularity| unsupported_parameter|empty_file, bad_request; 401 missing_api_key|invalid_api_key|invalid_authorization_header; 403 account_suspended; 404 not_found; 405 method_not_allowed; 413 input_too_long|file_too_large|audio_too_long; 415 unsupported_audio; 422 no_speech; 429 rate_limit_exceeded|daily_limit_exceeded|quota_exceeded; 500 internal_error; 503 service_unavailable. ## Speech to text POST /v1/audio/transcriptions (multipart/form-data) - file (required): WAV, MP3, M4A, FLAC, OGG or WebM; up to 25 MB and 5 minutes - language (required): ha | ig | yo | en (no automatic detection; wrong language = poor text) - model: ncair-asr (default; picks the per-language model), or ncair-asr-hausa | -igbo | -yoruba | -english - response_format: json (default) | text | verbose_json (with segments, max 12 s each) | srt | vtt - timestamp_granularities[]: segment only (no word timestamps) Response (json): {"text", "language", "duration", "model", "attribution"} OpenAI SDK: client.audio.transcriptions.create(model="ncair-asr", file=f, language="ha") ## Text to speech POST /v1/audio/speech (JSON) - input (required): text, up to 1,000 characters (write numbers as words) - language: ha | ig | yo | en (required unless voice is set) - voice: see GET /v1/audio/voices (e.g. hausa_male2, igbo_female2, yoruba_male2, idera) - model: naija-tts (optional) - response_format: mp3 (default) | wav | opus (Ogg) | flac - speed: 1 only Response: the audio bytes; headers X-Audio-Seconds, X-Voice, X-Language OpenAI SDK: client.audio.speech.with_streaming_response.create(model="naija-tts", voice="igbo_female2", input="...") ## Translation POST /v1/translations (JSON) - text (required): up to 2,000 characters - source, target (required): ha | ig | yo | en; any pair (between two Nigerian languages it goes through English, in one request) - model: naija-translate (optional) Response: {"text", "source", "target", "model", "characters"} ## Speech translation (speech to speech, or speech to text in another language) POST /v1/audio/translations (multipart/form-data) - file (required): audio up to 25 MB and 60 seconds - language (required): spoken language, ha | ig | yo | en - target: ha | ig | yo | en (default en); any pair, through English between two Nigerian languages - response_format: json (default, text only) | mp3 | wav | opus | flac - voice: a voice of the target language (optional) - model: naija-speech-translate (optional) Response (json): {"text", "transcript", "language", "target", "duration", "model", "attribution"} Response (audio): the speech; headers X-Transcript and X-Translation (URL-encoded), X-Voice, X-Language, X-Target, X-Audio-Seconds. A translation over 1,000 characters can't be spoken: 413 input_too_long (use json). 503 names the failed step in X-Failed-Step. OpenAI SDK: client.audio.translations.create(model="naija-speech-translate", file=f, extra_body={"language": "ha", "target": "en"}) ## Other endpoints GET /v1/models; GET /v1/audio/voices[?language=ha] -> {"object":"list","data":[{"id","language","default"}]}; GET /v1/usage (needs a key; account-wide request counts); GET /v1/health -> {"online","services":{...},"checked_at"} ## Limits (per key; "day" = the last 24 hours) 10 requests/minute (every request counts) and 1,000/day (successful requests only) across all endpoints; 120 audio minutes/day (speech to text and speech translation together); 100,000 characters/day each for text to speech and translation. ## Long input Models never see a whole long request: translation runs sentence by sentence (long sentences cut at ~60 words), text to speech sentence by sentence (~24 words), speech to text in pieces cut at pauses. Sentences are translated without their neighbours, so names and terms can vary across a long document. Over a per-request limit (translation 2,000 characters, text to speech 1,000, audio 25 MB or 5 minutes, speech translation 60 seconds) returns 413 (input_too_long, file_too_large or audio_too_long) with the length sent and the limit; nothing is truncated. For longer documents, send one or a few paragraphs per request and join the results. ## Licence Free for non-commercial use. Speech-to-text and speech-translation output must show: "Powered by NCAIR / N-ATLaS ASR models: Awarri Technologies in an initiative of the Federal Ministry of Communications, Innovation and Digital Economy." Docs: https://asr.naijallm.com/#intro · Playground: https://asr.naijallm.com/playground · Contact: ayuba@naijallm.com