Fix Claude Code "Unable to connect" / fetch failed / ECONNRESET
Troubleshoot terminal proxy mismatches, TLS timeouts, and ECONNRESET drops in Claude Code CLI with a clean custom gateway setup.
Root Causes
Common Triggers
- Browser proxy is active but terminal shell lacks proxy env vars
- Unstable TUN/VPN routing drops long-running streaming SSE connections mid-response
- Stale base URL or expired OAuth token cached in ~/.claude/settings.json
Long-Term Stability Path
Direct native routing to https://vip.brioi.com keeps long streaming coding sessions stable.
Step-by-Step Fix
- Step 1 · Audit terminal environment variablesRun env | grep -iE "anthropic|proxy" to clear conflicting proxy or stale base URLs.
- Step 2 · Route directly via Brioi native endpointPoint ANTHROPIC_BASE_URL to https://vip.brioi.com to eliminate flaky proxy hops during long streaming tool calls.
- Step 3 · Persist settings in ~/.claude/settings.jsonStore env keys cleanly so every new terminal session connects reliably.
Working Reference Snippet
// ~/.claude/settings.json
{
"env": {
"ANTHROPIC_BASE_URL": "https://vip.brioi.com",
"ANTHROPIC_API_KEY": "sk-your-brioi-key"
}
}FAQ
Do I still need to log in with a personal Claude account?
No—API key mode bypasses OAuth login loops and personal account limits.
More Troubleshooting Guides
Diagnose whether your OpenAI HTTP 429 is caused by exhausted credits or RPM/TPM throttling, with backoff code and multi-route failover options.
Resolve Anthropic 403 region blocks and proxy-triggered account suspensions when running Claude API or Claude Code.
Why Claude prompt caching returns 0 cached tokens—check prefix instability, 5-minute TTL expiry, protocol conversion, and route quality.
Resolve Google AI Studio free-tier RPM caps and regional Vertex AI exhaustion causing 429 RESOURCE_EXHAUSTED errors.

