ANTHROPIC_DEFAULT_*_MODEL env vars from settings.json injected in OAuth mode but BASE_URL is not, causing tool failures with third-party API model names
Summary
When using Claude Code via the desktop app (OAuth authentication), environment variables from ~/.claude/settings.json's env field are partially respected in an inconsistent way:
ANTHROPIC_DEFAULT_HAIKU_MODEL→ is injected and used by internal tools (e.g. WebFetch)ANTHROPIC_BASE_URL→ is not used (overridden by OAuth routing)
This causes tools like WebFetch/WebSearch to fail when the user has configured third-party API model names that are only valid on their custom BASE_URL.
Steps to Reproduce
- Set in
~/.claude/settings.json:
``json``
"env": {
"ANTHROPIC_BASE_URL": "https://third-party-api.example.com",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5-20251001-custom"
}
- Log in via OAuth in the desktop app's Code feature
- Use WebFetch or WebSearch tool
Expected Behavior
Either:
- OAuth mode ignores ALL env vars that depend on BASE_URL (including model name overrides), OR
- OAuth mode respects BASE_URL and routes tool sub-calls accordingly
Actual Behavior
WebFetch reads ANTHROPIC_DEFAULT_HAIKU_MODEL = claude-haiku-4-5-20251001-custom but routes to Anthropic's official API (via OAuth), which doesn't recognize the third-party model name:
There's an issue with the selected model (claude-haiku-4-5-20251001-custom)
Environment
- Claude Code version: 2.1.109
- Platform: Windows 11
- Auth mode: OAuth (desktop app)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗