All posts
Guides6 min read

Running Claude Code through a proxy

Claude Code reads an ANTHROPIC_BASE_URL environment variable. That one hook is enough to put a gateway in front of it, which unlocks routing, fallback, caching, and spend visibility without changing how anyone works.

Why proxy it at all

  • Cost visibility per developer and per repo. Aggregate seat billing tells you nothing about where spend actually goes.
  • Fallback during provider incidents. When the upstream API degrades, a gateway can fail over instead of blocking the whole team.
  • Caching across a session. Coding sessions resend near-identical prefixes; caching them is close to free money.
  • Policy. Keep proprietary source away from providers your security team has not approved.

Setup

Point the base URL at the gateway and use a gateway key. Full copy-paste configuration for Claude Code, Cursor, Cline, Aider, and Continue is in the coding tools guide.

Fidelity matters more here than for ordinary chat traffic. Agentic tools depend on exact tool-call semantics — tool call indexes, parallel calls, and streaming deltas. A gateway that normalizes those loosely will produce subtly broken agent behavior. Neural Router preserves tool-call structure end to end; see tool calling.

Then route by step

Once traffic flows through a gateway, the interesting move is routing by step type — frontier models for planning and complex edits, cheaper models for file reads, renames, and mechanical fixes. See reducing AI coding assistant costs.

Keep reading