[BUG] Fast mode forcibly disabled when using ANTHROPIC_BASE_URL (custom API endpoint)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
When using ANTHROPIC_BASE_URL to route API traffic through a corporate middleware proxy (required by our organization's security policy), fast mode is forcibly disabled even though our Anthropic org has fast mode enabled.
Root Cause (from investigating the bundled source)
The fast mode availability check (claude_code_penguin_mode) is hardcoded to https://api.anthropic.com — it does not respect ANTHROPIC_BASE_URL:
// In the bundled CLI, the penguin mode check:
let q = `${o4().BASE_API_URL}/api/claude_code_penguin_mode`
// o4().BASE_API_URL always resolves to "https://api.anthropic.com" in production
// It does NOT use process.env.ANTHROPIC_BASE_URL
In our environment, API traffic must flow through a corporate proxy/middleware layer. Direct connections to api.anthropic.com from developer workstations are blocked by firewall rules. So:
- We set
ANTHROPIC_BASE_URLto our internal proxy endpoint — message API calls work fine - The penguin mode check ignores
ANTHROPIC_BASE_URL, tries to reachapi.anthropic.comdirectly, fails due to network policy - On failure, the code defaults to
{ status: "disabled" }— fast mode is force-disabled - The
/fasttoggle shows "Fast mode is not available" despite our org having it enabled
There's also a secondary issue: the tengu_marble_sandcastle GrowthBook feature flag defaults to true when GrowthBook can't be reached (same network issue), which gates fast mode to native binary installs only. Combined with CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 (commonly set in proxy environments), GrowthBook never loads real values and the restrictive defaults stick.
What Should Happen?
- The penguin mode check should respect
ANTHROPIC_BASE_URL— if set, use it as the base for/api/claude_code_penguin_modeinstead of the hardcodedapi.anthropic.com. The functionIDz()already exists in the codebase and correctly readsANTHROPIC_BASE_URL, but it's not used for this check.
- Failure should not force-disable fast mode — if the penguin mode endpoint is unreachable (network error, timeout, non-2xx), the current behavior defaults to
disabled. A better approach would be:
- Fall back to the persisted
penguinModeOrgEnabledconfig value - Or keep the status as
pending(which already passes the availability check) and retry later - Or at minimum, provide an env var override (e.g.,
CLAUDE_CODE_FORCE_FAST_MODE=1) to let admins/users who know their org supports it bypass the check
- GrowthBook feature flag defaults should be permissive when unreachable —
tengu_marble_sandcastledefaulting totrue(require native binary) when GrowthBook can't be reached is overly restrictive for proxy environments.
Steps to Reproduce
- Set
ANTHROPIC_BASE_URLto any non-api.anthropic.comendpoint (corporate proxy, middleware, etc.) - Ensure the workstation cannot directly reach
api.anthropic.com(or setCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1) - Start Claude Code
- Try
/fast— shows "Fast mode is not available" - Observe in verbose/debug logs: the penguin mode fetch goes to
api.anthropic.com(not the custom base URL), fails, and defaults to disabled
Claude Model
claude-opus-4-6
Is this a regression?
No — fast mode has always behaved this way with custom base URLs.
Claude Code Version
2.1.59
Platform
First-party API with ANTHROPIC_BASE_URL override (corporate proxy)
Operating System
Windows (also reproducible on Linux/macOS)
Terminal/Shell
Various (bash, PowerShell, etc.)
Additional Information
I understand the platform integration needs — verifying org-level fast mode entitlement makes sense. But the current implementation assumes direct connectivity to api.anthropic.com, which isn't always possible in enterprise environments that mandate traffic routing through approved middleware/proxies.
The Anthropic SDK itself correctly respects ANTHROPIC_BASE_URL for message API calls. It would be great if the ancillary checks (penguin mode, GrowthBook features) followed the same pattern, or at least degraded gracefully instead of force-disabling features.
Suggested minimal fix
In IOz(), change:
let q = `${o4().BASE_API_URL}/api/claude_code_penguin_mode`
to:
let q = `${process.env.ANTHROPIC_BASE_URL || o4().BASE_API_URL}/api/claude_code_penguin_mode`
And in the catch handler of YE1(), instead of:
n16 = { status: "disabled", reason: "preference" }
keep the status as pending or respect the persisted config, so fast mode isn't force-killed on transient/expected network failures.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗