curl --request POST \
--url https://api.namuai-lab.com/v1/translate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Ina kwana? Yau za a yi zafi sosai."
}
'import requests
url = "https://api.namuai-lab.com/v1/translate"
payload = { "text": "Ina kwana? Yau za a yi zafi sosai." }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({text: 'Ina kwana? Yau za a yi zafi sosai.'})
};
fetch('https://api.namuai-lab.com/v1/translate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"model": "translation",
"source": "ha",
"target": "fr",
"source_text": "Ina kwana? Yau za a yi zafi sosai.",
"text": "Bonjour ! Il va faire très chaud aujourd'hui.",
"characters": 34,
"audio": null
}{
"error": {
"type": "unknown_voice",
"message": "Unknown voice. Try one of: nadia, warm, fr, mouhamad.",
"request_id": "3f2a9c1e5b7d4e8fa0c2b6d9e1f3a5c7"
}
}{
"error": {
"type": "missing_api_key",
"message": "Send your key as 'Authorization: Bearer namu_sk_...'.",
"request_id": "3f2a9c1e5b7d4e8fa0c2b6d9e1f3a5c7"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}Create translation
Translates between Hausa and French, in both directions. Send JSON to translate text, or audio (multipart file, or the raw body) to translate speech. Add include_audio to also get the translation spoken. Text counts its characters divided by 15 as seconds; speech counts the audio sent. Needs the translate scope.
curl --request POST \
--url https://api.namuai-lab.com/v1/translate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Ina kwana? Yau za a yi zafi sosai."
}
'import requests
url = "https://api.namuai-lab.com/v1/translate"
payload = { "text": "Ina kwana? Yau za a yi zafi sosai." }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({text: 'Ina kwana? Yau za a yi zafi sosai.'})
};
fetch('https://api.namuai-lab.com/v1/translate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"model": "translation",
"source": "ha",
"target": "fr",
"source_text": "Ina kwana? Yau za a yi zafi sosai.",
"text": "Bonjour ! Il va faire très chaud aujourd'hui.",
"characters": 34,
"audio": null
}{
"error": {
"type": "unknown_voice",
"message": "Unknown voice. Try one of: nadia, warm, fr, mouhamad.",
"request_id": "3f2a9c1e5b7d4e8fa0c2b6d9e1f3a5c7"
}
}{
"error": {
"type": "missing_api_key",
"message": "Send your key as 'Authorization: Bearer namu_sk_...'.",
"request_id": "3f2a9c1e5b7d4e8fa0c2b6d9e1f3a5c7"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}Authorizations
Your secret key: Authorization: Bearer namu_sk_.... Create one at https://www.namuai-lab.com/account/keys.
Query Parameters
1, true or yes to add the spoken translation (base64 WAV) to the answer.
1, true, yes Only when the audio is the raw body.
ha Hausa or fr French. The source defaults to the other language from the target.
ha, fr Only when the audio is the raw body.
ha Hausa or fr French. The source defaults to the other language from the target.
ha, fr Body
The text to translate. Up to 2,000 characters.
2000ha Hausa or fr French. The source defaults to the other language from the target.
ha, fr The language to translate into.
ha, fr Also return the translation spoken (base64 WAV).
Response
The translation. characters for text, audio_seconds for speech.
"translation"
"ha"
"fr"
The text sent, or what was heard in the audio.
The translation.
Text requests: characters translated.
Audio requests: length of the audio sent.
The translation spoken, base64 WAV, when asked for.