Learn how to configure a spend cap in Cloud Billing Budgets, which services it covers, how it resets each month, and what limits you should be aware of before relying on it.
Google Cloud has announced the general availability of spend caps in Cloud Billing Budgets. The idea is simple: when the estimated spend for a service in a project reaches the monthly budget, new requests are blocked, but nothing is deleted. It's a defense designed for agent loops or runaway models.
In this guide, we'll review how to set up the cap, what it covers and what it doesn't, and how to automate it. We rely on the official documentation and InfoQ's coverage. We haven't invented any commands: where appropriate, we refer to the API reference.
What You Need
- A Google Cloud project with active billing and billing administrator or project owner permissions.
- A supported service in that project: Gemini API, Gemini Enterprise Agent Platform, Cloud Run, or Cloud Run functions.
- A maximum monthly figure, calculated at list price, and a safety margin below your actual limit.
- Optional: access to the Budgets API if you want to create caps when provisioning projects.

Setting Up the Cap Step-by-Step
- Open the Budgets & Alerts page in the Billing console and create a budget for the project and service you want to monitor.
- Define the monthly amount. Remember that the calculation uses list price and does not deduct credits or discounts, so your actual bill may be less than the estimate.
- Enable the cap enforcement on that budget, so that new requests are paused when the target is reached.
- Verify that billing administrators and project owners receive alerts at 50, 80, and 100 percent.
- Decide if you prefer automatic reset at the beginning of the next month or manual unblocking from the console, an option that remains available.
- If you manage many projects, create, lift, and delete caps from the Budgets API and integrate it into your project onboarding process.
What Happens When the Limit Is Reached
When the target is reached, new requests to that service in that project are rejected. Those already in flight complete and are billed, persistent resources continue to function, and nothing is deleted. Usage covered by committed use discounts is also paused, but Provisioned Throughput for AI models never stops.
For AI services, enforcement uses live estimated costs, visible in cost reports, instead of settled billing data which can take hours. Still, it's not instantaneous: the documentation warns that overages during the delay are billed normally and recommends setting the cap slightly below your absolute limit.
# Mental template for sizing the cap (not a command)
absolute_limit = 1000 # maximum you tolerate paying per month
margin = 0.15 # buffer for application delay
cap = absolute_limit * (1 - margin) # 850Limits to Be Aware Of
A cap covers a single project and a single service for one calendar month. It does not include folders, organizations, labels, multi-service budgets, reseller accounts, or subscription charges like Gemini Enterprise seats. It also does not include Compute Engine, Cloud Storage, or networking, so a forgotten GPU instance won't be stopped by this.
The community has already weighed in: in a Hacker News thread, someone called it not granular enough, and Simon Willison argues that pay-as-you-go services should come with hard caps by default. For comparison, AWS offers a spend limit per project in limited deployment, and the Azure limit remains restricted to free accounts and subscriptions with credits.

Original source: infoq.com
Article generated with AI.larebelion



Publicar un comentario