[null,null,["最后更新时间 (UTC):2025-08-04。"],[],[],null,["Whether you're just starting out developing your app or you have a full-blown\nproduction app, you want to make sure you understand your costs and how to avoid\nsurprise bills.\n\nIf you haven't already, check out the [Firebase pricing\nplans](/docs/projects/billing/firebase-pricing-plans) to understand how billing\nfor works for Firebase.\n| **Important:** **Firebase pricing plans apply to the entire project, not just to\nindividual apps registered in the project.** When you're determining which pricing plan is right for you, consider the usage from *all the apps* registered in the same project. Learn more about [best practices](/docs/projects/dev-workflows/general-best-practices) for when to add multiple apps to the same Firebase project. \n\nThis page guides you through important aspects of understanding and monitoring\nyour usage and spend levels, including:\n\n- [Testing your code](#test-code)\n- [Viewing your usage and spending levels](#view-usage-and-spending-levels)\n- [Setting up budget alert emails](#set-up-budget-alert-emails)\n\n*** ** * ** ***\n\nTest your code\n\nTesting your code before deploying to production is a great idea for many\nreasons, like catching errors that might cost you significant amounts of money.\nAs you're building the infrastructure for your app, **we highly recommend first\ntesting locally using the [Firebase Local Emulator Suite](/docs/emulator-suite)**.\n\nThe Local Emulator Suite allows you to run instances of Cloud Functions,\nCloud Firestore, the Realtime Database and more all locally on your desktop machine.\nThis not only makes it easier for you to quickly iterate on new functionality ---\nparticularly Cloud Functions --- but it also ensures that you don't incur any\nFirebase costs that might result from testing against services in production.\n\nAs you're testing, check for these common causes of exceeding expected usage and\nspend:\n\n- Forgetting to add a limit to a database query with millions of results\n\n- Combinations of Cloud Functions that cause excessive fan-out workloads\n or even infinite loops\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\u003cbr /\u003e\n\nView your usage and spending levels\n\nYou need to know what normal usage patterns look like for your app and make sure\nyou're staying within thresholds important to you.\n| Most Firebase products provide product-specific documentation about usage, quotas, and pricing. They also often provide usage-to-billing examples for the product. Visit a product's section in the Firebase documentation to find this type of information.\n|\n| For example, here's documentation to\n| [understand billing for Cloud Firestore](/docs/firestore/pricing).\n\nView individual product usage\n\nYou can view individual product usage in the \"Usage\" tab for many products in\nthe Firebase console.\n\n- You can view specific date ranges in these dashboards.\n\n- Product-level dashboards are available for\n [Authentication](//console.firebase.google.com/project/_/authentication/usage)\n and all the infrastructure products:\n [Realtime Database](//console.firebase.google.com/project/_/database/usage),\n [Cloud Firestore](//console.firebase.google.com/project/_/firestore/usage),\n [Cloud Storage](//console.firebase.google.com/project/_/storage/usage),\n [Cloud Functions](//console.firebase.google.com/project/_/functions/usage),\n and [Hosting](//console.firebase.google.com/project/_/hosting/usage).\n\nView overall project usage\n\nYou can view your project's overall usage in the\n[*Usage and billing* dashboard](//console.firebase.google.com/project/_/usage)\nin the Firebase console (go to *Project Settings* \\\u003e *Usage and billing*).\n\n- You can view your monthly usage and how your usage levels are\n measuring up to the allocated no-cost usage quota.\n\n- Click into any product to review a daily summary of usage and how it\n measures up to the allocated no-cost usage quota.\n\nRemember that each product has different usage quotas and thus different\ntimelines, for example:\n\n- Cloud Firestore and Cloud Storage usage are calculated daily.\n\n- Cloud Functions usage is calculated monthly.\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\u003cbr /\u003e\n\nSet up budget alert emails\n\nAvoid surprises on your bill by creating budgets in\nGoogle Cloud Billing and setting up budget alerts.\n\n- *Budgets* are general monetary amounts that you plan on spending each month.\n\n- *Budget alerts* are email notifications sent to your team if your project\n exceeds a set spending threshold.\n\n| Be aware that **budgets and budget alerts do\n| *not* cap your usage or charges** and that there's a delay between incurring costs and receiving a budget alert (depending on the service, up to a few days). Budgets and budget alerts are intended to help you monitor your spending and to *alert* you about your costs so that you can take action, if needed. For example, you might consider [using\n| budget notifications to programmatically disable Cloud Billing on a\n| project](//cloud.google.com/billing/docs/how-to/disable-billing-with-notifications).\n\nBy default, Firebase and Google Cloud don't turn off services and usage based on\nyour budget and thresholds because although you *might* have a bug in your app\ncausing an increase in charges, you might just be experiencing unexpected\npositive growth of your app. You don't want your app to shut down unexpectedly\nwhen you need it to work the most.\n\nYou might already have a budget alert if you upgraded to a Blaze pricing plan\nrecently. But if you want to learn more about budget alerts, set up a new alert,\nor modify an existing alert, this section is for you!\n| [All Firebase\n| projects are actually Google Cloud projects](/docs/projects/learn-more#firebase-cloud-relationship) behind the scenes, which means billing is shared across Firebase and Google Cloud and you can view the same project in both the Firebase console and the Google Cloud console.\n\nSet up a budget and a basic budget alert\n\nThis section describes budgets and budget alerts at a high-level with a\nFirebase-context. For detailed information, make sure to check out\n[Set budget alerts](//cloud.google.com/billing/docs/how-to/budgets)\nin the Google Cloud documentation.\n| **Note:** To set up a budget or a budget alert, you need to be an Owner of the associated Cloud Billing account.\n\nHere's how to set up a budget and a basic budget alert:\n\n1. Navigate to the budget settings:\n\n 1. Access your project in the Firebase console, then go to the\n **Usage and billing** \\\u003e [**Details \\& settings** page](//console.firebase.google.com/u/0/project/_/usage/details).\n\n 2. In the **Budgets \\& Alerts** section, click **Create first budget** . This\n takes you to the **Budgets \\& alerts** page in the\n Cloud console.\n\n Note that if you already have a budget set up, you'll see it here\n instead of the \"Create first budget\" link.\n2. Complete the following steps to set up a budget and an emailed budget alert:\n\n 1. Select an existing budget or create a new one.\n\n 2. Give your budget a descriptive name.\n\n 3. Set the scope for the budget alert, including the project(s) and\n service(s) that you want the budget alert to apply to. You probably want\n to select *All services* when getting started with budget alerts.\n\n 4. Set the *Amount* \\\u003e *Budget type* using one of these options:\n\n - **A set amount of money** -- use this type when you're first starting\n out or testing your app\n\n - **An amount equal to what your project spent last month** --\n use this type when your app is growing steadily and you don't want\n to keep updating the budget amount every month\n\n 5. Set up *Percent of budget* alerts.\n\n - For initial testing, try out several percentages, like 1%, 2%, 5%,\n and 50% of *Actual*.\n\n - For production apps, try out pivotal percentages, like\n 50% and 100% of *Actual* as well as 150% of *Forecasted*.\n\n | **Tip:** Set a limited number of alert thresholds for your production apps. You want to be informed, but you don't want so many email notifications that you stop paying attention to them.\n 6. Set up who should get emails.\n\n - By default, anyone with the appropriate billing permissions gets the\n notification email (by default, Billing Account Administrators and\n Billing Account Users on the associated Cloud Billing account).\n\n - You can also send emails to other people on your team. This requires\n creating a Cloud Monitoring Workspace and then adding an\n email-based notification channel to the *Alerting* section of the\n workspace. For more information about this setup, visit\n [Set up advanced billing alerts and logic](/docs/projects/billing/advanced-billing-alerts-logic).\n\nIf you set up a notification for a low *Percent of budget* (like 1%),\nyou should get an email within a couple hours or a couple of days telling\nyou that your project has hit that threshold.\n\nNext steps\n\n- Consider using\n [budget notifications to programmatically disable Cloud Billing on a project](//cloud.google.com/billing/docs/how-to/disable-billing-with-notifications).\n\n- Visit\n [Set up advanced billing alerts and logic](/docs/projects/billing/advanced-billing-alerts-logic)\n to learn how to do the following:\n\n - Use Cloud Monitoring to create more sophisticated alerts for billing\n and usage, including custom alerts that send notifications to other\n mediums, like Slack.\n\n - Create additional billing logic based on Google Cloud Pub/Sub."]]