Skip to main content

Namu API for Python

Speech recognition, speech synthesis, translation and a voice agent for Hausa, Zarma and French, from Python.

pip install namu-ai
from namu import Namu

client = Namu()  # reads NAMU_API_KEY

audio = client.speech("Sannu da zuwa! Muna farin cikin jin muryarku.", voice="nadia", format="mp3")
open("welcome.mp3", "wb").write(audio)

print(client.transcribe("welcome.mp3", language="ha")["text"])

Get a key at namuai-lab.com/account/keys and keep it on your server: never in a mobile app or a web page. During the beta every account gets 30 minutes of audio a month, free.

Usage

# Text to speech: Hausa (nadia), Zarma and Hausa (mouhamad), French (fr); wav, mp3 or opus
audio = client.speech("Fofo! Mate ni go?", voice="mouhamad", language="dje", format="opus")

# Speech to text: a path, bytes or an open file; ha, dje or fr (not detected: say which)
result = client.transcribe("voice-note.ogg", language="ha")

# Translation, Hausa ⇄ French, from text or speech, optionally spoken back (base64 WAV)
fr = client.translate("Ina kwana? Yau za a yi zafi sosai.", source="ha", target="fr")
spoken = client.translate(audio="question.ogg", source="ha", target="fr", include_audio=True)

# Voice agent (research preview; the key needs the converse scope)
turn = client.converse("hello.ogg", session_id="demo-42")

# Account and catalogue
client.usage()    # {'month_audio_seconds_used': 312.4, 'month_audio_seconds_limit': 1800.0}
client.voices()   # no key needed
client.models()

Responses are plain dictionaries, typed with TypedDict (namu.types) for your editor.

Errors

Every error is a NamuError. Errors the API answered carry its stable type, the HTTP status, a message and the request_id to send Namu.

from namu import Namu, NamuError, QuotaExceededError, BadRequestError

try:
    audio = client.speech(text)
except QuotaExceededError:
    ...                      # this month's allowance is used
except BadRequestError as e:
    print(e.type, e.message) # unknown_voice, unsupported_language, missing_text, ...
except NamuError as e:
    print(e.status, e.type, e.request_id)
Class Status type
BadRequestError 400 invalid_request, invalid_json, missing_text, missing_file, empty_audio, unknown_voice, unsupported_language, unsupported_pair, unknown_persona
AuthenticationError 401 missing_api_key, invalid_api_key, key_revoked
PermissionDeniedError 403 insufficient_scope, account_paused
PayloadTooLargeError 413 payload_too_large, audio_too_long, text_too_long
UnsupportedAudioError 415 unsupported_audio
NothingHeardError 422 nothing_heard
RateLimitError / QuotaExceededError 429 rate_limited / quota_exceeded
InternalServerError 5xx internal_error, upstream_error, upstream_timeout, ...
APIConnectionError / APITimeoutError none the API could not be reached, or did not answer in time

Retries and timeouts

Network errors, 429 rate_limited and 502/503/504 are retried up to 3 times, after Retry-After or 1, 2, 4 seconds (with jitter). quota_exceeded and other 4xx never are. The default timeout is 300 seconds: the first request after a quiet spell can take a minute while a model wakes up.

client = Namu(timeout=120, max_retries=5)

Configuration

Argument Environment Default
api_key NAMU_API_KEY none
base_url NAMU_BASE_URL https://api.namuai-lab.com
timeout 300 seconds
max_retries 3
session a new requests.Session

Data

Speech to text and text to speech run on Namu's own models. Translation and the voice agent's replies are written by Google Gemini through OpenRouter, which receives the text they work on. Namu keeps usage records, not your audio or text.

Development

pip install -e ".[dev]"
pytest                        # mocked, no network
NAMU_LIVE=1 pytest -m live    # the free endpoints of the real API

Requires Python 3.9+. Licensed under Apache 2.0.

Metadata

Release files for namu-ai 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for namu-ai 0.1.0
File Size Uploaded Provenance Actions
namu_ai-0.1.0.tar.gz 14.7 kB With provenance Details for namu_ai-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for namu-ai 0.1.0
File Interpreter ABI Platform Actions
namu_ai-0.1.0-py3-none-any.whl Python 3 none any Details for namu_ai-0.1.0-py3-none-any.whl

Total release size: 29.0 kB

Release files / namu_ai-0.1.0.tar.gz

Download URL namu_ai-0.1.0.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7392a1148d9ddcc063e88b23948cb85db55b4a5f734b58924db5ac491adf60e8
BLAKE2b-256 checksum
How to use checksums
f36a292be413ea5d243ba97e93f2f6e475d8c8f31ee6c96c03fd68b021be3ef5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / namu_ai-0.1.0-py3-none-any.whl

Download URL namu_ai-0.1.0-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7eceb7f008b1ba9f10ad1c0dba242cecca1780fe3fcbdc3b316ce15cce78a6c
BLAKE2b-256 checksum
How to use checksums
e207657a021b331315284d31d40844c814bd31fe804cd9c6ee20dd922da88d26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Security for namu-ai 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for namu_ai-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page