Browser Works, Terminal Fails? Fix Claude Code, Codex & Antigravity Proxy & Connectivity
Terminal & Routing Last updated:
Summary
When sites load in your browser but CLI tools fail, your terminal is usually bypassing a system/PAC proxy, or the exit itself hits a region block, IP restriction, or TLS cert error. Switch to +AI Connectivity on Split Routing Test to inspect local routing and all 6 AI endpoints together.
Why Your Browser Works While CLI Tools or AI APIs Fail
Desktop proxy apps usually enable a system HTTP/SOCKS proxy or PAC auto-config by default. Browsers follow those settings automatically, while terminal processes — curl, git, Node.js, Python, Claude Code, Codex, and Antigravity CLI — typically ignore system proxies and PAC unless explicitly configured or captured via TUN.
Three patterns cover most failures:
| Symptom | Common Cause | Immediate Effect |
|---|---|---|
| Browser uses proxy; terminal is direct | Only System Proxy or PAC is on; TUN is off and HTTPS_PROXY is unset | Timeouts, connection errors, or region blocks in CLI |
| Both use a proxy, but different countries | Browser follows domain rules while terminal hits fallback, or TUN + System Proxy overlap | Web app and CLI appear from different regions |
| Same exit, yet specific AI tools/APIs fail | Exit region is unsupported, IP is challenged at the edge, or proxy HTTPS decryption breaks TLS | Some AI endpoints work while others fail on the same node |
Step 1: Check Exits, Local Routing & +AI Connectivity Together
1. Side-by-Side Comparison + AI Connectivity
- Open the Split Routing Test (or DetectRadar Home for exit IP only) and click Compare Terminal to generate a 5-minute pairing code.
- When troubleshooting AI tools or APIs, switch the popover to
+AI Connectivity(you can inspect the read-only script source first) and run it in the affected terminal:
# Exit IP and estimated MTU comparison only
curl -s https://detectradar.com/c/<code-from-page>
# Split Routing "+AI Connectivity" (macOS / Linux; Windows popover provides probe.ps1)
curl -fsSL https://detectradar.com/c/probe.sh | sh -s -- <code-from-page>
Results render directly inside the >_ Terminal branch of the split-routing fork diagram: exit IP, local route tags (such as TUN · Fake-IP, Proxy :7890, or CLI direct), and 6 native TLS probes (AI Tools: Claude Code, Codex, Antigravity; AI APIs: Claude, GPT, Gemini). The script is read-only and never transmits proxy credentials or API keys.
2. Read the AI Connectivity Statuses
| Status | Meaning | Next Step |
|---|---|---|
| Reachable (with latency) | Service endpoint responded normally (network & region reachability only; web apps may still show captchas or account checks) | Network path is healthy; check API key or account status if errors persist |
| Unsupported | Provider rejected the current exit region | Switch to a supported region (note: Codex auth vs. OpenAI API and Antigravity vs. Gemini API are separate endpoints and can diverge) |
| Restricted | Exit IP triggered edge risk filtering or security challenges | Switch to a cleaner node and re-test |
| TLS error | TLS / certificate handshake failed | Check proxy HTTPS decryption / MITM certificate settings |
| Timeout / Unreachable | Could not reach the service or local proxy port | Verify your proxy is running, check port numbers, or enable TUN / export proxy env vars below |
3. Direct Terminal & Dual-Stack Check
# Default exit, ASN, human traffic ratio, and blocklist check
curl -s https://detectradar.com/en/
# Separate IPv4-only and IPv6-only probes (JSON format: /en/card/#api)
curl -s "https://4.detectradar.com/?lang=en"
curl -s "https://6.detectradar.com/?lang=en"
If 4.detectradar.com shows your proxy exit while 6.detectradar.com shows your local ISP, your terminal IPv6 is bypassing the tunnel — confirm on the IPv6 Leak Test.
Step 2: Fix the Mismatch
Case 1: Terminal Connects Direct
Check whether your current shell exports proxy variables:
# macOS / Linux
env | grep -iE '^(http|https|all|no)_proxy='
# Windows PowerShell (use curl.exe instead of the curl alias)
Get-ChildItem Env: | Where-Object Name -match 'proxy'
If empty, apply either option:
- Enable TUN / Enhanced Mode in your proxy client: Turning on TUN in Clash Verge / Mihomo, Surge, Stash, or v2rayN captures OS-level process traffic without per-CLI env vars.
- Export proxy variables in your shell (adjust the port to your client’s mixed port, e.g.
7890,7897, or6152):
# macOS / Linux
export HTTP_PROXY="http://127.0.0.1:7890"
export HTTPS_PROXY="http://127.0.0.1:7890"
export ALL_PROXY="socks5h://127.0.0.1:7890"
# Windows PowerShell
$env:HTTP_PROXY="http://127.0.0.1:7890"
$env:HTTPS_PROXY="http://127.0.0.1:7890"
Prefer socks5h:// over socks5:// so DNS lookups also run through the proxy. If you customize NO_PROXY, keep localhost,127.0.0.1 so local dev servers are not proxied.
Case 2: Different Exit Countries or Overlapping TUN + System Proxy
Run the Split Routing Test to compare all 35 browser targets against your >_ Terminal exit and AI probes in one fork diagram:
- Check whether your rule set pins AI domains to a dedicated group while terminal env vars fall through to the default node.
- If both TUN and System Proxy are enabled simultaneously, browsers and terminal apps may route through different exits; disable redundant System Proxy when running TUN.
- If only PAC auto-config is enabled, most CLI tools ignore PAC files — enable TUN or export
HTTPS_PROXYexplicitly. - Some Node.js CLIs handle
HTTP_PROXY/HTTPS_PROXYmore reliably thanALL_PROXY=socks5://...; set both HTTP/HTTPS variables to your mixed port.
Case 3: Quick macOS Checks or AI Agent Self-Check
- macOS menu bar quick check: On macOS, DetectRadar for macOS (
DetectRadarBar) displays your live local routing mode (TUN,PAC,System Proxy, orDirect) and includes an on-demand AI Connectivity check for Claude, OpenAI, and Gemini (explicitly labeling partial reachability such asAPI only,Codex only, orAntigravity only; press⌘Rto refresh exit and AI probes concurrently). - AI agent self-check: Share SKILL.md with Antigravity CLI, Claude Code, or Codex to automate redacted env checks, dual-stack probes, authoritative DNS checks, and native TLS AI endpoint checks (with optional
/c/<code>web sync); for script integrations, see the Open Read-Only API.
Step 3: Verify
Re-run curl -s https://detectradar.com/en/ or Split Routing +AI Connectivity. Matching exits and Reachable statuses confirm your local proxy routing and node-level connectivity are clear (web captchas and account-level checks remain independent on each provider’s platform).