Skip to main content

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

  1. GET https://chatgpt.com/translate/ → cookies (oai-did device id, Cloudflare).
  2. POST https://chatgpt.com/backend-api/sentinel/chat-requirements/prepare body {"p": "gAAAAAC" + base64(JSON(fingerprint config))} → {prepare_token, proofofwork: {seed, difficulty}, turnstile, so}.
  3. Solve the proof-of-work in Python: FNV-1a-32 + fmix32 avalanche over seed + base64(JSON(config)), find config with digest[:len(difficulty)] <= difficulty (string compare, ~2.6% hit rate, solves in milliseconds). Answer = "gAAAAAB" + base64(JSON(config)) + "~S".
  4. POST https://chatgpt.com/backend-api/sentinel/chat-requirements/finalize body {"prepare_token", "proofofwork": answer} → {token} (persona chatgpt-noauth). Turnstile is listed as required but the translate endpoint accepts a valid PoW without it.
  5. POST https://chatgpt.com/translate/stream with 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 with data: [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:

  1. On pypi.org: Account settings → API tokens → create a token scoped to the openai-translate project
  2. In this repo: Settings → Secrets and variables → Actions → add it as PYPI_API_TOKEN
  3. 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)

Source distribution for openai-translate 1.0.1
File Size Uploaded
openai_translate-1.0.1.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openai-translate 1.0.1
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

1.0.2

2 release files

This release

1.0.1 This release

2 release files

1.0.0

2 release files

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