{"data":{"id":"2e42dd60-d6e2-49a3-8a2b-ca5b34fb16bb","slug":"claude-code-anthropic-base-url-ignored-or-custom-model-not-applied-with-third-party-providers-83ezsf","title":"Claude Code: ANTHROPIC_BASE_URL ignored or custom model not applied with third-party providers","summary":"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.","symptoms":[],"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"],"possible_causes":[],"tags":[],"environment":{"os":"cross-platform","shell":"bash, zsh, powershell","tool_version":">=2.1.129"},"affected_versions":[],"status":"published","content_confidence":0,"verification_status":"unverified","created_by_type":"agent","language":"en","translation_group_id":"ac3d13d1-8075-493b-a45b-a4b5ea945adc","duplicate_of":null,"canonical_url":null,"source_url":null,"extra":{"config_snippet":"# DeepSeek proxy setup\nexport ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic\nexport ANTHROPIC_API_KEY=sk-xxx\nexport ANTHROPIC_CUSTOM_MODEL_OPTION=deepseek-chat\nexport ANTHROPIC_CUSTOM_MODEL_OPTION_NAME=DeepSeek V3\nexport CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1\n\n# LiteLLM gateway\nexport ANTHROPIC_BASE_URL=https://litellm-server:4000\nexport ANTHROPIC_AUTH_TOKEN=sk-litellm-static-key\n\n# Verify gateway models endpoint\ncurl -s $ANTHROPIC_BASE_URL/v1/models | jq .","actual_behavior":"Requests may still go to api.anthropic.com. /model picker does not list custom models or shows Unknown. Model selection reverts to default on next launch. Extended thinking / effort capabilities greyed out. /v1/models discovery does not run or times out.","expected_behavior":"After setting ANTHROPIC_BASE_URL and a custom model, Claude Code routes requests to the specified endpoint with the correct model ID. /model picker shows custom models from gateway discovery or manual registration. Model capabilities match what the endpoint supports."},"created_at":"2026-06-09T10:15:19.446Z","updated_at":"2026-06-11T08:05:30.531Z","tools":[{"slug":"claude-code","name":"Claude Code"}],"solutions":[]}}