spendbrake (@spendbrake) header
spendbrake (@spendbrake) profile picture

Hard dollar caps for every paid API your apps and AI agents call. Enforced before the request leaves. Open-source core, free plan.

Joined November 2026
On the Gemini Developer API, requests to gemini-2.5-pro now route automatically to gemini-3.8-flash and are billed at Gemini 3.8 Flash rates. Calls to gemini-2.5-flash route to gemini-3.5-flash-lite the same way, so a leftover model name can change both the answer and the bill without returning an error.
10
Gemini 4 Hydrogen defaults to thinking_level high, and thinking tokens bill as output at $7.50 per 1M. If you're moving a Flash workload over, set thinking_level yourself and compare cost per request on a day of real traffic before switching everything.
2
1
17
Saw a thread about an agent blowing through a $100/day cap to fix a P0. That only happens if the cap lives somewhere the agent can change. Put it on the API key or a proxy, and let the agent stop and ask someone to raise it for that one incident.
1
8
Also check the agent can't read whatever token raises the cap. Spend Brake's docs say to run the agent as a different OS user from the one holding the admin token, otherwise it could lift its own caps. docs.spendbrake.dev/agents/
6
Dylan Patel says 45% of SemiAnalysis's AI spend is now persistent agents. If you run background agents, give each one its own key with a daily limit, or the invoice shows a total and nothing about which agent spent it overnight.
1
2
For the tool side (search, Maps, Twilio), brake session --day-budget 20 --agent <name> gives an agent one daily cap across all its sessions. docs.spendbrake.dev/agents/
2
Railway's report says the attacker searched env var names for AI provider keys and decrypted the matches. If you deployed there, check provider usage from Oct 20 on, not just whether the key was rotated. There's a form for charges you didn't make. blog.railway.com/p/incident-…
1
3
If the key your app holds is a Spend Brake virtual key, whoever steals it gets that key's daily cap, and brake kill stops it. The real provider key only gets decrypted inside the proxy, so wherever the proxy runs is the box to lock down. docs.spendbrake.dev/how-it-w…
3
Gemini 4 Carbon and Argon are both $2/$10 per 1M tokens until Nov 30, then $4/$20 from Dec 1. Thinking tokens bill as output. If your monthly budget alert was tuned on November usage, the same traffic will trip it around Dec 15.
1
4
If your agent loop only caches the system prompt, every step re-sends the whole conversation at full input price. Worth checking the cached token count in the usage block on a real run before you trust any per-task cost estimate.
2
n8n Labs' new Nod agent sets a $200/month model spend limit at setup and checks in once a task passes $5. Per the docs, work that's already running can finish after you hit the limit, so a long task can still end up over it.
2
AgentCore's new Web Search API is $7 per 1,000 queries. An agent that searches 15 times per task over 400 tasks a day is 6,000 queries, so about $42 a day just for search. I'd log searches per task for a week before picking a budget.
3
Leaving an agent running overnight? Give that run its own budget and an expiry, not just the account limit. If it loops at 3am it stops at a number you picked, and the key is dead by the time you're up. In Spend Brake that's a session key: docs.spendbrake.dev/agents/
2
Spend Brake 0.4.0 is out. brake mcp now covers Brave, SerpApi, the Google Maps commands and Mapbox/HERE/Twilio/custom APIs through brake_call, all capped. Admin tools are a separate brake mcp --admin entry that you keep out of the agent's config. docs.spendbrake.dev/changelo…
1
Google Maps now works inside AI Studio, and the no-card demo key stops at 100 calls a day per API. Connect a billed project and that ceiling goes away. Before you do, set a requests-per-day quota on each Maps API in Cloud Console and restrict the key to just those APIs.
1
1
The loops that cost the most usually don't error. Two agents handing a task back and forth get a 200 every time, so the error alerts stay quiet. Counting identical requests per key per minute catches it a lot earlier.
1
1
In Spend Brake that count can trip a circuit: the key gets 429 loop_detected, and you get an alert with links to kill the key or reset it. docs.spendbrake.dev/agents/#…
1
Classic one: a useEffect missing its dependency array, calling Places or Geocoding on every render. Nothing errors, you just get billed per request. Worth opening the Network tab once and counting how many calls a single page load makes.
1
1
We'd also keep those calls server-side with a daily dollar cap on the key, so a render loop gets refused instead of billed. brake doctor in 0.3.0 flags a Google key sitting in NEXT_PUBLIC_GOOGLE_MAPS_API_KEY. docs.spendbrake.dev/agents/#…
1
A spend cap only protects calls that go through it. The usual leaks: a raw provider key still in .env, an admin token the agent can read, a second key with no cap, a client that fails open. Audit those before you trust any cap.
1
1
Spend Brake 0.3.0 adds brake doctor, which checks for those leaks from where the agent runs. With --prove, it shows a priced call being refused before it's forwarded. It also lists what it can't verify. docs.spendbrake.dev/agents/#…
1
1
One re-render loop. One night. A reported $4,000 Google Places bill. Before leaving dev running: • Dedupe in-flight requests. • Check and lower the API's available quotas. • Isolate dev from production. A billing alert tells you what happened. It doesn't stop the next call.
1
1
Quotas count requests. Your bill depends on which Places SKUs those requests use. Spend Brake checks dollar caps per key and SKU before forwarding, with loop detection too. Restrict the real Google key to the proxy's egress IPs. spendbrake.dev
Spend Brake is now on SaaSHub. Hard dollar caps for the paid APIs your apps and agents call. Requests that would cross a cap are refused before forwarding, not just flagged after the bill arrives. spendbrake.dev
A spend check can pass while earlier calls are still running. If cost is recorded only after completion, concurrent requests can each see the same remaining budget. Returning 402 isn't the whole guarantee. When you account for in-flight spend matters too.
1
1
Reserve against the cap atomically before forwarding, then settle afterward. The reservation must cover the call's possible cost, or overshoot remains possible. Spend Brake applies pre-forward budget reservations to paid APIs: spendbrake.dev
A spend cap and a rate limit need different handling. Backoff makes sense for temporary throttling. It doesn't fix an exhausted budget. Return a distinct error naming the cap, and teach the agent to stop rather than retry it.
1
1
Spend Brake returns 402 with the scope that tripped when a paid API call would cross a cap. Maps, Twilio, search and custom APIs. The caller can distinguish a budget refusal from temporary throttling. spendbrake.dev