RAG and data · 2026-10-17
Arabic dialect identification API: labelling recordings with Jais ASR
ifm/jais-asr returns the recording's language or dialect with every transcript: 19 country codes and msa. With a Python example that counts a folder by dialect.
Short answer: ask for verbose_json and read the language field
LLMTR is a gateway that gives access to language models from different providers through one OpenAI-compatible API. You call Jais ASR with the id ifm/jais-asr on the /v1/audio/transcriptions endpoint at https://llmtr.com/v1. When you ask for verbose_json as the response_format, the response carries the language field next to the transcript; that field tells you the recording's recognised language or dialect.
In its model card, IFM writes that Jais ASR recognises Modern Standard Arabic and the dialects of 19 Arab countries, and that every transcript comes with the recognised language or dialect label. The label is msa for Modern Standard Arabic and a country code for a dialect; for recordings that are not Arabic, a language code such as en, fr, es or it comes back.
How do you identify the Arabic dialect of a recording?
For identification, leave the language field out of the request, or send ar. If you send a particular code, for example MA or msa, the label in the response is the value you sent; that is for pinning the transcript to a dialect you already know, not for identifying one.
The Python example below sends the wav, mp3, flac and ogg recordings in the calls folder to Jais ASR one by one, prints each recording's label and counts the labels at the end. Recordings without speech are set aside as no speech. The example waits for the Retry-After time and repeats a request that hits the short-term request limit; if the wait is longer than ten seconds, meaning the daily allowance is used up, it raises an error.
Read the label exactly as it appears in the language field: msa, MA, EG and so on. Use your own mapping table to turn a label into a country name; the NAMES dictionary in the example is a small start.
A Python requests example that sends the recordings in a folder to ifm/jais-asr with verbose_json, prints each recording's dialect label, sets aside recordings without speech and counts the labels.
import base64
import collections
import os
import pathlib
import time
import requests
URL = "https://llmtr.com/v1/audio/transcriptions"
HEADERS = {"Authorization": "Bearer " + os.environ["LLMTR_API_KEY"]}
NAMES = {"msa": "Modern Standard Arabic", "EG": "Egypt", "MA": "Morocco", "SA": "Saudi Arabia", "AE": "UAE"}
def transcribe(path: pathlib.Path) -> dict:
body = {
"model": "ifm/jais-asr",
"audio_base64": base64.b64encode(path.read_bytes()).decode("ascii"),
"audio_format": path.suffix.lstrip(".").lower(),
"response_format": "verbose_json",
}
for _ in range(3):
response = requests.post(URL, headers=HEADERS, json=body, timeout=300)
wait = int(response.headers.get("Retry-After") or 0)
if response.status_code == 429 and wait <= 10:
time.sleep(max(wait, 1))
continue
response.raise_for_status()
return response.json()
raise RuntimeError("still rate limited: " + path.name)
counts = collections.Counter()
for path in sorted(pathlib.Path("calls").iterdir()):
if path.suffix.lower() not in {".wav", ".mp3", ".flac", ".ogg"}:
continue
result = transcribe(path)
label = "no speech" if result["no_speech"] else result["language"]
counts[label] += 1
print(path.name, "->", NAMES.get(label, label))
print(counts.most_common())
Labels and what they mean
The table shows the Arabic labels that can come back in the language field. The same codes can also be written in the request's language field. If the recording has no speech, language comes back null and no_speech is true.
| Label | Meaning |
|---|---|
| msa | Modern Standard Arabic |
| ar | All dialects (request only; the model picks the dialect itself) |
| AE, BH, KW, OM, QA, SA | UAE, Bahrain, Kuwait, Oman, Qatar, Saudi Arabia |
| IQ, JO, LB, PS, SY | Iraq, Jordan, Lebanon, Palestine, Syria |
| EG, SD, LY | Egypt, Sudan, Libya |
| DZ, MA, MR, TN | Algeria, Morocco, Mauritania, Tunisia |
| YE | Yemen |
| en, fr, es, it | English, French, Spanish, Italian |
Where to use the label, and where not to
A dialect label is useful for routing and reporting: assigning a call-centre recording to the team that speaks that dialect, sorting a content archive by dialect, or passing the transcript to a language model such as Jais 3 in the next step along with the dialect.
The label should not be used to decide anything about a person's identity, nationality or origin. On short or noisy recordings the label may not be reliable; if a decision rests on it, add a human check and judge the labels of several recordings side by side.
Managing the allowance and the pace in batch jobs
A daily allowance of 60 minutes of audio covers about thirty recordings of two minutes on average. Before you start on a folder, read the recordings' lengths and compare the total with the allowance; if the total is longer than the allowance, spread the job over several days.
Send the recordings one after another. A request that hits the short-term request limit returns 429 with a Retry-After of a few seconds; the example waits in that case and sends the same recording again. Write each recording's label to disk straight away along with the file name; if the job stops halfway, you continue from where it stopped.
If you only need the label, for example to distribute recordings to teams, cutting the first minute or two of each recording and sending that spreads the allowance over longer recordings. If the call starts with silence or music, make the cut from where the speech begins.
Free period, daily allowance and the data note
Jais ASR is free until 5 November 2026, 23:59 (TRT), and every account has an allowance of 60 minutes of audio a day. When you process a folder in bulk, work out the recordings' total length beforehand; a recording longer than the minutes left is refused before it is sent. When the allowance is used up the API returns 429, the Retry-After header tells you when you can try again, and the allowance renews at 00:00 (TRT). From 6 November 2026, 00:00 the model returns 410 model_retired.
According to the data note on the LLMTR model page, recordings and transcripts may be logged by the provider and used to improve the model. Customer calls usually contain personal data; before sending such recordings, check your customer's consent and your own data policy.
Label recordings by Arabic dialect
Send the recordings to ifm/jais-asr with verbose_json, read the language field and count the labels.
- Collect the recordings. Put wav, mp3, flac or ogg recordings in a folder; each should be at most 15 minutes long.
- Request. Send each recording base64-encoded to ifm/jais-asr with response_format verbose_json and without the language field.
- Labelling. Read the language field in the response, set aside the ones with no_speech true and count the labels for your report.
Frequently asked questions
Which Arabic dialects does Jais ASR recognise?
Modern Standard Arabic (msa) and the dialects of 19 countries: AE, BH, DZ, EG, IQ, JO, KW, LB, LY, MA, MR, OM, PS, QA, SA, SD, SY, TN and YE. The label comes back in the response's language field.
If I send the language field, is the dialect still identified?
If you send ar or leave the field out, the model picks the dialect itself. If you send a particular code such as MA or msa, the label comes back as that value.
Can I use the dialect label to make decisions about a customer?
The label is for routing and reporting recordings; it should not be used to decide anything about a person's identity, nationality or origin. On short or noisy recordings the label may not be reliable.