Skip to content

victorv2i/claudex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

claudex

Run Claude Code on GPT-5.6 (Sol) through your existing Codex subscription, with effort switching in the /model picker. Your normal claude setup stays untouched.

Select model
  1. Default (recommended)  Use the default model (currently gpt-5.6-sol[1m])
❯ 2. gpt-5.6-sol ✔          Custom Opus model
  3. gpt-5.6-sol            Custom Sonnet model
  4. gpt-5.6-luna           Custom Haiku model

● High effort (default) ←/→ to adjust

This packages the setup shared by @thsottiaux (Codex lead at OpenAI) and @theo, plus the fix for the part that silently breaks if you are logged into a Claude subscription.

The gotcha this fixes

If you are logged into Claude Code with a Pro/Max subscription, the recipe from the tweets returns 401 Invalid API key on every request. Claude Code (verified on 2.1.207) sends its own stored OAuth bearer token and ignores ANTHROPIC_AUTH_TOKEN and ANTHROPIC_API_KEY entirely. A header capture against a local listener shows it plainly:

{"/v1/messages?beta=true": {"authorization": "Bearer sk-ant-[redacted]"}}   <- its OAuth token
                                                                               not your proxy key

The fix is to give claudex its own CLAUDE_CONFIG_DIR. With no stored OAuth credentials in that profile, ANTHROPIC_AUTH_TOKEN is used, and your logged-in claude keeps working normally next to it.

Side effect worth knowing: the claudex profile does not load your global ~/.claude/CLAUDE.md, settings, or history. First run asks you to trust the folder once.

Install

git clone https://github.com/victorv2i/claudex
cd claudex
./install.sh

Then open a new shell and run claudex.

Or skip all of that: paste this repo's URL into Claude Code and say "set this up". The README and scripts have everything it needs.

The installer:

  • downloads the latest CLIProxyAPI release to ~/.local/opt/cliproxyapi
  • writes a loopback-only config (127.0.0.1:8317) with a generated API key
  • installs and starts a cliproxyapi systemd user service
  • reuses your existing codex login credentials (see below), or tells you how to log in
  • installs the claudex shell function

Everything is local. Nothing listens beyond loopback and no telemetry is added.

No second OAuth login

If you already use the Codex CLI, ~/.codex/auth.json holds OAuth tokens for the same client id CLIProxyAPI uses. convert-codex-auth.py rewrites them into CLIProxyAPI's auth file format, refresh token included, so the proxy works immediately without another browser dance. The installer does this automatically.

Effort switching

CLAUDE_CODE_ALWAYS_ENABLE_EFFORT=1 enables Claude Code's effort selector for non-Anthropic models. It shows up in /model (arrow keys to adjust) and the proxy translates the thinking budget into OpenAI's reasoning.effort. The model slots map Opus and Sonnet to gpt-5.6-sol and Haiku to gpt-5.6-luna so background calls stay cheap.

Sessions that survive disconnects

If you drive this box over SSH:

tmux new -A -s claudex
claudex

Detach with ctrl-b d, reattach from any device with the same command.

Uninstall

systemctl --user disable --now cliproxyapi
rm -rf ~/.local/opt/cliproxyapi ~/.config/cliproxyapi ~/.cli-proxy-api \
       ~/.config/systemd/user/cliproxyapi.service ~/.claude-claudex \
       ~/.bashrc.d/claudex.sh ~/.claudex.sh
systemctl --user daemon-reload

If the installer told you to add source ~/.claudex.sh to your shell rc, remove that line too.

Notes

  • This routes your Codex subscription through a local third-party proxy. That is a gray zone in OpenAI's terms; the Codex lead's take was "if this gets blocked, I owe you a reset". Use your own judgment.
  • Claude Code's auth precedence around ANTHROPIC_AUTH_TOKEN has changed between versions and platforms (#34826 documents the opposite behavior). The separate-config-dir approach sidesteps precedence entirely, which is why claudex uses it.
  • Tested on Linux with Claude Code 2.1.207 and CLIProxyAPI 7.2.71. The installer refuses macOS for now since the service step needs systemd; the pieces would work under launchd if someone wants to port it (PRs welcome).

License

MIT

About

Run Claude Code on GPT-5.6 through your Codex subscription, with effort switching. Fixes the silent 401 when you're logged into Claude Max.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages