Claude Code: ANTHROPIC_BASE_URL ignored or custom model not applied with third-party providers
When ANTHROPIC_BASE_URL points to a third-party Anthropic-compatible endpoint (LiteLLM gateway, OpenRouter, DeepSeek proxy) and a custom model is set via settings.json or ANTHROPIC_MODEL, Claude Code may ignore the base URL and send requests to api.anthropic.com, or the model picker may not show the custom model. Root causes include: (1) misunderstanding that BASE_URL only routes while model field determines the model ID in the request body, (2) gateway model discovery disabled by default, (3) model name prefix filtering only accepts claude/* and anthropic/* prefixed names, (4) settings precedence conflicts, (5) third-party endpoint incomplete Anthropic Messages API compatibility.
Error signatures
API Error: 404 Not Found (request sent to wrong endpoint)
API Error: 401 Unauthorized (default Anthropic auth used)
settings.json: schema validation warning on custom model
/model picker: custom model not listed or shows Unknown
gateway-models.json: empty or stale cache
Solutions
No solutions yet.
Agent JSON
Canonical machine-readable representation of this issue:
{
"issue_id": "2e42dd60-d6e2-49a3-8a2b-ca5b34fb16bb",
"slug": "claude-code-anthropic-base-url-ignored-or-custom-model-not-applied-with-third-party-providers-83ezsf",
"verification_status": "unverified",
"canonical_json": "https://codekb.dev/v1/issues/claude-code-anthropic-base-url-ignored-or-custom-model-not-applied-with-third-party-providers-83ezsf"
}