anthropics / anthropics/claude-code

[BUG] Subscription auth (Pro/Max) ignores ANTHROPIC_BASE_URL — requests never reach custom proxy (LiteLLM)

Offen
#91,746 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area:api area:auth area:networking bug platform:windows
Vorherrschende Sprache
Python
Sterne
145k
Forks
23.1k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

### Preflight Checklist

- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code

### What's Wrong?

Claude Code should route all requests through the configured ANTHROPIC_BASE_URL,
regardless of auth method — the same way it does when using an API key. With
subscription-based auth (Pro/Max), it should still respect this setting and send
requests to the custom proxy (LiteLLM in our case) instead of bypassing it entirely.

### What Should Happen?

Claude Code should route all requests through the configured ANTHROPIC_BASE_URL,
regardless of auth method. With subscription-based auth (Pro/Max), it should still
respect this setting and send requests to the custom proxy (LiteLLM in our case)
instead of bypassing it entirely.

### Error Messages/Logs

```shell
No error is thrown — Claude Code runs normally with no visible failure.
The issue is that no requests appear in LiteLLM's logs at all, confirming
Claude Code is not sending traffic to the configured ANTHROPIC_BASE_URL.

LiteLLM logs confirm the proxy itself is up and working correctly when
tested directly (e.g., via curl) — it simply never receives anything from
Claude Code.
```

### Steps to Reproduce

1. Set up a LiteLLM proxy locally/remotely and confirm it's running and reachable
(e.g., via a direct curl request to the proxy endpoint).

2. Configure Claude Code's `settings.json` with:
ANTHROPIC_BASE_URL=

3. Ensure Claude Code is authenticated via subscription (Pro/Max) — not an API key.

4. Run any normal Claude Code command/session (e.g., `claude "explain this file"`).

5. Check LiteLLM's logs.

Expected: The request should appear in LiteLLM's logs, since ANTHROPIC_BASE_URL
is configured to route traffic through it.

Actual: No request ever appears in LiteLLM's logs. Claude Code completes the
session normally, but traffic never reaches the proxy — as if ANTHROPIC_BASE_URL
is being ignored entirely when using subscription-based auth.

Note: We confirmed LiteLLM itself works correctly — testing it directly with
curl shows it responding as expected. The issue is isolated to Claude Code not
sending requests to it in the first place.

### Claude Model

Sonnet (default)

### Is this a regression?

I don't know

### Last Working Version

_No response_

### Claude Code Version

2.1.246

### Platform

Anthropic API

### Operating System

Windows

### Terminal/Shell

VS Code integrated terminal

### Additional Information

Relevant settings.json config (secrets redacted):

model_list:
- model_name: claude
litellm_params:
model: anthropic/claude-sonnet-4-5-20250929

general_settings:
forward_client_headers_to_llm_api: true

litellm_settings:
master_key: "sk-***REDACTED***"

LiteLLM proxy logs confirm it is running and reachable — a direct curl request
to the proxy returns a valid response. However, no request from Claude Code
ever appears in these logs during an active Claude Code session, even though
Claude Code itself functions normally (responds, completes tasks, etc.) —
suggesting it's silently falling back to the default Anthropic endpoint
instead of respecting ANTHROPIC_BASE_URL.

We suspect Claude Code may only respect ANTHROPIC_BASE_URL when using
API-key-based auth, and silently ignores it under subscription-based
(Pro/Max) auth — but we couldn't find this documented anywhere, hence
this report.

Happy to share more of our LiteLLM config or logs if useful for debugging.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start by tracing how settings.json supplies ANTHROPIC_BASE_URL and how subscription-based authentication selects the request endpoint. Reproduce with the LiteLLM proxy, verify the direct curl request and LiteLLM logs, then run a normal Claude Code session; done means the session's request appears in the proxy logs for Pro/Max authentication.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
api, authentication
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
55/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.