Hard budget limits for
AI coding agent sessions
A local proxy that sits in front of Claude Code and Codex CLI. When a session hits your spend cap, the next request is blocked — not warned about after the fact.
The problem
The Anthropic console and Claude.ai subscription limits tell you what you spent. They don't stop you while it's happening.
agent-bill-guard fills that gap: a per-session circuit breaker you run locally, in front of your agent. No infrastructure. No accounts. No monthly cost.
What it looks like
5-minute setup
How it works
The proxy intercepts every request to Anthropic or OpenAI, checks the running spend total for the session, and either allows or blocks the request before it hits the upstream API.
After each request, it parses the response's usage field (input_tokens, output_tokens), estimates cost against a built-in model pricing table, and appends one line to ledger.jsonl.
Check spend while running
Comparison
| Feature | agent-bill-guard | LiteLLM | Portkey | Provider console |
|---|---|---|---|---|
| Per-session hard cap | ✓ | ✗ (per-key) | ✗ (per-key) | ✗ (monthly) |
| Local, zero infra | ✓ | ✗ requires server | ✗ requires server | N/A |
| Per-request JSONL log | ✓ | ✗ dashboard only | ✗ dashboard only | ✗ |
| Setup time | ~2 min | ~30 min | ~30 min | immediate |
| Multi-model routing | ✗ | ✓ | ✓ | ✗ |
| Team auth / virtual keys | ✗ | ✓ | ✓ | ✓ |
Use LiteLLM or Portkey if you need org-wide routing, virtual keys, or a shared team proxy. Use agent-bill-guard if you need a per-session kill switch you can run locally in under 2 minutes.