Claude Code
~/.claude/settings.jsonthat redirect Claude Code's Anthropic Messages traffic to Prism. Each of Claude Code's four tiers — opus, sonnet, haiku and subagent — can be mapped to a different upstream model.Last updated Reviewed against Prism v0.3.26
One-click setup
Open the Agents tab
Agents. Claude Code appears in the detected list when ~/.claude/settings.json or ~/.claude/settings.local.json exists.Click Setup
~/.claude/settings.json.prism-backup, then writes the managed env keys.Choose a model per tier
Restart Claude Code
ANTHROPIC_BASE_URL at startup, so a restart is required for the change to take effect.What Prism writes
{
"env": {
"ANTHROPIC_BASE_URL": "http://127.0.0.1:11434",
"ANTHROPIC_AUTH_TOKEN": "prism",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.1:cloud",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-flash:cloud",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-flash:cloud",
"CLAUDE_CODE_SUBAGENT_MODEL": "deepseek-v4-flash:cloud"
}
}Nothing else in the file is touched. On disable, only these six keys are removed and your own env entries are left alone.
The four tiers
| Environment variable | Controls |
|---|---|
| ANTHROPIC_DEFAULT_OPUS_MODEL | The main thread — the most capable work. |
| ANTHROPIC_DEFAULT_SONNET_MODEL | The balanced default. |
| ANTHROPIC_DEFAULT_HAIKU_MODEL | Fast background completions. |
| CLAUDE_CODE_SUBAGENT_MODEL | Sub-agents that Claude Code spawns for parallel work. |
Pointing haiku and subagent at a cheaper model is the single biggest cost lever in a Claude Code setup, because background tasks usually dominate request count. See Model Remapping.
~/.claude/settings.jsonon its own, which can drop Prism's keys. Prism re-writes them on every startup, so a lost key recovers as soon as Prism restarts. If Claude Code suddenly talks to Anthropic directly again, restart Prism or click re-sync in the Agents tab.Manual setup
If you prefer to edit the file yourself, add the same six keys under env. The base URL is the proxy root with no path — Claude Code appends /v1/messages itself.
{
"env": {
"ANTHROPIC_BASE_URL": "http://127.0.0.1:11434",
"ANTHROPIC_AUTH_TOKEN": "prism"
}
}ANTHROPIC_AUTH_TOKEN. Leaving ANTHROPIC_API_KEY set makes Claude Code send an x-api-key header as well, which Prism also accepts but which can mask a misconfigured auth token.Add MCP servers
Claude Code keeps user-scope MCP servers in ~/.claude.json under mcpServers. Prism can write a single gateway entry there so Claude Code gets every server you allowed, with its own OAuth brokering handled by Prism. See MCP Gateway.
Verify
| Check | Expected |
|---|---|
| Claude Code starts without an auth error | Prism is answering on :11434. |
| A prompt returns a model name from your catalog | Per-tier mapping is in effect. |
| The request appears in the Stats tab | Client should show as Claude Code. |
Related
Model Remapping
Aliases and per-tier model selection.
MCP Gateway
Give Claude Code every MCP server at once.
Agent Integrations
Detection, backups and auto-sync for every supported agent.
Provider Setup
The upstreams these requests route to.
Troubleshooting
Auth errors and settings being overwritten.
Guide: Claude Code on any provider
The full walkthrough, including the environment variables and tiers.
Guide: MCP servers in Claude Code
One gateway entry instead of one entry per server.