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

Resolved 💬 2 comments Opened Apr 15, 2026 by Maybe3141 Closed May 24, 2026

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_MODELis injected and used by internal tools (e.g. WebFetch)
  • ANTHROPIC_BASE_URLis 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

  1. 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"
}
``

  1. Log in via OAuth in the desktop app's Code feature
  2. 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)

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗