googletrans reverse engineers Google's token, and the readme says that can stop at any time
(unofficial) Googletrans: Free and Unlimited Google translate API for Python. Translates totally free of charge.
At a glance
- What is it?
- googletrans is an unofficial Python wrapper for the translate.google.com web endpoint, with async, bulk, proxy and HTTP/2 support plus a small command line tool. Its own documentation is blunt about the risk: the token is reverse engineered, the service can block a client IP, and the official API is recommended when stability matters.
- Who is it for?
- googletrans fits a script, a prototype or a personal tool that needs Google quality translation without an API key and does not care when the endpoint changes underneath it. It does not fit a production service, because the token is reverse engineered, an IP ban looks like a 5xx error, and the library carries a 15k character ceiling per text.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 106 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.
Star history
- ssut/py-googletrans4,304 ★ · +20
| Repository | 2026-09-23 | 2026-11-22 |
|---|---|---|
| ssut/py-googletrans | 4.3k | 4.3k |
20 Stars in the last 60 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The token is reverse engineered, and that is the whole risk
The library explains itself against a competitor rather than against the API docs. Older approaches such as goslate stopped working, it says, after Google updated the translation service with a ticket mechanism aimed at stopping large numbers of crawlers. The way around that was to work out how to generate a ticket by reverse engineering the obfuscated and minified JavaScript Google uses to produce the token, and then reimplement that in Python. The documentation does not soften the conclusion: this could be blocked at any time. Two operational symptoms follow from the same mechanism. An HTTP 5xx response, or an error like #6, points at Google having banned the client IP address rather than at a bug in your code, and the fix is not in the library.
Pointing service_urls at the direct host skips the token entirely
There is one configuration that avoids the fragile part, and it is a domain name rather than a flag. The translate.google.<domain> services are the web app and need a token, so the constructor takes a service_urls list where you can substitute translate.googleapis.com, which is the direct API and needs no token to process a request. That is offered as the answer to unstable token problems, with issue #234 named as the reference. The same parameter is also the multi domain feature: pass several hosts and one is chosen at random, which spreads load across the regional domains rather than pinning every caller to one. The parameter takes a list either way, so switching to the direct host is a change to the constructor and nothing else in the calling code has to move.
15k characters per text, and one session per bulk call
Two limits shape how you call the library. The first is stated as a hard number: the maximum character limit on a single text is 15k. The second is structural rather than a number, and it is the bulk path. An array can be passed to the same translate method, and the whole array goes out in a single method call over a single HTTP session, so splitting work into batches avoids paying the connection cost per string. The documented example prints each result's origin and text side by side for a three string array. Translation is shown in async form, with the translator opened as a context manager and the call awaited, and the examples cover a detected source language, an explicit destination, and an explicit source. The returned object carries the source, the destination, the text and a pronunciation field, so you do not have to call the service again to know what was detected.
The command line tool is one argument and three flags
Installing the package also installs a command called translate, declared in the project scripts as pointing at the translate entry point inside the package. Its usage line is translate with a help flag, a destination flag, a source flag and a detect flag, and the positional argument is the text. The destination defaults to en and the source defaults to auto, which means the CLI detects the language when you do not name one. Detection has its own flag, and the output format carries the language and a confidence number, shown as a bracketed pair. A translation prints the original text, an arrow, the result in the target language, and a separate pronunciation line. There is no configuration file, no batching flag and no proxy flag on this interface, so anything beyond a single string is library work rather than shell work.
HTTP/2 comes from httpx, and you can see it on the result
The transport is not bespoke. The only runtime dependency is httpx with the http2 extra at a version floor of 0.27.2, and because that client negotiates HTTP/2 by default, the library gets HTTP/2 without doing anything itself. That is also the one performance claim in the feature list that is checkable from Python rather than from a benchmark: the underlying response object is reachable from a Translated or Detected instance, and its http_version attribute reports the negotiated protocol, with a documented value of HTTP/2. The pinned requirements file shows what that pulls in, compiled by uv from the project file, with h2, hpack and hyperframe for the HTTP/2 side and httpcore, h11, anyio, certifi, idna and sniffio underneath. Proxy support is listed alongside, and the client is fully typed.
One runtime dependency, Python 3.8 and up, four test tools
The packaging is small enough to read in one pass. The project file declares the package name googletrans at version 4.0.2, requires Python 3.8 or newer, and lists exactly one runtime dependency, httpx with the http2 extra. The build backend is hatchling. Test and lint tooling sits in an optional dev extra and again under the uv section, with pytest, pytest-asyncio, pytest-cov and ruff at a floor of 0.7, and the repository root carries pytest.ini, tox.ini and a separate test-requirements.txt alongside a uv.lock. Classifiers mark the package as production/stable and cover Python 3.8 through 3.12 on POSIX, Windows and macOS. The example directory holds a single script, translate_word_doc.py, which translates a Word document, and the documentation is published separately at the readthedocs site.
A 2015 tag, a 2024 tag, and a 2026 commit
The version history has an unusual shape. The visible releases are 1.2, tagged in 2015 under the name Py-GoogleTrans 1.2, and v4.0.0 in December 2024. Between those sit years that the release list does not describe, and the package metadata is now at 4.0.2, a version with no GitHub release. The last commit on the default branch landed on 2026-08-08. Read together, the three facts describe a library that is still receiving changes while its published release history has not moved since 2024, and that the version in the project file is ahead of the newest release.
The disclaimer says not to depend on it when stability matters
The usage note opens by stating that this is an unofficial library using the web API of translate.google.com and is not associated with Google. Three cautions follow in sequence. The web version of the service has limitations, so the library does not guarantee it will work properly at all times, and the advice given is to use it if you do not care about stability. For a stable API the documentation recommends Google's official translate API instead. And a 5xx response or an error like #6 is attributed to Google having banned the client IP. Nothing in that list is a bug report; it is the accepted cost of using the front end instead of a paid endpoint, and it is stated before the versioning section rather than after it.
Editorial conclusion
googletrans fits a script, a prototype or a personal tool that needs Google quality translation without an API key and does not care when the endpoint changes underneath it. It does not fit a production service, because the token is reverse engineered, an IP ban looks like a 5xx error, and the library carries a 15k character ceiling per text. Before depending on it, read the disclaimer, point service_urls at the direct API host if a token failure is the problem you are seeing, and budget for the day the endpoint changes and the wrapper stops working until someone updates it.
Frequently asked questions
Is the googletrans Python library free?
It is described as a free and unlimited library that implements the Google Translate API through the translate.google.com web endpoint, so there is no API key and no per character charge. It is unofficial and not associated with Google, and for a stable API the documentation recommends Google's official translate API.
What is the maximum text length for googletrans?
The maximum character limit on a single text is 15k. For more, pass an array to the same translate method, which translates the batch in one method call over a single HTTP session and returns one result per input string.
Why do I get an HTTP 5xx error from googletrans?
A 5xx response or an error like #6 is probably Google having banned your client IP address. The library also warns that the ticket it reverse engineers from Google's obfuscated JavaScript could be blocked at any time, so a change on Google's side can break the wrapper without any code change on yours.
How do I use a different Google domain with googletrans?
Pass service_urls to the Translator constructor. Several URLs can be given, and one is chosen at random, which spreads requests across regional domains. Using translate.googleapis.com instead selects the direct API, which needs no token and avoids the unstable token process described in issue #234.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/ssut-py-googletrans)Star history chart for your README
[](https://hysenlabs.com/projects/ssut-py-googletrans)Was this useful?