Repository navigation
Community Plugin: OAuth bridge for Claude Max, ChatGPT Plus, and Google Gemini subscriptions #38246
Replies: 1 comment
|
Following up on my own question, since I found the answer and it is worth writing down. The hook point is Rewrote the thing on that basis: litellm-mysubs. What changed beyond the hook point, since the old version's problems were real:
Three things I measured along the way that might save someone else the time:
Ten decisions like those, each with the measurement behind it, are in On provenance, since the old version was vague about it: the wire-level work is a port of Same caveat as before, stated more plainly this time: this is a personal tool for your own |
Uh oh!
There was an error while loading. Please reload this page.
I built a plugin that lets you use paid AI subscriptions (Claude Max, ChatGPT Plus, Google Gemini) as LiteLLM backends via OAuth — no API keys needed.
How it works
A
sitecustomize.pyinjected viaPYTHONPATHpatcheslitellm.completionandlitellm.acompletionat Python startup to intercept calls and forward them to the providers' first-party subscription endpoints — the same wire protocols used by their official CLI tools (Claude Code, Codex CLI, Google Antigravity).https://api.anthropic.com/v1/oauth/token— single-use refresh token rotation, Claude Code wire protocolhttps://chatgpt.com/backend-api/codex/responses— Responses API SSE with full tool calling and streaminghttps://daily-cloudcode-pa.googleapis.com/v1internal:streamGenerateContent— 64k outputs,parametersJsonSchema,thoughtSignaturepreservationInstall
No fork, no code changes to LiteLLM.
Token lifecycle
Anthropic rotates single-use refresh tokens on every refresh. The plugin serializes refreshes with a
threading.Lockand persists the new token to a Kubernetes Secret before returning — so it survives pod restarts and concurrent processes don't race into400 invalid_grant.OAuth loopback problem
Providers whitelist specific localhost ports for the OAuth callback (54545, 1455, 51121). A Tauri desktop app runs on your workstation to catch the redirect and push credentials to the remote cluster.
Known limitations
Personal homelab tool — not production hardened. The credential API has no authentication and TLS validation is disabled in the desktop sync client. Full known issues documented in the README.
Repo
https://github.com/eduardopessin/tokengateway
Happy to answer questions about the wire protocol details. Would love feedback on whether there's a cleaner hook point in LiteLLM's plugin architecture that would avoid
sitecustomize.pyentirely.All reactions