Run the Claude Code harness (its UI, tools, subagents, skills) on non-Claude
(OpenAI) models — while keeping plain claude untouched on Anthropic.
It works by pointing Claude Code at a local CLIProxyAPI instance that speaks
Anthropic's API format on the front and reuses your ChatGPT/Codex OAuth login
on the back. A claudex shell function flips the model per-launch; claude stays
exactly as-is.
claude # Claude (Opus/Sonnet), Anthropic direct — your Claude sub
claudex # Claude Code harness on gpt-5.6-sol via proxy — your ChatGPT/Codex sub
claudexp # pick ANY model the proxy exposes, then launch
Inspired by Theo's setup.
- macOS with Homebrew
- Claude Code (
claudeon your PATH) - A ChatGPT/Codex account with access to the GPT models you want
git clone https://github.com/matheustimbo/cc-openai-proxy.git
cd cc-openai-proxy
./install.shThe installer:
brew install cliproxyapi- Generates a fresh local proxy token (nothing secret is ever committed)
- Writes the proxy config to
$(brew --prefix)/etc/cliproxyapi.conf(localhost-only,:8317) - Installs the shell module to
~/.config/claudex/claudex.zshand sources it from~/.zshrc - Runs the interactive Codex OAuth login (
cliproxyapi -codex-login) — opens a browser - Starts the proxy as a background service and verifies it
Then open a new terminal (or source ~/.zshrc).
Skip the browser login for now: ./install.sh --no-login, and run
cliproxyapi -codex-login later.
claudex # start on the default model (gpt-5.6-sol)
CLAUDEX_MODEL=gpt-5.6-terra claudex # any model, this run only
claudexp # interactive picker over all proxy models
claudex --continue # extra args pass through to claudeClaude Code's /model menu is a fixed Claude-tier UI (Opus/Sonnet/Haiku) — it
cannot enumerate every OpenAI model. This setup maps the three slots to three
GPT models so /model becomes a live 3-way switcher:
| Slot | Env var | Default |
|---|---|---|
| Opus | CLAUDEX_OPUS |
gpt-5.6-sol |
| Sonnet | CLAUDEX_SONNET |
gpt-5.6-terra |
| Haiku | CLAUDEX_HAIKU |
gpt-5.4-mini |
Override in ~/.zshrc, e.g. export CLAUDEX_SONNET=gpt-5.6-luna. For anything
outside these three, use claudexp or CLAUDEX_MODEL=….
claudex ──env──▶ claude (Claude Code CLI)
│ ANTHROPIC_BASE_URL=http://127.0.0.1:8317
│ ANTHROPIC_AUTH_TOKEN=<local proxy token>
▼
CLIProxyAPI :8317 (Anthropic-compatible /v1/messages)
│ reuses your Codex OAuth token in ~/.cli-proxy-api
▼
OpenAI (gpt-5.6-*, …)
claudex only sets these in its own subshell — plain claude never sees them, so
it keeps talking to Anthropic directly.
The env flags it sets (matching Theo's recipe):
| Var | Effect |
|---|---|
--model <id> |
main session model |
CLAUDE_CODE_SUBAGENT_MODEL |
subagents use the same model |
CLAUDE_CODE_ALWAYS_ENABLE_EFFORT=1 |
enable effort controls |
CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY=3 |
cap concurrent tool calls |
ENABLE_TOOL_SEARCH=false |
disable dynamic tool search |
brew services restart cliproxyapi # after a config change
brew services stop cliproxyapi
brew services info cliproxyapi
curl -s localhost:8317/v1/models -H "Authorization: Bearer $CLAUDEX_PROXY_TOKEN" | jq .Config: $(brew --prefix)/etc/cliproxyapi.conf · OAuth tokens: ~/.cli-proxy-api/
Want the proxy to also serve Claude models (multi-account pooling, failover)?
cliproxyapi -claude-login. Not needed for the Claude↔GPT switching above.
./uninstall.sh # remove shell module + config, keep cliproxyapi & logins
./uninstall.sh --purge # also uninstall cliproxyapi and delete OAuth tokensRouting a ChatGPT/Codex subscription through a third-party proxy to power a different harness sits in a gray area of the provider's Terms of Service. It's your machine and your account; use accordingly. This repo is not affiliated with Anthropic or OpenAI.