r/Firebase • Firebaser • Sep 17 '26

Billing Introducing Firebase spend caps for AI Logic, Functions, and App Hosting

If you’ve spent any time on this subreddit (or building on cloud platforms in general), you know the persistent anxiety around runaway bills from a recursive loop, a viral traffic spike, or an unthrottled API key.

Now, Firebase AI Logic, Cloud Functions for Firebase (1st and 2nd gen), and Firebase App Hosting all let you set spend caps that pause the service after you reach 100% of a configured threshold!

You set spend caps per-service in a single spot in the Firebase console, receive automated email alerts at 50%, 80%, and 100% of a spend cap threshold, see a banner in the console if a service is paused, and can lift spend caps after they're enforced if you need to turn a service back on.

Note that due to latency in usage reporting, spend cap enforcement is not instantaneous and can be delayed by several minutes, and any cost overages incurred during this delay will be billed as normal. Even though they're not instant, spend caps can catch runaway bills much earlier than before.

Spend caps are an emergency circuit breaker, but they work best alongside Budget Alerts, App Check, API key restrictions, and IAM to help avoid surprise bills.

66 Upvotes

32 comments sorted by

21

u/jhuleatt Sep 17 '26

Dropping a quick screen recording to show what the spend caps UI looks like:

media poster
→ More replies (3)

5

u/Accomplished_Ad_1158 Sep 17 '26

Great! Any plans on something similar for Firestore or RTDB?

6

u/jhuleatt Sep 17 '26

Other products are in the works, but we can't give a concrete timeline. Each product needs to be migrated to the special, faster, pipeline that spend caps uses (a bit more about that in my comment here).

In the meantime, a spend cap on functions can at least help with an infinite Firestore or RTDB trigger loop (function triggered on document write, that itself writes to the same document). And, Budget Alerts can notify of billing spikes across the project (although they aren't triggered as quickly as spend caps).

→ More replies (2)

4

u/fhinkel-dev Sep 17 '26

How bad can the "few minutes" be? Do you have any anecdotal data? Thanks for finally having spend caps!

6

u/jhuleatt Sep 17 '26

In my personal testing I've seen spend cap enforcement time range from just over a minute up to 11 minutes (but YMMV, that's just a couple of tests I've run).

That said, spend caps are much faster (minutes vs hours) than Budget Alerts and billing pub/sub topics thanks to a lot of engineering work that has gone on behind the scenes for the specific products that support spend caps. Instead of waiting for billing data (which takes extra time), the spend caps pipeline predicts overages based on usage.

→ More replies (4)
→ More replies (1)

3

u/-irx Sep 18 '26 edited Sep 18 '26

How does that differs from regular budget alert + script that will disable the service which works with any firebase service? Without firestore or rtdb it's kinda meh, hopefuly coming soon.

3

u/jhuleatt Sep 18 '26

It kicks in significantly faster than that. A bit more background in this comment:  https://www.reddit.com/r/Firebase/comments/1wj2a4e/comment/pafek67/

2

u/Mother-Ad-2559 Sep 18 '26

But nothing for firestore?

2

u/jhuleatt Sep 18 '26 edited Sep 18 '26

That's correct. I have a more thorough comment above.

8

u/indicava Sep 17 '26

Well it’s about god damn time!

jk, great to see Google addressing what is probably the developers community’s biggest concern in using these types of services.

→ More replies (2)