OpenAI Translate without login/keys
translate.py translates via OpenAI's ChatGPT Translate (chatgpt.com/translate/)
with plain requests — no login, no API key. Everything is auto-extracted at
runtime by replicating the page's own anonymous handshake (reverse-engineered
from its JS bundles).
Request chain
GET https://chatgpt.com/translate/→ cookies (oai-diddevice id, Cloudflare).POST https://chatgpt.com/backend-api/sentinel/chat-requirements/preparebody{"p": "gAAAAAC" + base64(JSON(fingerprint config))}→{prepare_token, proofofwork: {seed, difficulty}, turnstile, so}.- Solve the proof-of-work in Python: FNV-1a-32 + fmix32 avalanche over
seed + base64(JSON(config)), find config withdigest[:len(difficulty)] <= difficulty(string compare, ~2.6% hit rate, solves in milliseconds). Answer ="gAAAAAB" + base64(JSON(config)) + "~S". POST https://chatgpt.com/backend-api/sentinel/chat-requirements/finalizebody{"prepare_token", "proofofwork": answer}→{token}(personachatgpt-noauth). Turnstile is listed as required but the translate endpoint accepts a valid PoW without it.POST https://chatgpt.com/translate/streamwith anonymous headers (OAI-Language,OAI-Device-Id,x-openai-web-frontend: core_web,OAI-Client-Version,OAI-Client-Build-Number,OAI-Session-Id) and body{request: {sourceLanguageCode, targetLanguageCode, text, pipeline: "latency-optimized", ...}, sentinel: {chatReqToken, chatReqPrepareToken, turnstileToken: null, proofToken}}. Response is SSE:data: {"delta": "..."}chunks, ends withdata: [DONE].
Notes: tokens are effectively single-use — a 403 triggers one automatic fresh
handshake + retry. source="detect" auto-detects the input language.
Usage
from openai_translate import OpenAITranslate
t = OpenAITranslate()
print(t.translate("Hello world", target="es", source="en"))
print(t.translate("مرحبا بالعالم", target="en")) # source auto-detected
Install as a library:
pip install .
Or from PyPI (after a GitHub release is published):
pip install openai-translate
Publishing to PyPI uses an API token:
- On pypi.org: Account settings → API tokens → create a token scoped to the
openai-translateproject - In this repo: Settings → Secrets and variables → Actions → add it as
PYPI_API_TOKEN - Create a GitHub release — the workflow builds and publishes automatically
Metadata
Release files for openai-translate 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| openai_translate-1.0.1.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openai_translate-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.6 kB
Release files / openai_translate-1.0.1.tar.gz
| Download URL | openai_translate-1.0.1.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c55078617b331f231ce34413c6a98c971851c71abd4259341cc3468351012b50
|
|
BLAKE2b-256 checksum How to use checksums |
eaa8c41048d773dc95f39cfd4be80a2141b9c642b93cfdb0004ad72342f5ec24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / openai_translate-1.0.1-py3-none-any.whl
| Download URL | openai_translate-1.0.1-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6f0721a64eb17dad1d39599475d8728919de688dc76a32522605c1e6578ffa38
|
|
BLAKE2b-256 checksum How to use checksums |
9e306d8b99313fc51272b0ac114ff70317e64b37b631ada84c7e624a53950add
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|