Use Claude Code with Mubit
Claude Code reads its base URL and its key from environment variables. Point both at Mubit, and Claude Code's calls go through Mubit with your Mubit key.
A Claude Pro or Max sign-in can't be used: Mubit refuses sign-in tokens with a 401. The settings below make Claude Code send your Mubit key instead.
1. Set up in the console
Open the Mubit console at app.mubit.ai and sign in. If you can't add or create keys, ask an admin of your organization.
- Open Provider keys and add your Anthropic API key, as Provider keys shows. Claude Code's calls run on your own Anthropic key. The starter credit doesn't cover Claude Code, because it refuses some of its features, such as web search.
- Open Connect, go to Mubit key, and select Create key. Copy the key: it starts with
mbt_, and it's shown only once.
2. Set up your computer
On macOS or Linux, add these lines to ~/.zshrc, or to ~/.bashrc if you use bash. Then open a new terminal.
export MUBIT_API_KEY='YOUR_MUBIT_KEY'
export ANTHROPIC_BASE_URL=https://api.mubit.ai/anthropic
export ANTHROPIC_AUTH_TOKEN="$MUBIT_API_KEY"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5MUBIT_API_KEYholds your Mubit key.ANTHROPIC_BASE_URLis Mubit's Anthropic base URL. Use the base URL your console's Connect page shows. Leave/v1off the end: Claude Code adds it.ANTHROPIC_AUTH_TOKENholds your Mubit key. Claude Code sends it in theAuthorization: Bearerheader.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1turns off Claude Code's telemetry, error reports and automatic updates.ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5makes Claude Code's small background tasks use Haiku 4.5. Without it, withANTHROPIC_AUTH_TOKENset, they use your main model.
Use ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY. With ANTHROPIC_API_KEY, Claude Code sends the key in a background check to api.anthropic.com.
If ANTHROPIC_API_KEY holds anything but your Mubit key, Claude Code sends it beside your key, and Mubit refuses the call with a 401. Run unset ANTHROPIC_API_KEY, and don't set it in ~/.zshrc or ~/.bashrc. If your Claude Code settings file sets it under env, remove it there too.
Keep the key in the Keychain (macOS)
To keep the key out of ~/.zshrc, store it in the Keychain and read it from there.
Store the key. With -w last, the command asks for the key, so the key never sits on a command line or in your shell history:
security add-generic-password -a "$USER" -s mubit-api-key -wThen, in ~/.zshrc, replace the MUBIT_API_KEY line with this one:
export MUBIT_API_KEY=$(security find-generic-password -s mubit-api-key -w)3. Check it works
In a new terminal, run:
claude -p "Reply with exactly: pong"It prints pong. The call then shows in the console under your project's Requests. After that, run claude as usual.
Choose a model
Start Claude Code with claude --model claude-opus-5-5, or choose a model with /model inside it. Mubit passes the model ID on unchanged.
Tested with Claude Code 2.1.306.
If a call fails
The error names its code. Troubleshooting lists the codes and what to do.