freetrans
freetrans is a free, open translation library for Python across multiple providers.
No API keys, no logins, no subscription fees, no credit cards. Just free, open translation that works.
Built as an extensible drop-in replacement for googletrans and googletrans-curl, freetrans integrates curl-cffi browser TLS/JA3 fingerprint impersonation to eliminate HTTP 429 Too Many Requests and rate-limiting blocks.
Why freetrans?
Translating text programmatically in Python shouldn't require paid API keys, monthly subscription tiers, or dealing with fragile rate limits.
- Drop-in Compatible: Compatible with
googletransandgoogletrans-curlworkflows. - Provider-Extensible: Begins with full Google Translate support (gtx/webapp endpoints) and is architected to expand to Bing, DeepL Free, DuckDuckGo, and other services.
- Anti-429 Protection: Uses
curl-cffibrowser fingerprint impersonation (default: Chrome) to bypass automated bot detection and HTTP 429 rate limits. - Async & Sync: Native
async/awaitsupport withTranslator, plus a rock-solid threaded synchronous wrapperSyncTranslatorand convenience methodstranslate_sync/detect_sync. - IPv4 DNS Fallback: Built-in
ipv4=Trueoption prevents 30-second libcurl timeouts on networks/routers with broken IPv6 resolution. - CLI Included: Full-featured command-line tool (
freetransandtranslate).
Installation
pip install freetrans-py
Note on Naming: The PyPI package distribution is named
freetrans-py, while the Python module namespace isfreetrans:from freetrans import SyncTranslator, Translator
Quickstart
1. Synchronous Usage (SyncTranslator)
Ideal for scripts, data analysis, Jupyter notebooks, and legacy codebases:
from freetrans import SyncTranslator
with SyncTranslator() as translator:
result = translator.translate("Artificial intelligence is transforming our world.", dest="de")
print(result.text)
# Output: Künstliche Intelligenz verändert unsere Welt.
Or 1-line drop-in migration from legacy synchronous code:
# Simply replace your import:
from freetrans import SyncTranslator as Translator
translator = Translator()
result = translator.translate("Hello world", dest="es")
print(result.text) # ¡Hola Mundo!
translator.close()
2. Asynchronous Usage (Translator)
Native async/await for high-performance applications and web frameworks (FastAPI, Starlette, Quart, etc.):
import asyncio
from freetrans import Translator
async def main():
async with Translator() as translator:
# Single translation
result = await translator.translate("Bonjour le monde", dest="en")
print(f"[{result.src} -> {result.dest}] {result.text}")
# Output: [fr -> en] Hello World
# Batch translation
items = ["Good morning", "Good afternoon", "Good night"]
translations = await translator.translate(items, dest="ja")
for item in translations:
print(f"{item.origin} -> {item.text}")
asyncio.run(main())
3. Language Detection
from freetrans import SyncTranslator
with SyncTranslator() as translator:
detection = translator.detect("이 문장은 한국어로 작성되었습니다.")
print(f"Language: {detection.lang}, Confidence: {detection.confidence}")
# Output: Language: ko, Confidence: 1.0
Architecture & Providers
freetrans decouples the client API from translation backend providers:
Application Code
│
│ from freetrans import Translator
▼
┌───────────────┐
│ freetrans │
│ Translator │
└───────┬───────┘
│
┌────────────────┼────────────────┐
│ provider │ provider │ provider
▼ ▼ ▼
┌───────────────┐┌───────────────┐┌───────────────┐
│GoogleProvider ││ BingProvider ││ DeepL Provider│
│ (Default) ││ (Planned) ││ (Planned) │
└───────┬───────┘└───────────────┘└───────────────┘
│
┌────┴────┐
│transport│
▼ ▼
curl-cffi httpx
(Chrome)
│
▼
Free Translation Service
Selecting Providers
# Default provider is Google
translator = Translator(provider="google")
Advanced Options
Preventing IPv6 DNS Timeouts (ipv4=True)
Networks or Wi-Fi routers with broken IPv6 DNS frequently cause 30-second libcurl connection timeouts. Pass ipv4=True or ip_resolve="v4" to force IPv4 DNS queries:
translator = Translator(ipv4=True)
# or
sync_trans = SyncTranslator(ipv4=True)
Pluggable HTTP Transport
# Auto-detects curl-cffi, falls back to httpx (default)
t1 = Translator(transport="auto")
# Enforce curl-cffi with custom browser impersonation
t2 = Translator(transport="curl", impersonate="safari")
# Use standard httpx
t3 = Translator(transport="httpx")
Custom curl_options
Arbitrary libcurl options can be passed directly:
from freetrans import CurlOpt, Translator
options = {
CurlOpt.CONNECTTIMEOUT: 10,
CurlOpt.FOLLOWLOCATION: 1,
}
translator = Translator(curl_options=options)
Command Line Interface (CLI)
freetrans provides CLI tools via both freetrans and translate commands:
# Basic translation
freetrans "Hello world!" -d es
# Output:
# [en] Hello world!
# ->
# [es] ¡Hola Mundo!
# Detect language
freetrans -c "Bonjour tout le monde"
# Output: [fr, 1.0] Bonjour tout le monde
# Force IPv4 resolution
freetrans "Welcome home" -d de -4
# Specify provider
freetrans "Hello friend" -d zh-cn -p google
Migration Guide
Migrating from googletrans or googletrans-curl
-
Change your package dependency from
googletransorgoogletrans-curltofreetrans-py:pip uninstall googletrans googletrans-curl pip install freetrans-py
-
Update your Python imports:
# Old: from googletrans import Translator, SyncTranslator, LANGUAGES # New: from freetrans import Translator, SyncTranslator, LANGUAGES
All parameters, methods, return objects (Translated, Detected), and exceptions are 100% compatible.
License
This project is licensed under the Apache License 2.0.
Metadata
Release files for freetrans-py 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| freetrans_py-0.1.0.tar.gz | 25.4 kB | With provenance | Details for freetrans_py-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| freetrans_py-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for freetrans_py-0.1.0-py3-none-any.whl |
Total release size: 53.0 kB
Release files / freetrans_py-0.1.0.tar.gz
| Download URL | freetrans_py-0.1.0.tar.gz |
|---|---|
| Size | 25.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
014fec2be6902992e383b910e264d532264b00e9274b1ff5c2e1d4800b32e35a
|
|
BLAKE2b-256 checksum How to use checksums |
f008c96421c8a773a9cc2f7f24d7ab6692e40446bbb4eb13b2784571c9a91fd0
|
| 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 4, 2026.
Transparency logRelease files / freetrans_py-0.1.0-py3-none-any.whl
| Download URL | freetrans_py-0.1.0-py3-none-any.whl |
|---|---|
| Size | 27.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f7334df244674c4e3b58fc76e51df6ff5e68b6d3434db652b068654e79d32daf
|
|
BLAKE2b-256 checksum How to use checksums |
6d2061643dfc8469b883f1888e1bdc92fbaf055856c6bc49aaef5cb619d5fd06
|
| 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 4, 2026.
Transparency logSecurity for freetrans-py 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.
Attestation for freetrans_py-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 4, 2026.
Transparency logA 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.