Google Cloud integration

Google Cloud cost alerts with a spend cap brake

Costbrake watches Google Cloud through your Cloud Billing export to BigQuery, which Google delivers with no latency guarantee, and fills the gap with live Cloud Monitoring estimates for the Gemini API, Vertex AI, Cloud Run and Cloud Run functions in up to 8 projects, about 5 minutes behind.

Free checks hourly and sends email. Pro at $12 a month and Team at $39 a month check every 5 minutes, every 2 minutes during a spike, and add one brake an admin confirms by hand: a zero spend cap on one service in one project. Undo lifts it.

Google Cloud at a glance

Reads
Cloud Billing export in BigQuery, usually hours behind, plus live estimates for Gemini API, Vertex AI, Cloud Run and Cloud Run functions
Key
JSON key of a read-only service account: BigQuery Job User, BigQuery Data Viewer on the export table, Monitoring Viewer, Service Usage Viewer
Setup
Your AI agent runs the gcloud and bq steps, or you paste the service account key and the export table name
Free plan
Hourly checks, email alerts
Pro and Team
Every 5 minutes with live estimates; hourly on the export alone
Spike checks
Every 2 minutes for 2 hours after a spike, on the live estimates
Brakes
1: a zero spend cap on one service in one project

Brakes

1 brake for Google Cloud

An admin picks a brake, confirms it, and can undo it later. Brakes come with Pro and Team.

  • Admin confirms

    Spend cap

    Sets a zero Google spend cap on one service in one project, so Google pauses new usage there once its cost estimate passes the cap.

    UndoLifts the cap, then removes Costbrake's budget or puts your earlier budget amount back.

    Google's enforcement isn't instant and usage until then is still billed; after Undo, Google can take up to an hour to let usage through again.

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.

ControlWhat it doesThe gap
Budget alertsEmails at the thresholds you setAlerts only; nothing stops
Spend cap budgetsPauses one eligible service in one project at the capFour services, monthly only, not instant
Billing export to BigQueryItemized Google-reported costNo delivery or latency guarantee
CostbrakeLive estimates for the four AI and serverless services, spike alerts, a spend cap you confirmOther 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

Start with 14 days of Pro, free

Catch the next Google Cloud spike before the invoice.

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