Switch Claude Code's backend per terminal — one command, no global config.
README
cs)Switch Claude Code's backend per terminal — one command, no global config.
Install · Quick start · Commands · 中文
</div>Switch Claude Code between Claude.ai (OAuth) and third-party API providers per
terminal, with one command. Each terminal window is independent, so you can run
one provider in a shell and another in the next. Native settings.json can't do
this; it's global.
The PATH binary is claude-switch; you drive it through the cs shell function
the installer adds. The function exists because env injection has to happen
inside your shell, not a child process.
Claude Code picks its backend from environment variables:
ANTHROPIC_AUTH_TOKEN set → API-key mode (uses ANTHROPIC_BASE_URL)ANTHROPIC_AUTH_TOKEN unset → OAuth mode (~/.claude/.credentials.json)cs use <provider> injects a provider's env into the current shell; cs use claude clears it and falls back to OAuth. Switching only affects newly
started claude instances in that terminal.
settings.jsoncs use claude falls back to your Claude.ai OAuth login0600 config file and never show up in cs list or cs statusbrew install gogit clone https://github.com/hleidev/claude-switch.git
cd claude-switch
make install # builds, installs to ~/.local/bin, wires up your rc file
exec $SHELL # or open a new terminal