Python client for the TranslateNets API.
Project description
TranslateNets Python SDK
Python client for the TranslateNets API: translate text, images (PNG, JPEG, WebP), and Word documents (.docx).
Requirements: Python 3.10+
Install
pip install translatenets
Authentication
Create an API key at translatenets.com/dashboard/api-keys and set TRANSLATENETS_API_KEY, or pass api_key= to Translator.
Usage
import os
from translatenets.client import Translator
t = Translator(api_key=os.environ["TRANSLATENETS_API_KEY"])
# Text — returns JSON from the API (e.g. translated fields)
t.translateText("Hello, world!", target_language="jp")
# Image — path to PNG/JPEG/WebP; response includes a data URL under `image`
t.translateImage("/path/to/image.png", target_language="jp")
# Optional: write translated binary to disk (same idea for documents)
t.translateImage("/path/to/image.png", target_language="jp", save_path="/path/to/out.png")
# Document — `.docx` only, max 20 MB per file
t.translateDocument("/path/to/doc.docx", target_language="jp", save_path="/path/to/out.docx")
# Supported language codes (also available programmatically)
t.getLanguages() # e.g. "en", "jp"
Optional arguments on translate methods:
source_language— omit for auto-detection where supported.provider— one ofgrok,openai,claude,gemini(default on the client isgrok).
Limits: text input up to 80,000 characters; images up to 10 MB.
Contributing
-
Get an API key from TranslateNets and copy
.env.exampleto.envwithTRANSLATENETS_API_KEYset. -
Clone the repo and install with uv:
git clone https://github.com/TranslateNets/translatenets-python.git cd translatenets-python uv sync --group dev
-
Run tests:
uv run pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file translatenets-0.1.0.tar.gz.
File metadata
- Download URL: translatenets-0.1.0.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65ec765bab92d012b6234b9c9e1d43b68adca798d8e59bfc143b12f57d3b71e4
|
|
| MD5 |
253114e92a2fa9c16957c20ff5429660
|
|
| BLAKE2b-256 |
df533dc92b7dede505627403938f6b1fa557b546ace49719f35280dc3eee9435
|
File details
Details for the file translatenets-0.1.0-py3-none-any.whl.
File metadata
- Download URL: translatenets-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bc48ff53b675f984353d067bf7f4f5def5a7a69dbb9656ee00effc4013bba7d
|
|
| MD5 |
12d309e2ec68745b21d88715fb7ed368
|
|
| BLAKE2b-256 |
a76a4c1045a91de2f598ec5e43d6ff132c076861d894143d0cc05e2bf09926a1
|