Coding agent spend

Catch a coding agent burning API credits, and stop it

Claude Code averages around $13 per developer per active day across enterprise deployments, by Anthropic's own count, and every token a looping session uses is billed. Costbrake checks Anthropic, OpenAI and OpenRouter spend every 5 minutes on Pro and alerts you when an hour runs past 3 times its usual spend and at least $5 over it.

From the alert, an admin can switch off the Anthropic or OpenRouter API key you gave the agent, freeze its OpenAI project, or stop the cloud resources it started. Your agent can even set Costbrake up for you; it just can't touch the brakes.

Where a coding agent's bill comes from

  • Claude Code on Console billing: Claude Code charges by API token consumption. When a member first signs in with a Console account, Anthropic creates a Claude Code workspace and mints a per-user API key in it. Costbrake reports Anthropic spend per workspace and model, so that workspace gets its own line.
  • An API key in your environment: an approved ANTHROPIC_API_KEY routes Claude Code through that key instead of your subscription. When that Console organization runs out of prepaid credits, Claude Code shows "Credit balance is too low".
  • Codex on an API key: OpenAI pitches the API key option for automation like CI, paid based on API pricing, and says extra local chats on an API key are charged at standard API rates. Costbrake reads OpenAI spend per project and model.
  • Claude Code on Bedrock or Google Cloud: spend lands on your cloud bill and is capped with that cloud's budget controls. Costbrake has live estimates a few minutes behind for Bedrock on AWS, with the CloudWatch permission, and for Vertex AI on Google Cloud.
  • Cloud resources the agent starts: an agent with cloud credentials can launch instances or trigger CI runs, and those bill like anything else you run.

For what Claude Code costs per seat and per token, see Claude Code cost. This page is about catching and stopping a run that got out of hand. For every AI API in one feed, see AI API spend. Agents that run in CI or on Bedrock bill through GitHub and AWS, and the Anthropic and OpenAI pages list each brake and what it stops.

The brakes for agent spend

Where the agent spendsBrakeWhat happens
Anthropic API keyDisable API keyEvery request made with the key fails right away; nothing else changes
Anthropic workspaceDisable workspace keysEvery active key bound to the workspace goes inactive, up to 60 per brake; organization-wide keys keep working
OpenAI projectFreeze projectA $0.01 hard limit; paid requests fail with 429 project_spend_limit_exceeded once OpenAI enforces it, usually within minutes
OpenRouter keyDisable key or cap at $0Requests with the key fail; a capped key still serves free models
Amazon BedrockDeny BedrockA deny policy on one IAM role or user blocks Bedrock model calls within seconds; its other permissions stay
AWS EC2Stop instanceCompute billing ends; EBS volumes stay and still bill
Google CloudSpend capA zero spend cap on Vertex AI or the Gemini API in one project; Google applies it once its estimate passes the cap, not instantly
GitHub ActionsDisable workflowThe workflow starts no new runs, and its queued and running runs are cancelled

Each brake is a click by an admin. The killswitch is off until an admin turns it on for a connection, a brake asks for the connection's label before it runs, and every request is written to the audit log first. Undo puts the old setting back.

Let your agent set Costbrake up, not the brakes

Costbrake has an agent setup that works with Claude Code, Codex CLI, Cursor and Gemini CLI. An admin approves the agent's link first. After that the agent can add connections, budgets and alert channels and read spend, and nothing else: it has no route to the brakes and can't delete or change what is already there.

That split matters with agents. The thing that can run up the bill is never the thing that can switch off the alert or pull the brake.

Native limits worth setting as well

A limit stops spend at a fixed number. Costbrake tells you when the rate changes, on one screen for every provider the agent touches. Brakes are on Pro ($12 a month) and Team ($39 a month, unlimited seats), and new workspaces get a 14-day Pro trial with no card. See pricing.

Questions and answers

How do I stop Claude Code from running up my API bill?

Set a spend limit on the Claude Code workspace in the Claude Console; it is the only workspace with per-user monthly spend limits. Costbrake then alerts you when an hour of Anthropic spend runs past 3 times its usual level and at least $5 over it. If Claude Code runs on an API key you created, an admin can switch that key off in one click.

Why is Claude Code billing my API account instead of my subscription?

Claude Code uses an approved ANTHROPIC_API_KEY from your environment instead of your subscription, so usage is billed to that key's Console organization. When that organization runs out of prepaid credits, Claude Code shows "Credit balance is too low". Anthropic's fix is to run /status, check the API key row, then unset the key in your shell, remove it from your shell profile and relaunch claude.

Does Codex use my OpenAI API credits?

Only when you run it with an API key. OpenAI says extra local chats using an API key are charged at standard API rates, and the API key option is paid based on API pricing. That spend appears in your OpenAI usage, which Costbrake reads per project and model.

Can a coding agent change my Costbrake alerts or use the brakes?

No. An agent session needs an admin's approval, and then it can only read spend and add connections, budgets and alert channels. It has no route to the brakes and cannot delete or change existing settings.

What does Costbrake cost for a team using coding agents?

Free covers 2 accounts with hourly checks and email alerts. Pro is $12 a month or $120 a year for 10 accounts, 3 seats, 5-minute checks, Slack, Discord and webhook alerts, and brakes. Team is $39 a month or $390 a year for 50 accounts, unlimited seats, PagerDuty and the REST API.

Sources

Updated

Start with 14 days of Pro, free

Catch the next spike before the invoice.

14 days of Pro, then Free for 2 accounts. No card needed.