Skip to main content

translatarr-client

A typed Python client for the Translatarr API — synchronous and asynchronous, with pydantic response models generated from the server's OpenAPI spec.

Install

pip install translatarr-client

Published to PyPI for each v* tag (the version matches the app's tag). The same wheel + sdist are also attached to the corresponding GitHub Release, and you can install straight from this repo:

# from a published GitHub Release (version matches the app's v* tag)
pip install https://github.com/joshrmcdaniel/translatarr/releases/download/v1.2.3/translatarr_client-1.2.3-py3-none-any.whl

# or straight from this repo
pip install -e clients/python

Requires Python 3.10+.

Authentication

Mint a personal API key in the web UI under Settings → API keys (tokens are prefixed tra_ and shown only once). Pass it as token:

from translatarr import TranslatarrClient

with TranslatarrClient("https://translatarr.example", token="tra_…") as tra:
    result = tra.translate("Good morning", source_lang="en", target_lang="ja")
    best = result.translations[0]
    print(best.text, best.romanization)

A browser session cookie works too, via session_cookie="…" instead of token.

Async

AsyncTranslatarrClient mirrors the sync client method-for-method:

import asyncio
from translatarr import AsyncTranslatarrClient

async def main() -> None:
    async with AsyncTranslatarrClient("https://translatarr.example", token="tra_…") as tra:
        result = await tra.translate("Bonjour", source_lang="auto", target_lang="en")
        print(result.detected_source_language, result.translations[0].text)

asyncio.run(main())

What you can do

Area Methods
Translate translate
Chats list_chats, create_chat, get_chat, rename_chat, clear_chat, delete_chat
Turns add_turn, list_turns, select_option, retranslate_turn, switch_branch
Speech transcribe, synthesize
API keys list_keys, create_key, revoke_key

Persisting a chat without paying for a second translation

translate does not store anything; add_turn translates and persists. To avoid a duplicate LLM call, pass the result you already have:

chat = tra.create_chat(source_lang="en", target_lang="ja")
preview = tra.translate("Let's ship it", source_lang="en", target_lang="ja", chat_id=chat.id)
chat = tra.add_turn(chat.id, "Let's ship it", source_lang="en", target_lang="ja", result=preview)

Errors

Failures raise a subclass of translatarr.APIError, each carrying status_code, the server's code (when present), and the raw response:

Exception Status
InvalidRequestError 400
AuthenticationError 401
ForbiddenError 403
NotFoundError 404
ConflictError 409
MalformedResponseError 422
ProviderError 502
from translatarr import NotFoundError

try:
    tra.get_chat("does-not-exist")
except NotFoundError:
    ...

Development

The response models in src/translatarr/_models.py are generated from the server's OpenAPI document — do not edit them by hand. To regenerate after the API schema changes:

# one-time tooling install
python -m venv clients/python/.venv
clients/python/.venv/bin/pip install -e 'clients/python[codegen]'

# regenerate openapi.json + _models.py
clients/python/scripts/regenerate.sh

The script dumps the spec via bun scripts/dump-openapi.ts (the same document served at /api/docs/openapi.json) and runs datamodel-codegen over it. Only _models.py is committed, so the client builds and installs without a running server; openapi.json is a regenerated, gitignored artifact.

Metadata

Release files for translatarr-client 0.2.3

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

Source distribution (sdist)

Source distribution for translatarr-client 0.2.3
File Size Uploaded Provenance Actions
translatarr_client-0.2.3.tar.gz 13.0 kB With provenance Details for translatarr_client-0.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for translatarr-client 0.2.3
File Interpreter ABI Platform Actions
translatarr_client-0.2.3-py3-none-any.whl Python 3 none any Details for translatarr_client-0.2.3-py3-none-any.whl

Total release size: 29.3 kB

Release files / translatarr_client-0.2.3.tar.gz

Download URL translatarr_client-0.2.3.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
92886b13b7cb2704ddf618bf9f1891113f6bbf8c1c5dd641947047a8b8eef131
BLAKE2b-256 checksum
How to use checksums
cc9865cde48cf062ee2f4d1c8879ae03f79914314282cd40919efb4ed598f86b
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 14, 2026.

Transparency log

Release files / translatarr_client-0.2.3-py3-none-any.whl

Download URL translatarr_client-0.2.3-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c83e31401e6cff8748321c3fe666e60a5e494206b9c6c3f854956e8a094fd074
BLAKE2b-256 checksum
How to use checksums
b080ecda24be0a2412c5ea3b862eefd25a5871c66229bba26d89b7bd15d69a73
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 14, 2026.

Transparency log

Security for translatarr-client 0.2.3

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 translatarr_client-0.2.3.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 14, 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.

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