polyclaude
Use OpenAI, Gemini, or any OpenAI-compatible model inside the Claude Code CLI.
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 |
|---|---|---|---|
| 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 |
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 replace the whole
system prompt with --system path/to/file.md.
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polyclaude-0.1.0.tar.gz.
File metadata
- Download URL: polyclaude-0.1.0.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
111aff4d72bcbeea8685f063d5aed4250157cc329ffd363d163f30aa4e953e1e
|
|
| MD5 |
0ac5082a7c9ffbe0b05cea3fa789499e
|
|
| BLAKE2b-256 |
bc8222dbea20a1d8e8346b3d0c1900ab8cdb9cc3a3860f4f3bc777aabd42a055
|
Provenance
The following attestation bundles were made for polyclaude-0.1.0.tar.gz:
Publisher:
release.yml on ibedevesh/polyclaude
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polyclaude-0.1.0.tar.gz -
Subject digest:
111aff4d72bcbeea8685f063d5aed4250157cc329ffd363d163f30aa4e953e1e - Sigstore transparency entry: 2383428062
- Sigstore integration time:
-
Permalink:
ibedevesh/polyclaude@47bc149fc28ca94dfee394a07b87553a30f757d0 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ibedevesh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@47bc149fc28ca94dfee394a07b87553a30f757d0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file polyclaude-0.1.0-py3-none-any.whl.
File metadata
- Download URL: polyclaude-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0975344ef417e5c35b6b5588fa0d82e74f79321e0535062ef5221419398fd932
|
|
| MD5 |
145b108acf0ab88b12f82ebaff5ab35d
|
|
| BLAKE2b-256 |
c44867d8f05a34fa0217f9b8cdbc4b3200f87c7a9dc75db26b2c39c815430203
|
Provenance
The following attestation bundles were made for polyclaude-0.1.0-py3-none-any.whl:
Publisher:
release.yml on ibedevesh/polyclaude
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polyclaude-0.1.0-py3-none-any.whl -
Subject digest:
0975344ef417e5c35b6b5588fa0d82e74f79321e0535062ef5221419398fd932 - Sigstore transparency entry: 2383428233
- Sigstore integration time:
-
Permalink:
ibedevesh/polyclaude@47bc149fc28ca94dfee394a07b87553a30f757d0 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ibedevesh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@47bc149fc28ca94dfee394a07b87553a30f757d0 -
Trigger Event:
push
-
Statement type: