<br />

<br />

|----------------------------------------------------------------------------------------------------------------------------------|
| *Click yourGemini APIprovider to view provider-specific content and code on this page.* Gemini Developer APIVertex AI Gemini API |

<br />

<br />

Pricing and whether your Firebase project needs to be on the[pay-as-you-go Blaze pricing plan](https://firebase.google.com/pricing)depends on your chosenGemini APIprovider and the features ofFirebase AI Logicthat you use.

**UsingFirebase AI Logicis free-of-charge.**

However, you might incur costs when you use other products in conjunction withFirebase AI Logic.

- **Other Firebase products may incur costs.** For details, see the[Pricing page](https://firebase.google.com/pricing).

  - Using some of the attestation providers supported byFirebase App Check.

  - Using AI monitoring in theFirebaseconsole.

  <!-- -->

  - Using the paid tier ofFirebase Authentication.

  - Using the paid tier of one of Firebase's database products.

- **Your chosenGemini APIprovider may incur costs.** For details, see[Gemini Developer APIpricing](https://ai.google.dev/gemini-api/docs/pricing).

  - Pricing is largely based on the model and features that you use.

  - Using some models (especially preview models) might require billing.

| **Tip:** If you're new to Firebase andGoogle Cloud, check if you're eligible for[$300 of credits](https://firebase.google.com/support/faq#pricing-free-trial)and a Free TrialCloud Billingaccount.

## Firebase pricing plan requirements for your chosen API provider

TheGemini Developer APIoffers different tiers for its pricing:

- **Gemini Developer API"free tier"** : This tier requires that your project is*not* linked to aCloud Billingaccount. This means your Firebase project is on the no-cost Spark pricing plan.

- **Gemini Developer API"paid tiers"** : These tiers require that your project is linked to aCloud Billingaccount. This means your Firebase project is on the pay-as-you-go Blaze pricing plan.

| **Important:** If your project is linked to aCloud Billingaccount (which means it's on the Blaze plan), then theGemini Developer APImakes all usage of its API be pay-as-you-go pricing (including any usage through theFirebase AI LogicSDKs).

Learn about the[Gemini Developer APIpricing](https://ai.google.dev/gemini-api/docs/pricing)in its documentation.

## Recommendations to manage costs

| When your project is on the Blaze pricing plan,[**set up budget alerts**](https://firebase.google.com/docs/projects/billing/avoid-surprise-bills#set-up-budget-alert-emails)using the console.
|
| Be aware that**budget alerts do*not*cap your usage or charges** --- they are*alerts* about your costs so that you can take action, if needed. For example, you might consider[using budget notifications to programmatically disableCloud Billingon a project](https://cloud.google.com/billing/docs/how-to/disable-billing-with-notifications).

We recommend doing the following to help manage your costs:

- When usingGeminimodels, get an estimate of the[token size](https://firebase.google.com/docs/ai-logic/count-tokens)of your requests using the Count Tokens API.

- Avoid surprise bills by[monitoring your costs and usage](https://firebase.google.com/docs/ai-logic/monitoring)and[setting up budget alerts](https://firebase.google.com/docs/projects/billing/avoid-surprise-bills#set-up-budget-alert-emails).