Naija Speech API

Speech-to-text for Hausa, Igbo, Yoruba and Nigerian English

Send an audio file, get a transcript back. Works with the OpenAI SDK, so you can switch with one line of code.

Quickstart

Create an account, then create an API key in your dashboard. Keys start with nlb_. Set it as an environment variable and send your first request:

curl https://asr.naijallm.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $NAIJA_ASR_KEY" \
  -F file=@audio.wav \
  -F language=ha
import os, requests

r = requests.post(
    "https://asr.naijallm.com/v1/audio/transcriptions",
    headers={"Authorization": f"Bearer {os.environ['NAIJA_ASR_KEY']}"},
    files={"file": open("audio.wav", "rb")},
    data={"language": "ha"},
)
r.raise_for_status()
print(r.json()["text"])
const form = new FormData();
form.append("file", audioBlob, "audio.wav");
form.append("language", "yo");

const r = await fetch("https://asr.naijallm.com/v1/audio/transcriptions", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.NAIJA_ASR_KEY}` },
  body: form,
});
const { text } = await r.json();
console.log(text);
import os
from openai import OpenAI

client = OpenAI(api_key=os.environ["NAIJA_ASR_KEY"], base_url="https://asr.naijallm.com/v1")

with open("audio.wav", "rb") as f:
    result = client.audio.transcriptions.create(model="ncair-asr", file=f, language="ig")
print(result.text)

Authentication

Send your API key in the Authorization header of every request:

Authorization: Bearer nlb_...

Keep keys on your server. Don't put them in front-end code or mobile apps. You can create several keys, for example one per project, and revoke any of them from the dashboard.

Transcribe audio

POST https://asr.naijallm.com/v1/audio/transcriptions

The body is multipart/form-data with these fields:

FieldTypeDescription
filefile, requiredWAV, FLAC or OGG. Mono or stereo, any sample rate. Up to 10 MB and 60 seconds.
languagestring, requiredha, ig, yo or en. Optional if model sets the language.
modelstringDefaults to ncair-asr, which picks the model for language. See models.
response_formatstringjson (default) or text.

Response

{
  "text": "A wannan lokaci na tarihin Tarayyan Turai, cocin Katolika ...",
  "language": "ha",
  "duration": 10.7,
  "model": "ncair-asr-hausa",
  "attribution": "Powered by NCAIR / N-ATLaS ASR models: ..."
}

duration is the length of the audio in seconds. To send MP3 or M4A, convert it first, for example with ffmpeg -i in.mp3 -ar 16000 -ac 1 audio.wav.

Models and languages

LanguageCodeModelSource
Hausahancair-asr-hausaNCAIR1/Hausa-ASR
Igboigncair-asr-igboNCAIR1/Igbo-ASR
Yorubayoncair-asr-yorubaNCAIR1/Yoruba-ASR
Nigerian Englishenncair-asr-englishNCAIR1/NigerianAccentedEnglish

The three-letter codes hau, ibo, yor and eng also work.

Pricing and limits

The API is free to use. Each key is limited to:

Requests per minute10
Requests per day1,000
File size10 MB
Audio length60 seconds

Responses include X-RateLimit-Limit and X-RateLimit-Remaining headers for the per-minute limit. Need higher limits? Contact us.

Errors

Errors return a JSON body in the same format as OpenAI:

{"error": {"type": "invalid_request_error", "message": "...", "code": "missing_language"}}
StatusCodeMeaning
400missing_language, missing_fileA field is missing or invalid. The message says which.
401invalid_api_keyThe key is missing, wrong or revoked.
413file_too_large, audio_too_longThe file is over 10 MB or 60 seconds.
415unsupported_audioThe audio could not be decoded.
429rate_limit_exceededOver the per-minute limit. Retry after Retry-After seconds.
429daily_limit_exceededOver the daily limit.
503service_unavailableTemporarily unavailable. Retry later.

Other endpoints

GET /v1/modelsList the available models.
GET /v1/usageRequest counts for your account. Requires a key.
GET /v1/healthService status.

Accuracy

Word error rate (lower is better) on the FLEURS test set, from the Naija LLM Benchmarks leaderboard:

LanguageWER
Hausa35.0%
Igbo44.0%
Yoruba57.5%

Results vary with recording quality, accent and subject. Review transcripts where accuracy matters.

Licence and attribution

The models are released by NCAIR and Awarri Technologies for non-commercial use. Show this attribution wherever you use the output publicly. It is also returned with every transcript.

Powered by NCAIR / N-ATLaS ASR models: Awarri Technologies in an initiative of the Federal Ministry of Communications, Innovation and Digital Economy.

For commercial use, contact NCAIR / Awarri for a licence.

Acceptable use

By using the API you agree to these terms and to the NCAIR model licence. Do not use it for:

  • surveillance or monitoring people without their consent
  • profiling people or making decisions about them based on sensitive traits
  • fraud, impersonation or harassment
  • military or weapons purposes
  • commercial products, without a licence from NCAIR / Awarri

Only send recordings you have the right to use. Audio is processed in memory and not stored. We log the time, language, audio length and status of each request. Accounts that break these terms may be suspended. The service is provided as is, without warranty.