Can you set a hard spending limit on Google Cloud?
Only for four services. A normal Google Cloud budget sends alert emails at the thresholds you set and stops nothing. Spend cap budgets go further: once estimated costs pass the budget, Google pauses the service for the rest of the month unless you lift the cap. They work for the Gemini API, Vertex AI (now Gemini Enterprise Agent Platform), Cloud Run and Cloud Run functions, one project and one service per cap.
Google says enforcement isn't instantaneous and you pay for overage that builds up during the reporting delay. Persistent resources such as Compute Engine and storage are never paused and keep accruing charges. The full comparison is in Google Cloud spending limit.
| Control | What it does | The gap |
|---|---|---|
| Budget alerts | Emails at the thresholds you set | Alerts only; nothing stops |
| Spend cap budgets | Pauses one eligible service in one project at the cap | Four services, monthly only, not instant |
| Billing export to BigQuery | Itemized Google-reported cost | No delivery or latency guarantee |
| Costbrake | Live estimates for the four AI and serverless services, spike alerts, a spend cap you confirm | Other services wait for the export |
How fresh is the Google Cloud data Costbrake sees?
Google has no real-time billing API. The billing export is Google-reported cost and is usually hours behind, sometimes more than a day. Costbrake queries it about once an hour and treats a day as final after about 3 days. Setup details are in billing export to BigQuery.
Live estimates fill the hours the export hasn't reached. Costbrake prices Cloud Monitoring usage for the Gemini API, Vertex AI, Cloud Run and Cloud Run functions at list price, before credits and discounts, in up to 8 projects, and replaces the estimate with billed cost as the export catches up. Gemini API estimates count paid-tier input and output tokens; cached input, long-context and grounding surcharges and image or audio output only show up in the export.
You can start without an export table. Costbrake then shows live estimates only, which covers a runaway Gemini key or Cloud Run service but not the rest of the bill.
What the Google Cloud key can and can't do
The read key is a JSON key for a service account named costbrake-reader. It gets BigQuery Job User on the export project, BigQuery Data Viewer on the export table only, and Monitoring Viewer and Service Usage Viewer on each project you want live estimates for. Your AI agent can do this with gcloud and bq, as described in agent setup, or you follow the console steps.
Organizations created on or after May 3, 2024 block service account key creation by default. An organization policy administrator can allow it for the export project. BigQuery bills Costbrake's queries to that project: one small query an hour plus one a day, against a free 1 TiB of query data a month, then $6.25 per TiB.
How the Google Cloud brake works
Costbrake never brakes on its own. On Pro and Team, an admin turns the killswitch on for the connection, picks a target such as the Gemini API in one project, types the connection name and clicks Brake now. The brake uses a second service account, costbrake-brake, with a custom role that holds four budget and project permissions. Costbrake refuses a brake key that can change IAM, billing links or projects.
- If that service in that project already has a budget without a cap, Costbrake can't add one and tells you so.
- Usage between the brake and Google's enforcement is still billed.
- Compute Engine VMs, storage and other persistent resources keep running and billing.
- A spend cap you lift stays lifted until the next monthly period.
For Gemini keys specifically, see Gemini API spending limit, and for Firebase projects, Firebase surprise bill.
What triggers a Google Cloud alert
A spike alert fires when an hour costs more than 3 times your 7-day hourly average and at least $5 more, once Costbrake has 24 hours of history. Budget alerts fire at 50, 80 and 100 percent by default, and Pro adds forecast alerts. Free sends email; Pro adds Slack, Discord and webhooks; Team adds PagerDuty. Compare plans on the pricing page.
Questions and answers
Does Costbrake stop Google Cloud spend automatically?
No. Costbrake alerts you, and an admin on Pro or Team decides whether to set the spend cap. The brake needs the killswitch turned on for the connection, the connection name typed in, and a click on Brake now. Undo lifts the cap again.
Which Google Cloud services get live cost estimates?
The Gemini API, Vertex AI, Cloud Run and Cloud Run functions, in up to 8 projects, about 5 minutes behind. Every other service shows up when the Cloud Billing export to BigQuery has it, usually hours later.
Can Costbrake cap Compute Engine or Cloud Storage spend?
No. Google's spend caps only cover the Gemini API, Vertex AI, Cloud Run and Cloud Run functions, and they never pause persistent resources such as VMs and storage. For those, Costbrake alerts you and you act in the Google Cloud console.
Do I need the BigQuery billing export to use Costbrake?
Not to start. Without an export table Costbrake shows live estimates for the Gemini API, Vertex AI, Cloud Run and Cloud Run functions. Add the export to see billed cost and every other service.
What does Costbrake add to my Google Cloud bill?
Costbrake runs one small BigQuery query an hour plus one a day on the export project. BigQuery's first 1 TiB of query data a month is free and on-demand queries cost $6.25 per TiB after that, so most accounts stay inside the free tier.
Sources
Updated