CLAUDE CODE INTEGRATION
ONE ENV VARZERO CODE CHANGES

Claude Code
API Cost
Under Control

Claude Code Max plan bills spike without warning. RelayPlane adds a live cost ticker, stuck-agent detection, and budget caps , without touching a line of code.

// REAL USAGE, OWN ACCOUNT
TRACKED
$620
SAVED
$6,000+
10k
REQUESTS / WEEK
$6k+ in routing savings on $620 tracked spend
// THE PROBLEM

Claude Code Max plan costs spike unpredictably

No visibility

Claude Code gives you zero per-session cost data. You find out when the bill arrives.

Stuck agents burn quota

A looping agent can exhaust your daily Opus allowance in minutes. There's no kill switch.

No budget cap

Max plan subscribers on the API tier have no native spend limit. Overnight tasks run until they're done, or your card is.

RelayPlane fixes all three. It sits between Claude Code and Anthropic's API. One environment variable. No code changes.

// INSTANT VALUE

What you get the moment you install

Live cost ticker

See exactly what each Claude Code request costs in real-time, right in your terminal. No more surprise bills.

Stuck-agent detection

RelayPlane detects agents looping on the same task and alerts you before they exhaust your Opus quota.

Budget cap

Set a hard spending limit per session, per day, or per project. Requests stop cleanly when the budget is hit. Nothing burns while you sleep.

relayplane, claude code session
claude "refactor the auth module"
req #1 claude-sonnet $0.0032 12ms
req #2 claude-sonnet $0.0041 11ms
req #3 claude-opus $0.0218 23ms (complexity: high)
req #4 claude-sonnet $0.0029 10ms
session total$0.032 • budget: $5.00 remaining
// SETUP

30 seconds. One environment variable.

1

Install the proxy

One command. No config required to start.

$npm install -g @relayplane/proxy
2

Start the proxy

Runs on port 4100. Proxies to Anthropic transparently.

$relayplane start
3

Point Claude Code at RelayPlane

Set ANTHROPIC_BASE_URL in your shell. Your existing ANTHROPIC_API_KEY stays the same, RelayPlane forwards it to Anthropic.

$export ANTHROPIC_BASE_URL=http://localhost:4100

Or configure via relayplane.yaml:

relayplane.yaml
# relayplane.yaml
proxy:
  port: 4100
  upstream: https://api.anthropic.com

routing:
  provider: anthropic
  claude_code: true

cost:
  ticker: true          # live cost in terminal
  stuck_agent_ms: 30000 # alert if agent loops >30s
  budget:
    session: 5.00       # $5 per claude session
    daily: 20.00        # $20/day hard cap

Add ANTHROPIC_BASE_URL=http://localhost:4100 to ~/.zshrc / ~/.bashrc to persist across sessions.

That's it. Claude Code now routes through RelayPlane. Run relayplane stats to see your live cost ticker.

// HOW IT WORKS

Automatic model routing

RelayPlane classifies each request before it hits Anthropic. Simple tasks go to Sonnet. Complex work stays on Opus. No config needed.

On a Max plan? Sonnet is your base model.

Max plans don't include Haiku. Sonnet is the cheapest model you have access to. RelayPlane routes everything that doesn't need Opus to Sonnet, which draws from its own separate rate limit pool. Opus quota stays untouched until the work actually needs it. Your plan goes further. You hit the wall less often.

API key users: RelayPlane routes simple tasks to Haiku (~$0.001/req) and saves Sonnet for medium complexity. Direct cost reduction per request.

MAX PLAN($100–$200/mo flat)
API KEY(pay per token)
SIMPLE TASKS
  • File reads & edits
  • Code formatting
  • Simple Q&A
  • Grep / search
MaxSonnet
APIHaiku (~$0.001/req)
MEDIUM TASKS
  • Code generation
  • Refactoring
  • Test writing
  • Debugging
MaxSonnet
APISonnet (~$0.015/req)
COMPLEX TASKS
  • Architecture design
  • Multi-file analysis
  • Security review
  • System design
MaxOpus
APIOpus (~$0.075/req)

Circuit breaker included. If RelayPlane goes down, Claude Code talks directly to Anthropic. No downtime, no disruption. Your ANTHROPIC_API_KEY is forwarded directly. RelayPlane never stores it.

// REAL RESULTS

What Claude Code users actually get

10,000/wk
REQUESTS TRACKED
$620
SPEND TRACKED
$6,000+
ROUTING SAVINGS

$6k+ in routing savings on $620 of tracked spend, processing 10k requests per week. From a single account running Claude Code for agentic coding across a production codebase.

FREE FOREVER · MIT LICENSE · LOCAL-FIRST

Stop flying blind on Claude Code API cost

Live cost ticker. Stuck-agent detection. Budget caps. One command.

$npm install -g @relayplane/proxy