Set up spend caps for Firebase services


This page describes how to set up and manage spend cap budgets when your Firebase project is on the Blaze pricing plan.

Spend cap budgets are available for the following select Firebase services: Firebase AI Logic, Firebase App Hosting, Cloud Functions for Firebase, and Firebase Extensions.

Jump to instructions for configuring a spend cap

Understand budgets

You can control your costs and avoid surprises on your bill by creating budgets for Google Cloud Billing. Budgets are general monetary amounts that you plan on spending each month, and they can either be alerts-only budgets or spend cap budgets.

Alerts-only budgets

  • If spending reaches set thresholds for your budget, then Cloud Billing sends email notifications.

  • Note the following:

    • Budget alerts do not pause services. They're intended to help you monitor your costs and to alert you so that you can take action, if needed. For example, you might consider using budget notifications to disable billing on the project.

    • When you upgrade to the Blaze pricing plan in the Firebase console, you're automatically prompted to set up an alerts-only budget. You can also manually set up alerts-only budgets in the Google Cloud console.

Spend cap budgets (this page)

  • If spending reaches set thresholds for your budget for a specific service, then Cloud Billing sends email notifications.

  • If spending reaches 100% of your budget for that service, then Cloud Billing pauses that service for the rest of the month.

  • Note the following:

    • Spend caps budgets are only available for the following Firebase services: Firebase AI Logic, Firebase App Hosting, Cloud Functions for Firebase, and Firebase Extensions.

    • You can manually set up spend cap budgets in the Firebase console (as described on this page) or in the Google Cloud console.

Overview of spend cap budgets

Before setting up a spend cap budget, review the information in this section, which includes the list of eligible services and possible spend cap states. We also recommend reviewing limitations of spend cap budgets later on this page.

You can also find a list of FAQ about spend cap budgets in the Google Cloud documentation.

Eligible services

Spend caps budgets can be set up for the following Firebase services:

  • Firebase AI Logic: Set caps on access to Gemini Developer API or Agent Platform Gemini API (formerly Vertex AI).
  • Firebase App Hosting: Set caps on the underlying Cloud Run service.
  • Cloud Functions for Firebase: Set caps on the underlying Cloud Run functions service.
  • Firebase Extensions: Set caps on the underlying Cloud Run functions service.

We're working to add to this list of eligible services for spend cap budgets, so check back on this list periodically.

Spend cap states

A spend cap can be in one of the following states:

  • Configured: Cloud Billing is actively monitoring your project's spending for a specific service based on your spend cap budget.
  • Enforced: Your project's spending reached 100% of your set monthly budget for that service, so Cloud Billing enforced the spend cap. Any new usage of the service for the rest of the month is paused unless the enforced spend cap is explicitly lifted.
  • Lifted: Cloud Billing had enforced the spend cap (and paused any new usage of the applicable service), but the enforced spend cap was explicitly lifted to resume the service.

Set up and manage spend caps

  1. Configure a spend cap budget.
    Configure a spend cap budget so that Cloud Billing can start actively monitoring your project's spending for a specific service.

  2. Understand alerts and spend cap enforcement.
    If your project's spending reaches certain thresholds of your monthly budget for that service, Cloud Billing sends alert emails and enforces the spend cap. Enforcement means any new usage of that service is paused for the rest of that month.

  3. Optionally lift an enforced spend cap.
    If you want to resume usage for a paused service that month, then you need to explicitly lift the enforced spend cap.

Required permissions

To set up and manage a spend cap budget, you need admin-level access to the project and its linked Cloud Billing account. Any of the following options grant you the required permissions:

Configure a spend cap budget

For Cloud Billing to actively start monitoring your spending for a service, you need to configure a spend cap budget for that service. If your project reaches certain spending thresholds for that service, then Cloud Billing will send alert emails and enforce the spend cap.

Here's how to configure spend cap budgets using the Firebase console:

  1. Access your project in the Firebase console, then go to the Settings > Usage and billing > Details & settings page.

  2. Go to the Service-level spend caps card.

  3. Locate the service you want to cap, set your monthly budget amount, and then click Configure.

    • A spend cap budget is scoped to a single project and a single eligible service within that project.

    • The time range for a spend cap budget is monthly, starting on the first day of each month.

Note that you can also configure spend caps budgets using the Google Cloud console.

Alert emails and spend cap enforcement

After you configure a spend cap budget, Cloud Billing will actively monitor your project's spending for that service. It will send alert emails and enforce the spend cap based on the following spending thresholds for that service's spend cap budget.

  • 50% and 80% of the set budget:

    • Cloud Billing sends warning alert emails to all billing administrators, project owners, and any applicable "essential contact".
  • 100% of the set budget:

    • Cloud Billing enforces the spend cap, which means any new usage for the applicable service will be paused for the rest of the month unless you explicitly lift the enforced spend cap.

    • Cloud Billing sends another alert email. Also, the Firebase console and the Google Cloud console displays banner notifications about the spend cap enforcement and paused service.

Client-side impact and error handling

When a service is paused due to an enforced spend cap, your client-side app will start throwing errors for that service. You should handle these exceptions gracefully in your app code (for example, using try-catch blocks).

Lift an enforced spend cap

If a spend cap is triggered and enforced, all new usage for the applicable service is paused for the rest of the month unless you explicitly lift the enforced spend cap.

Here's how to lift an enforced spend cap using the Firebase console:

  1. Access your project in the Firebase console, then go to the Settings > Usage and billing > Details & settings page.

  2. Go to the Service-level spend caps card.

  3. Locate the service with an enforced spend cap, and then click Lift.

Note that you can also lift enforced spend caps using the Google Cloud console.

Limitations of spend cap budgets

The following are important limitations to understand about spend cap budgets:

  • Spend caps budgets are not "hard caps". Due to latency in usage reporting, enforcement isn't instantaneous. Any cost overages incurred during this delay will be billed as normal. Consider setting your budget slightly below your absolute limit.

  • Project and service scoped. A spend cap budget is scoped to a single project and a single eligible service within that project.

    • You cannot set a spend cap budget at the entire Cloud Billing account level or at the Folder, Organization, or Label level.

    • You cannot set a single spend cap budget that will cover multiple projects or multiple services.

    • When you set a spend cap budget for a service, then it applies to any of the ways that you might interact with the service in the project. For example, if you set a budget on the Agent Platform Gemini API (formerly Vertex AI), then it also applies to any usage of that API in the project via Firebase SQL Connect, ADK, Genkit, etc. (not just usage via Firebase AI Logic).

  • Monthly time range. A spend cap budget's time range is monthly, starting on the first day of each month.

  • Service resumes each month by default. If you do not lift an enforced spend cap, the service will remain paused for the current month only.

    • By default, at the beginning of the next month, an enforced spend cap will be automatically lifted and the service will resume.

    • However, you can adjust the spend cap budget settings so that the spend cap remains enforced (and the service remains paused) indefinitely until you explicitly lift the enforced spend cap.

    By default, if you do not lift an enforced spend cap, the service will remain paused for the current month, but automatically resume at the beginning of the next month. However, you can adjust the spend cap budget settings so that the spend cap remains enforced (and the service remains paused) indefinitely until you explicitly lift the enforced spend cap.

  • Does not include savings and credits. The cost calculations for a spend cap budget is based on gross costs and do not include savings and credits.

If you have more advanced billing setup, you can find more details about limitations of spend cap budgets in the Google Cloud documentation.