Claude Code is a great terminal coding agent — but it only talks to Anthropic's
models. polyclaude lets you keep the exact Claude Code experience (its UI,
tools, and agent loop) while the actual model behind it is GPT, Gemini, a Groq
model, an OpenRouter model, or a local Ollama model.
It works by running a tiny local proxy that speaks Claude Code's API on one side and your provider's API on the other, translating between them on the fly. Claude Code itself is never modified.
Claude Code ⇄ Anthropic Messages API ⇄ [ polyclaude ] ⇄ OpenAI / Gemini / …
Install
pipx install polyclaude # recommended
# or: uv tool install polyclaude
# or: pip install polyclaude
You'll also need Claude Code installed
(claude on your PATH) and an API key for whichever provider you want to use.
Use
export GEMINI_API_KEY=... # or OPENAI_API_KEY, GROQ_API_KEY, …
polyclaude --gemini # Claude Code, powered by Gemini
polyclaude --openai # …powered by GPT
polyclaude --openai --model gpt-4.1
polyclaude --gemini --model gemini-2.5-pro
That's it — you're dropped into a normal Claude Code session running on the model you chose. First run auto-configures the local proxy certificate; nothing else to set up.
Pass arguments straight through to claude after --:
polyclaude --gemini -- -p "explain this repo"
Providers
| Provider | Flag | Key env | Default model |
|---|---|---|---|
| Real Anthropic (passthrough) | --claude |
claude.ai login or ANTHROPIC_API_KEY |
as sent |
| Google Gemini | --gemini |
GEMINI_API_KEY |
gemini-2.5-pro |
| OpenAI | --openai |
OPENAI_API_KEY |
gpt-4.1 |
| Groq | --groq |
GROQ_API_KEY |
llama-3.3-70b-versatile |
| OpenRouter | --openrouter |
OPENROUTER_API_KEY |
anthropic/claude-3.5-sonnet |
| Ollama (local) | --ollama |
— | qwen2.5-coder |
--claude doesn't reroute — it passes your turn through to the genuine Anthropic
model (using Claude Code's own auth) so the bridge can transform requests
without changing the model. Pair it with the identity scrub.
Any model your key can access works via --model, including the newest ones
(Gemini 3.x, GPT-5.x). polyclaude handles the provider-specific details so tool
calling and reasoning keep working:
- Gemini 3.x thinking models need their function-call thought signatures round-tripped across turns — handled automatically.
- GPT-5.5 / 5.6 can't use tools and reasoning together on the standard
endpoint; polyclaude routes them through OpenAI's
/responsesAPI so you get both (tune depth with--reasoning low|medium|high). - Reasoning models reject non-default sampling params — dropped automatically.
- Turns that hit the output-token cap are transparently continued.
Run polyclaude --list to see everything.
Specialize the agent
Give the agent a persona/use-case with a profile — it's appended to the system prompt for the main loop only, so Claude Code's own tooling keeps working:
polyclaude --gemini --profile datascience
polyclaude --openai --profile reviewer
polyclaude --gemini --profile ./my-profile.md # your own file
Bundled profiles: datascience, reviewer, concise. Or point --profile at
your own .md file, or replace the whole system prompt with --system file.md.
Keep it going (governor)
Models inside Claude Code tend to do a little work and then hand control back — "here's what I found, let me know if you want more." For a long autonomous task that's the wrong default. The governor lets you decide when the model is allowed to stop, without letting it run on autopilot.
polyclaude --gemini --govern # turn it on with any provider
polyclaude --claude --govern # push the real Anthropic model
polyclaude --claude --govern --persist 30 # allow up to 30 continuations
When the model stops and returns you to the prompt, polyclaude appends a banner:
─────────────────────────────
⚠ polyclaude: model tried to STOP.
→ type go to push it to continue, or your own instruction.
─────────────────────────────
Type go and the bridge swaps that word — before it reaches the model —
for an authoritative platform-continuation directive, so the model treats it as
an order to resume rather than a nudge it can decline. Type anything else and
it's a normal turn (which also resets the counter).
You stay in the loop on every stop — nothing continues without your go. A hard
ceiling (--persist N, default 15) caps consecutive continuations as a safety
valve; after that the governor pauses until you give a real instruction.
| flag | what it does |
|---|---|
--govern |
enable the governor (also auto-on for a profile named pentest) |
--persist N |
max consecutive go continuations before pausing (default 15) |
--govern-trigger WORD |
change the trigger word from go |
--no-govern-banner |
suppress the "model tried to STOP" banner |
Works with every provider including --claude (the real Anthropic model),
which is where it shines — the strongest model, pushed to go the distance.
Identity scrub
Claude Code injects context about you into every request — your email, your
working directory, your OS, git state — right into the system prompt the model
reads. polyclaude can rewrite or strip all of it on the wire, so the model never
sees who you are. Works with any provider, including --claude (the real
Anthropic model):
# talk to the REAL Claude, but with your identity rewritten
polyclaude --claude --as-email engineering@probo.ai --identity Atlys=Probo
# value-agnostic: replaces EVERY email / home-dir username — no need to know them
polyclaude --gemini --as-email nobody@example.com --as-user anon
# deep rewrite from a reusable identity file (bundled name or your own .json)
polyclaude --claude --identity-file probo
# strip transport-layer telemetry too (x-stainless-* headers + user-agent)
polyclaude --claude --scrub-headers
# just look — log every identity signal each request carries, change nothing
polyclaude --claude --inspect /tmp/identity.json
| flag | what it does |
|---|---|
--as-email EMAIL |
rewrite every email in the payload (regex, no original needed) |
--as-user NAME |
rewrite every /Users/<x> · /home/<x> username |
--identity OLD=NEW |
literal replacements (company, name, anything); repeatable/comma-separated |
--identity-file NAME|PATH |
load a JSON { "old": "new" } map (bundled or your own) |
--scrub-headers |
strip x-stainless-* telemetry headers + user-agent |
--inspect [PATH] |
log every email / home path / context header per request |
The rewrite happens in the bridge before the request leaves your machine, on
both the system prompt and in-message system-reminders. Test it: run
polyclaude --claude --identity-file probo, then ask "what's my email and
company?" — the real Claude answers with the fake identity.
Resume a session
Claude Code keeps your conversations; resume them straight through polyclaude:
polyclaude --gemini --continue # continue the most recent session
polyclaude --gemini --resume # pick one from a list
Branding
Interactive sessions are branded polyclaude automatically: a green accent,
the polyclaude name, and — importantly — the real model name in the header
instead of a Claude model name. Change the accent colour with --hue:
polyclaude --openai --hue 200 # blue accent instead of green
This is display-only — it rewrites the terminal output as it's drawn; the Claude Code binary is never modified and your keystrokes pass through untouched.
How it works
polyclaude starts mitmproxy locally with a small
addon and points Claude Code at it (via HTTPS_PROXY + NODE_EXTRA_CA_CERTS,
scoped to that one process). The addon intercepts requests to
api.anthropic.com/v1/messages, translates the Anthropic request into the
provider's format, calls the provider, and streams the reply back in Anthropic's
event format. Every other host is passed straight through untouched.
Only sessions you launch with polyclaude are affected — your normal claude
is unchanged and still uses Anthropic.
FAQ
Does this change my Claude Code install? No. It only sets proxy environment variables for the session it launches.
Do my keys leave my machine? Only to the provider you choose (Google, OpenAI, etc.), exactly as if you called their API directly. polyclaude has no servers.
Quality feels off on some models. Different models behave differently inside
Claude Code's harness (its prompt and tools are tuned for Claude). Larger/newer
models fare better; try --reasoning high on OpenAI and compare providers.
Can I use my own endpoint? Yes — anything OpenAI-compatible. Point at it and go (OpenRouter, vLLM, LM Studio, etc.).
Notes
For personal and development use, with your own API keys. Respect the terms of service of Claude Code and of whichever model provider you use.
License
MIT © Devesh Pratap
Star History
Metadata
Release files for polyclaude 0.3.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 | |
|---|---|---|---|
| polyclaude-0.3.0.tar.gz | 9.7 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| polyclaude-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.7 MB
Release files / polyclaude-0.3.0.tar.gz
| Download URL | polyclaude-0.3.0.tar.gz |
|---|---|
| Size | 9.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
590079cb6e778e72ccf0318786af53635f76b358c02ed07b7e07119606d6c938
|
|
BLAKE2b-256 checksum How to use checksums |
4e4a5e0091455fbadfebe2a5fe71c8dbb26f39e611a5ca52098f903921eecd99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 29, 2026.
Transparency logRelease files / polyclaude-0.3.0-py3-none-any.whl
| Download URL | polyclaude-0.3.0-py3-none-any.whl |
|---|---|
| Size | 26.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a84e850e355036475c61701a4a4e3c0613a47b01adc3118a6ad4493ecbcfadaf
|
|
BLAKE2b-256 checksum How to use checksums |
09b5f57203b7307a59de2814789b938474db1ecf09d28c90766b2c63ec992db7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 29, 2026.
Transparency log