Claude Code -> GoModel -> Anthropic
Before you start
- Install Claude Code on your machine.
- Choose a GoModel master key, for example
change-me. - Make sure GoModel has an Anthropic upstream credential.
Claude Code can be routed through GoModel whether or not you personally use a
Claude Code subscription. For gateway mode, Claude Code talks to GoModel with
ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN. GoModel still needs its own
ANTHROPIC_API_KEY to reach Anthropic upstream — either a Console API key
or a Claude subscription OAuth token.How to get ANTHROPIC_API_KEY
Option A — Console API key (pay-as-you-go):
- Open the Claude Console and sign in to your API account.
- Go to account settings in Console, then create an API key.
- Copy the key once and set it for GoModel as
ANTHROPIC_API_KEY.
- Run
claude setup-tokenon a machine where Claude Code is logged in to your subscription. - Copy the generated
sk-ant-oat01-...token and set it for GoModel asANTHROPIC_API_KEY.
sk-ant-oat prefix and authenticates upstream with the
OAuth Bearer scheme automatically. Usage is covered by your subscription’s
limits instead of API billing.
1. Run GoModel
Start GoModel with a master key and an Anthropic provider key:2. Confirm Anthropic passthrough
Check that the Anthropic passthrough models endpoint responds:ok.
3. Configure Claude Code to use GoModel
Point Claude Code at GoModel:/v1/messages with
native forwarding:
requests that resolve to Anthropic are relayed unchanged apart from model
alias resolution (preserving cache_control, thinking signatures, and beta
headers) while rate limits,
budgets, audit, and usage tracking apply — and model aliases or virtual models
can route Claude Code to other providers. Alternatively,
ANTHROPIC_BASE_URL=http://localhost:8080/p/anthropic uses raw passthrough
pinned to the Anthropic upstream.
Short Claude Code doc summary: for gateway mode, set ANTHROPIC_BASE_URL to
your gateway URL and ANTHROPIC_AUTH_TOKEN to your gateway token, then run
Claude Code normally. See the official guide:
Claude Code LLM gateway docs.
If GoModel is not running on your local machine, replace localhost:8080 with
the correct host and port.
4. Run a Claude Code test prompt
5. Check the traffic in GoModel
Open the GoModel dashboard audit logs: http://localhost:8080/admin/dashboard/audit This is the easiest place to confirm that Claude Code is reaching GoModel and to inspect the full request and response trail. From the same dashboard, you can keep following your GoModel traffic and usage.References
- Anthropic Claude Code gateway docs: LLM gateway
- Anthropic Claude Code settings: Settings
- Claude Help: Managing API key environment variables in Claude Code
- Claude Help: Paid Claude plans vs API Console billing
- Claude API docs: API overview (keys from Console account settings)
Validated on March 10, 2026
This guide was validated against:- a local GoModel instance on
http://localhost:8080 - a GoModel branch exposing
/p/{provider}/v1/... - Claude Code
2.1.72
GET /p/anthropic/v1/modelsreturned200 OKPOST /p/anthropic/v1/messagesreturned200 OKclaudereturnedokwhen pointed at GoModel