Claude agent host harness ignores ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN (cc-switch and other Anthropic-compatible relays)
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
**Type: Feature Request** — request compatibility for custom Anthropic-compatible endpoints in the new built-in Claude harness.
## Background
VS Code 1.136 introduced the built-in **Claude harness** in the Agents window (agent host, AHP). According to the docs (Choose an Agent Harness → Setup and authentication), it supports exactly two authentication/billing paths:
1. GitHub Copilot subscription (Copilot-routed models)
2. Anthropic credentials: `ANTHROPIC_API_KEY` or `CLAUDE_CODE_OAUTH_TOKEN`
Many users run Claude Code on **Anthropic-compatible relays** — e.g. managed via `cc-switch`, which writes `ANTHROPIC_BASE_URL` + `ANTHROPIC_AUTH_TOKEN` into the `env` object of `~/.claude/settings.json`. The standalone Claude Code extension/CLI honors these, so this worked fine before 1.136 with no GitHub sign-in and no Anthropic account.
The release notes state that the Agent Host "reads user-level customizations from harness-agnostic folders like `~/.copilot` and `~/.claude`" — so honoring the same `env` variables would be expected parity.
## Actual behavior
With `ANTHROPIC_BASE_URL` / `ANTHROPIC_AUTH_TOKEN` configured in `~/.claude/settings.json` (verified working for the Claude Code extension):
- The built-in Claude harness in the Agents window does not use the relay.
- Enabling `chat.agentHost.allowSignedOutWhenUsable` still leads to sign-in prompts for a Copilot plan instead of using the configured relay.
- There is no documented setting or env passthrough for a custom base URL, so the only usable auth becomes GitHub sign-in.
## Expected behavior
The agent host's Claude harness passes through `ANTHROPIC_BASE_URL` (and `ANTHROPIC_AUTH_TOKEN`) from the process environment and from the `env` object in `~/.claude/settings.json`, exactly as the Claude Code CLI / Agent SDK does. This keeps feature parity for users who legitimately route to third-party or self-hosted Anthropic-compatible gateways, and makes the new Agents window usable without forcing GitHub/Anthropic accounts.
## Steps to reproduce
1. Configure a relay (e.g. via `cc-switch`) so `~/.claude/settings.json` contains:
```json
{ "env": { "ANTHROPIC_BASE_URL": "https://", "ANTHROPIC_AUTH_TOKEN": "" } }
```
2. Open VS Code 1.136.0, open the Agents window, select **Claude** as the session target.
3. Observe: requests go to `api.anthropic.com` (or sign-in/paywall prompts appear) instead of the configured relay.
## Related
- #328055 (agent host can't list models on custom endpoints with the same model id) — adjacent, but that issue is about model listing; this one is about the Claude harness honoring the base URL env at all.
- #333738 (Claude keychain login read as "not set up")
## Environment
- VS Code version: 1.136.0
- OS: Windows 11
- Claude Code standalone extension + cc-switch: works with the same config
Contributor guide
Assessment
This issue has not been assessed yet.