Why Claude Code in the Terminal Is Not the Claude Tab
A browser tab gives you a shared cookie jar, DevTools, and a relatively uniform notion of “the internet” for that browsing profile. Claude Code is smaller on screen but routes traffic through more shapes: it may spawn Chromium for device or workspace OAuth, then return to long-lived TLS sessions toward api.anthropic.com or related inference endpoints your build selects. Update channels, usage telemetry, entitlement checks, and static bundles often ride edge and CDN namespaces that are easy to dismiss until a manifest download becomes the gate for the next wizard step.
Clash evaluates every outbound connection independently. That is the feature—until your YAML expresses three different opinions about “Anthropic.” One stanza sends obvious AI hostnames to a glossy group, another leaves a parent anthropic.com line on DIRECT from an old experiment, and a third-party list reroutes a static suffix somewhere unintended. The CLI does not narrate the disagreement; it retries with exponential backoff and eventually emits an API timeout string that sends engineers toward the wrong dashboard—keys, quotas, or model names they never actually exhausted.
The structural fix is to give the entire session one coherent outbound narrative. Habits from Clash rule routing best practices still matter: keep narrow vendor lines above lazy catch-alls, and treat every remote rule-provider refresh like a config change that can reorder reality while you sleep.
If you already stabilized Claude in the browser, reuse that vocabulary rather than inventing a parallel list from memory. Our Anthropic web and API split routing article explains how those namespaces stitch together for interactive clients; Claude Code should ride the same policy group names where policy permits, with extra attention to anything the terminal binary touches that the tab never needed.
Typical Failure Modes: OAuth, APIs, and CDNs Out of Sync
Support threads cluster into a few archetypes that deserve names. First, OAuth appears to finish in the browser, but Claude Code never persists a token because a follow-up call to an account or console hostname exited through a different path than the tab that just authenticated. Second, credentials look healthy yet model calls stall: api.anthropic.com rides a lossy hop while claude.ai felt fast in isolation, so your mental model of “logged in” disagrees with the transport story the agent sees. Third, small static downloads lag because an asset hostname resolves to a geography that fights the session implied by your proxy node; the tool looks hung until a client-side deadline wins and you inherit a generic, useless error string.
More common and more frustrating: the developer exports HTTPS_PROXY and assumes every subprocess respects it—yet a helper pins its own TLS stack, shells out to a child that resets the environment, or probes HTTP/3 where your local forwarder assumptions fray. Clash then looks idle in the UI even though “the shell has a proxy,” because the stalled PID never consulted the variable. Alternatively, TUN appears enabled, but OS encrypted DNS, a corporate PAC file, or VPN split-horizon still steers Anthropic namespaces unexpectedly, so the same binary traverses two networks without announcing the fact on stdout.
When someone says “Claude Code is down,” insist on which leg failed first. The user-facing string rarely labels DNS drift, asymmetric exits, or idle middleboxes honestly; your job is to translate symptoms into hostnames, policies, and timestamps.
Hostnames You Should Expect on the Wire
You do not need photographic memory for every subdomain; you need repeatable capture discipline. Consumer and team surfaces frequently hit claude.ai. Account, console, documentation, and corporate pages often live under anthropic.com and siblings. Programmatic traffic routinely lands on api.anthropic.com and adjacent API families your SDK chooses as defaults or regions evolve. Static payloads—JavaScript chunks, configuration blobs, keyboard telemetry batches—may appear on CDN-style subdomains or third-party edges that still read as “Anthropic-shaped” in your logs.
Experiments and staged rollouts add short-lived names. Capture them precisely while reproducing failures, add a temporary DOMAIN line with a dated comment, and promote wider suffix coverage only after you see the name repeatedly across versions and machines. If you run multi-vendor stacks, OpenCode CLI routing shows how to layer provider families without letting a lazy MATCH swallow half your session.
When in doubt, bias toward conservative coverage for the login window: nothing is more expensive than a beautiful, minimal YAML file that fails the moment marketing ships a new asset hostname.
Terminal Processes, HTTP Clients, and Proxy Environment Variables
Many teams export something like export HTTPS_PROXY=http://127.0.0.1:7890 before launching coding agents—the port is illustrative, not canonical. That pattern works when every code path honors the variable. It fails when Rust, Go, or Node helpers consult their own HTTP stacks, strip the environment in a subprocess, or negotiate HTTP/3 in ways your local forward assumptions do not mirror. When that happens, Clash stays quiet because the stuck connection never touched your mixed port, even though your interactive session “knows” about a proxy.
Document the quartet you set: HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, and especially NO_PROXY exclusions for loopback, RFC1918 space, and corporate exceptions. Pair exports with live connection tables so you can prove whether the Claude Code PID opened a tunnel through your listener. If you want system-wide enforcement, TUN captures traffic environment variables miss—at the cost of extension prompts on macOS and Windows. Read Clash on macOS: TUN versus system proxy for stacking guidance and the TUN deep dive for trade-offs that transcend any single GUI wrapper.
Containers repeat the lesson with a different accent: bridge networks, host-gateway forwarding, and guest DNS rewrite the story again. When Claude Code runs inside Docker or a remote devcontainer, revisit Clash with Docker and CLI mixed ports so host forwarding and in-container exports describe one path instead of three competing fables.
OAuth Callbacks, Loopback, and Accidental Proxy Loops
Browser-based OAuth for a terminal product almost always ends with a loopback callback on http://127.0.0.1:… Your proxy must not “assist” that listener. Classic foot-guns include routing loopback through a distant exit, rewriting localhost inside an aggressive filter list, or chaining another debugging MITM without noticing recursion. If Claude Code opens a local port for token exchange, keep that path short: exclude loopback from upstream chains during the login window and pause unknown interceptors until you have a token on disk.
When screenshots show “OAuth stuck,” compare timestamps. If the browser finished before the shell errored, hunt token exchange hostnames next. If the browser itself cannot load login assets, broaden CDN coverage first—you may be staring at a static asset timeout disguised as an authentication failure that wastes hours of team time.
CDN Footprint Even When You “Only” Run a Binary
Operators like to insist this is not a website, therefore static edges “should not matter.” Modern CLI distributions still download bootstrap fragments, crash breadcrumbs, entitlement manifests, or telemetry batches over the same infrastructure that feeds the marketing site. Individual requests are small but often blocking: until a JSON blob arrives, the client may refuse to advance even if api.anthropic.com answers a hand-crafted curl from the same machine moments earlier.
Treat static suffix families as first-class participants in your split routing plan until logs prove you can narrow them safely. The debugging loop is deliberately conservative: widen coverage, confirm the timeout disappears, trim with packet evidence—not the reverse ordering that burns weekends and erodes trust in internal runbooks.
One Policy Group for Coherent Anthropic Legs
Name a dedicated group—CLAUDE_CODE_CLI or reuse ANTHROPIC_API if you already standardize that label—and route the namespaces that participate in a single Claude Code session together through that group. The goal is coherence, not indiscriminate proxying. Domestic direct lines, LAN bypass entries, and corporate VPN prefixes should still precede vendor catches so you never hairpin RFC1918 traffic out an unintended public exit you will explain to security later.
Ordering is the quiet killer nobody applauds until 3 a.m.: an eager GEOIP line that swallows narrowly written suffix entries is behaviorally identical to “Anthropic broke.” After geography hygiene and local exceptions, place explicit DOMAIN-SUFFIX coverage for authentication, API, and static families you rely on, then fall through to your default MATCH. If you are choosing a client build, read choosing the right Clash client with logging clarity in mind—terminal agents fail in ways that reward readable telemetry, not glossy gradients.
Illustrative DOMAIN-SUFFIX Baseline
The fragment below is illustrative. Subscriptions duplicate suffixes; regional policy may demand tighter lists; compliance may forbid specific exits entirely. Diff it against your live profile instead of blind pasting from a blog into production at Friday 17:55 local time.
Illustrative rules fragment
rules:
- DOMAIN-SUFFIX,anthropic.com,CLAUDE_CODE_CLI
- DOMAIN-SUFFIX,claude.ai,CLAUDE_CODE_CLI
- GEOIP,CN,DIRECT
- MATCH,DIRECT
Notice the intent: console and account surfaces under anthropic.com, interactive claude.ai legs, and programmatic api.anthropic.com traffic ride together because the suffix already covers api. beneath the parent domain. When lawful captures reveal one-off experiment hosts or third-party edges your org actually depends on, add temporary DOMAIN lines, cite the build you saw, and promote only after repetition across teammates.
Resist spraying DOMAIN-KEYWORD,claude across the config tree. Keyword rules over-capture traffic you cannot explain next quarter; explicit suffixes age better for teams that read YAML during incidents instead of only during onboarding.
Rule Providers, Updates, and Ordering Discipline
Remote rule sets help you stay current—until you cannot download them. If provider traffic loops through a broken chain, lists rot quietly and fresh Anthropic endpoints fall into generic MATCH behavior nobody remembers authoring. Watch refresh logs, keep an emergency baseline you own on disk, and read diffs when an overnight auto-update coincides with fresh API timeout chatter in Slack you would rather not inherit as pagerduty.
Tracker or “hygiene” lists occasionally classify shared infrastructure oddly. When a spinner appears immediately after a list update, reproduce on a lab host with the suspect provider disabled, restore deliberately once you understand the interaction, and capture the finding in your internal knowledge base—the next engineer should not rediscover the same YAML surprise from a blank mental slate.
DNS, fake-ip, TUN, and When Env Vars Lie
Misaligned DNS is the invisible accomplice of split routing. macOS encrypted DNS profiles, browser-only DoH, corporate split-horizon, and Clash DNS each believe they should own resolution for anthropic.com. When fake-ip mapping disagrees with the outbound you ultimately select, you observe “instant resolve, endless dial,” which clients summarize as yet another generic timeout noun-free error blob that sends people toward irrelevant fixes.
Meta-class cores expose rich DNS controls; study Clash Meta DNS: nameserver fallback and fake-ip filter until the relationship between nameserver policy, fallback sequences, and filter lists feels boring—that boredom is what healthy operations sound like. The narrative your resolver tells must match the narrative your routing table enforces, or you will chase ghosts through expensive video calls.
When OS-level encrypted DNS fights with Clash, pick a single orchestrator for the test window, document the temporary choice in your ticket, and revert with intention. Multiplexing resolvers without a diagram is how senior engineers donate weeks to problems that were never model stalls.
Interpreting Timeouts and TLS Stalls in Logs
Treat logs like a sequence diagram someone already drew for you. SYN stalls usually mean routing or DNS lies; TLS hangs after ClientHello may mean an incompatible exit, QUIC fallbacks you did not anticipate, or middlebox interference; healthy throughput followed by resets can mean brittle nodes rather than ignorant YAML. Bucket hostnames into account families, API families, and static CDN families; if one bucket diverges from your intended policy consistently, fix the rule—not the model tier you just upgraded because panic felt productive.
For vocabulary that translates across vendors, pair connection logs: timeout and TLS patterns with Cursor login and AI timeouts—different product chrome, same lesson about OAuth plus API legs drifting apart under a proxy that refused to tell a single story.
Verification Checklist Before You Blame the Model
- Confirm you are permitted to use Clash and Anthropic tooling on this network under law and policy.
- Verify system clock skew is negligible; pause HTTPS interception while testing to avoid noisy TLS artifacts.
- Reproduce once with logging open; copy exact hostnames overlapping the stall window into your notes.
- Check each hostname against your effective ruleset—did it hit
CLAUDE_CODE_CLIas intended? - Audit rule order for geography catches, tracker lists, or keyword starvation that swallowed explicit suffix coverage.
- Align DNS mode with fake-ip and fallback; hunt for instant resolution with no successful TCP completion.
- Validate
NO_PROXYfor loopback callbacks; remove surprise double proxies during OAuth. - If environment variables look ignored, test TUN after you resolve VPN stacking conflicts that would poison the capture.
- Confirm remote rule providers refresh successfully—no silent stale lists pretending to be current.
- Only after local variables are ruled out calmly, rotate nodes or consult vendor status dashboards with evidence attached.
Write what changed, when, and why. Future you—and anyone pairing in a production incident—deserves a diff, not folklore whispered across desks that nobody can replay.
Frequently Asked Questions
Does API key mode avoid OAuth split entirely?
Keys shrink the browser story only if every dependency honors keys and never falls back to interactive consent flows. Many workspaces still see intermittent claude.ai or anthropic.com traffic for billing, team linking, enterprise SSO bridges, or quota dashboards. Keep suffix coverage broad until captures prove you can narrow without reintroducing API timeout theater.
Why do only streaming or long agent turns time out?
Streams and server-sent patterns keep connections open far longer than a quick health check. Middleboxes, lossy exits, and NAT timers that tolerate ordinary web browsing may murder long AI sessions. Routing alone cannot resurrect a dead node, yet split routing makes the failure look existential when the simpler truth is inconsistent exits plus aggressive idle timers nobody documented.
Is this unique to Claude Code?
The pattern generalizes to other Anthropic terminal clients and bundlers that blend OAuth, api.anthropic.com, and static edge infrastructure. Product marketing churns; the terminal CLI lesson—that one coherent policy beats three lucky lines—does not.
Wrap-Up: One Routing Story for the Whole Claude Code Session
One-click “global VPN” wrappers hide complexity, but they hide evidence too: when Claude Code fails, you get a polite spinner instead of a rule hit map you can screenshot. Generic tunnel products also struggle with fine split routing—everything rides one path, which solves some offices and invents fresh API timeout regimes for traffic that should have stayed direct for stability or compliance. Hand-curated hosts files rot weekly and rarely track moving Anthropic CDN edges without active maintenance nobody schedules.
Clash V.CORE preserves explicit policy: suffix rules you can read in review, provider updates you can audit, DNS modes that align with TUN or mixed ports, and logs that show which leg broke first during a Claude Code session. That observability is the difference between debugging a distributed terminal surface with receipts and guessing from opaque error blobs that waste senior attention.
→ Download Clash for free and route OAuth, api.anthropic.com, and CDN legs as one coherent Anthropic story—then spend your evening shipping agent workflows instead of packet trivia that never belonged on the critical path.