Claude Code
Claude Code reads two environment variables at startup — ANTHROPIC_BASE_URL
and ANTHROPIC_AUTH_TOKEN. Point them at UberLLM and everything else about the
client stays the same: same commands, same tools, same models. Only the billing
path changes.
The commands below are generated from
web/lib/claude-code.ts(INSTALL_ONELINER,INSTALL_ONELINER_PS,UNINSTALL_ONELINER) and the installer inweb/lib/install-script.ts. If those change, update this page to match — the docs are plain markdown and are not compiled against them.
Install
curl -fsSL https://uberllm.dev/install/claude-code.sh | sh
Windows PowerShell:
irm https://uberllm.dev/install/claude-code.ps1 | iex
You do not need an API key first, and you do not need to be signed in when you
paste the command. The installer opens a link in your browser
(https://uberllm.dev/cli/link?code=XXXX-XXXX) and prints the same confirmation
code in the terminal. Sign in, check the code matches, and press Approve.
Approving creates an API key named Claude Code on your account and hands it to the waiting installer. The code in your terminal is not the secret — only the installer that started the request can collect the key, the key is handed out exactly once, and the request expires after 15 minutes.
If you would rather not run a script, use the manual configuration below.
What the installer writes
Everything lands in ~/.claude/settings.json (%USERPROFILE%\.claude\settings.json
on Windows, or $CLAUDE_CONFIG_DIR/settings.json if you set that). That file is
the one place Claude Code reads before its first-run setup, which is why a
project-scoped settings file is not enough.
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.uberllm.dev",
"ANTHROPIC_AUTH_TOKEN": "ull_...",
"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1"
}
}
The installer merges into your existing file rather than replacing it, so hooks,
permissions and MCP servers are preserved, and it copies the old file to
settings.json.bak-<timestamp> before writing. It then makes one real request
through the gateway so a success message means the setup actually works.
Manual configuration
Prefer to do it by hand? Create or edit ~/.claude/settings.json with the block
above, using a key from your keys page.
Print the block without writing anything:
curl -fsSL https://uberllm.dev/install/claude-code.sh | sh -s -- --print
Environment variables work too, if you would rather not keep a key on disk:
export ANTHROPIC_BASE_URL=https://api.uberllm.dev
export ANTHROPIC_AUTH_TOKEN=ull_your_key
claude
One gotcha: if ANTHROPIC_API_KEY is exported in your shell, Claude Code warns
about conflicting credentials even though the settings file wins. Unset it.
Verify
Start Claude Code and run:
/status
You should see:
Anthropic base URL: https://api.uberllm.dev
Auth token: ANTHROPIC_AUTH_TOKEN
If it still shows an Anthropic login, the settings file was not picked up —
check that you edited the file Claude Code actually reads (~/.claude/settings.json,
or $CLAUDE_CONFIG_DIR/settings.json) and restart the client.
Independently, the same credentials answer over the Messages API:
curl https://api.uberllm.dev/v1/messages \
-H "Authorization: Bearer $UBERLLM_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"claude-haiku-4-5","max_tokens":16,"messages":[{"role":"user","content":"ping"}]}'
Pinning a different model
By default nothing is pinned: Claude Code keeps asking for its own model ids and
the gateway maps them onto the same Anthropic models, so the client behaves
exactly as it does against api.anthropic.com — routed through the market
instead of billed at list.
To drive Claude Code with a different model, set the model variables in the same
env block:
| Variable | What it controls |
|---|---|
ANTHROPIC_MODEL |
The main model for every request. |
ANTHROPIC_DEFAULT_OPUS_MODEL |
What the Opus slot resolves to. |
ANTHROPIC_DEFAULT_SONNET_MODEL |
What the Sonnet slot resolves to. |
ANTHROPIC_DEFAULT_HAIKU_MODEL |
The small/fast slot — used for titles, summaries and other background calls. |
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.uberllm.dev",
"ANTHROPIC_AUTH_TOKEN": "ull_...",
"ANTHROPIC_MODEL": "z-ai/glm-5.2",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "z-ai/glm-4.7-flash"
}
}
Pin the small slot as well as the main one — background calls are frequent, and
leaving ANTHROPIC_DEFAULT_HAIKU_MODEL unset means they keep going to Claude
Haiku.
The installer can do this for you with a profile:
curl -fsSL 'https://uberllm.dev/install/claude-code.sh?profile=glm' | sh
Available profiles are claude-native (the default, pins nothing), glm,
deepseek and gpt. Any model id from
the catalog works if you set the variables by
hand; GET https://api.uberllm.dev/v1/models lists them.
Uninstall and revoke
Remove the settings the installer wrote:
curl -fsSL https://uberllm.dev/install/claude-code.sh | sh -s -- --uninstall
It backs up settings.json first, removes only the variables it manages, and
leaves the rest of your configuration untouched. Claude Code goes back to your
Anthropic login on the next start.
Uninstalling does not revoke the key — it only stops using it. Delete the key named Claude Code on your keys page to make sure it can never spend again. Do that for any device you no longer trust, or if you approved a request you did not start.