Overview
POST /v1/translate translates between Hausa and French, in both directions. It takes text or a recording, and can also return the translation spoken aloud, so one request turns a Hausa voice note into French audio.
- Model:
translation(beta) - Directions:
ha → frandfr → ha - Input: JSON text (up to 2,000 characters), or audio like speech to text
- Counts: text: characters ÷ 15 as seconds; audio: the length you send; plus the spoken translation if you ask for it
The translation is written by Google Gemini through OpenRouter, which receives the text to translate (and, for spoken French, the recording, to write it down). Tell your users if their messages leave for a third party. Speech to text and text to speech run on Namu’s own models.
Translate text
Send JSON.target is the language you want; source is the other one unless you say otherwise.
Response
The translations shown in these docs illustrate the shape of the response. Your results will vary with the text.
Translate speech
Send the recording asfile. The API writes down what was said (source_text), then translates it (text):
422 nothing_heard.
Get the translation spoken
Addinclude_audio and the answer carries an audio field: the translation spoken, as base64 WAV (24 kHz, mono). With JSON, put it in the body; with audio, as a form field or query parameter.
Python
Request
string
Text to translate, up to 2,000 characters. Send this or
file.file
A recording to translate. Send this or
text.string
default:"fr"
The language to translate into:
ha or fr.string
The language of the input:
ha or fr. Defaults to the language that is not target.boolean
default:"false"
Also return the translation spoken, as base64 WAV.
Best practices
- Translate whole sentences. The model uses the sentence around a word to choose its meaning; fragments lose that.
- Show both texts when it matters.
source_textlets a reader check what was understood before trusting the translation. - Keep a person in the loop for high stakes. Medical, legal and financial messages deserve a human check before they reach people.
Limits
- Hausa and French only. Zarma ⇄ French is not in the API yet (
400 unsupported_pair). - 2,000 characters of text, or 25 MB and 5 minutes of audio, per request.
Related
Build an interpreter
Tutorial
Speech to text
The same audio rules
API reference
POST /v1/translate