Overview
This API provides neural machine translation between English and three Nigerian languages — Igbo, Yoruba, and Hausa — using fine-tuned Meta NLLB-200 models trained on parallel corpora and bilingual dictionaries. All requests require an API key passed in the X-API-Key header.
Base URL: https://ai.thelangmaster.com
Authentication
Every request to /translate must include your API key in the request header:
X-API-Key: your-api-key-here
Contact the administrator to obtain an API key. Keys are rate-limited to 30 requests per minute.
POST Translate
Translates text between English and a supported Nigerian language.
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Required |
| X-API-Key | Your API key | Required |
| Field | Type | Required | Description |
|---|---|---|---|
| text | string | Required | Text to translate. Max 2000 characters. |
| lang | string | Required | Language direction code (see table below). |
# Igbo → English
curl -X POST https://ai.thelangmaster.com/translate \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key-here" \
-d '{"text": "Ọ dị mma", "lang": "ig"}'
{
"translation": "It is good",
"lang": "ig"
}
Supported Languages
Pass one of these codes as the lang field in your request:
More Examples
curl -X POST https://ai.thelangmaster.com/translate \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key-here" \
-d '{"text": "Good morning", "lang": "en-yo"}'
curl -X POST https://ai.thelangmaster.com/translate \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key-here" \
-d '{"text": "Ina son kofi", "lang": "ha"}'
const res = await fetch("https://ai.thelangmaster.com/translate", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "your-api-key-here"
},
body: JSON.stringify({ text: "Ọ dị mma", lang: "ig" })
});
const data = await res.json();
console.log(data.translation);
GET Health Check
Returns the current API status and which model is loaded in memory. No API key required.
curl https://ai.thelangmaster.com/health
{
"status": "ok",
"loaded_model": "ig"
}
Error Codes
| Code | Meaning |
|---|---|
| 401 | Missing X-API-Key header |
| 403 | Invalid API key |
| 413 | Request body exceeds 10KB |
| 422 | Validation error — empty text, invalid lang, or text over 2000 characters |
| 429 | Rate limit exceeded — 30 requests per minute per key |
Limits & Notes
| Limit | Value |
|---|---|
| Max text length | 2000 characters per request |
| Rate limit | 30 requests / minute per API key |
| Max request body | 10 KB |
| Response time | 2 – 8 seconds depending on text length and language switch |
Only one language model is held in memory at a time. Switching languages (e.g. from Igbo to Yoruba) triggers a model swap which adds ~10–20 seconds on the first request for that language.