This page provides answers to frequently asked questions (FAQs) and troubleshooting information about the Gemini API and the Firebase AI Logic SDKs. For additional questions, check out the Gemini API FAQ in the Google Cloud documentation.
General FAQ
Back in 2024, we launched a set of Firebase client SDKs that could use the Vertex AI Gemini API as well as a Firebase proxy gateway to protect that API from abuse and to enable integrations with other Firebase products. We called our product "Vertex AI in Firebase", and this product name accurately described our product's available use cases at that time.
Since then, though, we've expanded the capabilities of our product. For example, as of May 2025, we now offer support for the Gemini Developer API, including the ability to protect the Gemini Developer API from abuse using our integration with Firebase App Check.
As a result, the name "Vertex AI in Firebase" no longer accurately represents the expanded scope of our product. Thus, a new name — Firebase AI Logic — better reflects our evolving feature set and allows us to continue to expand our offerings in the future!
Check out the migration guide to make sure you get all the latest features from Firebase AI Logic (and optionally start using the Gemini Developer API).
Here are some differences between the two "Gemini API" providers in general regardless of how you access them:
-
The Gemini Developer API offers a "free tier" along with pay-as-you-go pricing.
The Vertex AI Gemini API when used with Firebase AI Logic always requires the pay-as-you-go Blaze pricing plan.
Note that the two API providers have different pay-as-you-go pricing (learn more in their respective documentation).
-
The Gemini Developer API has explicit rate limits.
The Vertex AI Gemini API uses "dynamic shared quota (DSQ)" that everyone using that model in that region shares. You can also optionally set up provisioned throughput (PT).
Specifying the location for accessing the model
- Only the Vertex AI Gemini API lets you to choose the location where you access the model.
The following table lists the availability of commonly asked about features for the two "Gemini API" providers. This table applies specifically when using the Firebase AI Logic client SDKs.
Feature | Gemini Developer API | Vertex AI Gemini API |
---|---|---|
Support for Gemini models | all Gemini models supported | all Gemini models supported |
Support for Imagen models |
Imagen 3 models supported
(not yet for Unity) |
Imagen 3 models supported
(not yet for Unity) |
Support for Veo models | not supported yet | not supported yet |
Image generation using Gemini models | supported | supported |
Support for the Gemini Live API | not supported yet |
supported
(Android, Flutter, and Unity only) |
Integration with Firebase App Check | supported | supported |
Compatible with Firebase Remote Config | supported | supported |
Support for AI monitoring in Firebase console | not supported yet | supported |
Support for Cloud Storage URLs | not supported yet 1 |
Public files and files protected by Firebase Security Rules |
Support for YouTube URLs and Browser URLs | YouTube URLs only | YouTube URLs and Browser URLs |
1 The Files API for the Gemini Developer API is not supported through the Firebase AI Logic SDKs.
Yes, you can have both "Gemini API" providers enabled in your Firebase project, and you can use both APIs in your app itself.
To switch between API providers in your code, just make sure that you've set the backend service appropriately in your code.
Select your Gemini API provider to view provider-specific content |
To use the Firebase AI Logic SDKs with the Gemini Developer API, your project must have the following two APIs enabled:
- Gemini Developer API (
generativelanguage.googleapis.com
) - Firebase AI Logic API (
firebasevertexai.googleapis.com
)
You should enable these two APIs using the Firebase console:
In the Firebase console, go to the Firebase AI Logic page.
Click Get started.
Select to get started with the Gemini Developer API.
This launches a guided workflow that enables the two APIs for you. The console will also generate a Gemini API key, as well as add the Firebase AI Logic API to the allowlist for your Firebase API key.
You can use any of the Gemini and Imagen 3 foundation models with the Firebase AI Logic SDKs, including preview and experimental versions. See a list of these models in Learn about supported models.
You cannot use non-foundation Gemini models (like PaLM models, tuned models, or Gemma-based models) with the Firebase AI Logic SDKs.
Firebase AI Logic also doesn't support older Imagen models or
imagen-3.0-capability-001
.The Gemini Developer API (regardless of how it's accessed) does not support
imagen-3.0-fast-generate-001
or the olderimagen-3.0-generate-001
.
We frequently add new capabilities to the SDKs, so check back on this FAQ for updates (as well as in release notes, blogs, and social posts).
When we release a stable model version, we strive to ensure that it's available for at minimum one year. We list this "retirement date" several places in Firebase and Google Cloud documentation (for example, in the "Models" page).
When a model is retired, any requests to that model will fail with a 404 error. For this reason, we strongly recommend setting up and using Firebase Remote Config so that you can dynamically change the model and version in your app without releasing a new version of your app.
When you update your app to use a new model version, we recommend testing your app to ensure that responses are still as expected. Note that when using Firebase AI Logic, there's usually no modification needed for any of the code which actually calls to the model.
Here are the retirement dates for various models:
Gemini 1.5 Pro models:
gemini-1.5-pro-002
(andgemini-1.5-pro
): September 24, 2025gemini-1.5-pro-001
: May 24, 2025
Gemini 1.5 Flash models:
gemini-1.5-flash-002
(andgemini-1.5-flash
): September 24, 2025gemini-1.5-flash-001
: May 24, 2025
Gemini 1.0 Pro Vision models: April 21, 2025 (previously scheduled for April 09, 2025)
Gemini 1.0 Pro models: April 21, 2025 (previously scheduled for April 09, 2025)
By default, Firebase AI Logic sets the request limit per user at 100 requests per minute (RPM).
If you want to adjust your per-user rate limit, you need to adjust the quota settings for the Firebase AI Logic API.
Learn more about the Firebase AI Logic API quota. On that page, you can also learn how to view and edit your quota.
Action | Required IAM permissions | IAM role(s) that include required permissions by default |
---|---|---|
Upgrade billing to pay-as-you-go (Blaze) pricing plan | firebase.billingPlans.update resourcemanager.projects.createBillingAssignment resourcemanager.projects.deleteBillingAssignment
|
Owner |
Enable APIs in project | serviceusage.services.enable |
Editor Owner |
Create Firebase app | firebase.clients.create |
Firebase Admin Editor Owner |
See Data governance & Responsible AI.
Yes, in each multimodal request, you must always provide the following:
The file's
mimeType
. See an exception below.The file. You can either provide the file as inline data or provide the file using its URL.
Learn about supported input file types, how to specify MIME type, and the two options for providing the file in Supported input files and requirements.
Exception to including MIME type in your request
An exception to providing the MIME type is inline image inputs for requests from native Android and Apple platform apps.
The Firebase AI Logic SDKs for Android and Apple platforms provide a simplified and platform-friendly way to handle images in requests — all images (no matter their format) are converted client-side to JPEG at 80% quality before being sent to the server. This means that when you provide images as inline data using the Android and Apple platforms SDKs, you don't need to specify the MIME type in the request.
This simplified handling is shown in the Firebase AI Logic documentation in the examples for sending base64-encoded images in requests.
Here's some additional platform-specific information about this feature:
For Android:
You can take advantage of the simplified way to handle platform-native image types (
Bitmap
) in multimodal prompts that contain images as inline data (see example).For more control over image formats and conversions, you may provide the images as an
InlineDataPart
and supply the specific MIME type. For example:content { inlineData(/* PNG as byte array */, "image/png") }
For Apple platforms:
You can take advantage of the simplified way to handle platform-native image types (
UIImage
,NSImage
,CIImage
, andCGImage
) in multimodal prompts that contain images as inline data (see example).For more control over image formats and conversions, you may provide the images as an
InlineDataPart
and supply the specific MIME type. For example:InlineDataPart(data: Data(/* PNG Data */), mimeType: "image/png")
Context caching, Search as a tool, grounding with Google Search, code execution, fine tuning a model, embeddings generation, and semantic retrieval are supported by various models or the Vertex AI Gemini API, but they are not available when using Firebase AI Logic.
If you would like to add these as feature requests or vote on an existing feature request, visit Firebase UserVoice.
Gemini API key FAQ
These FAQ are only applicable if you're using the Gemini Developer API.
The Gemini Developer API uses a "Gemini API key" to authorize the caller. So, if you're using the Gemini Developer API through the Firebase AI Logic SDKs, then you need a valid Gemini API key in your Firebase project to make calls to that API.
A "Gemini API key" just means an API key that has the Gemini Developer API in its API allowlist.
When you go through the Firebase AI Logic setup workflow in the Firebase console, we create a Gemini API key that's restricted to only the Gemini Developer API, and we set up the Firebase AI Logic proxy service to use this API key. This Firebase-generated Gemini API key is named Gemini Developer API key (auto created by Firebase) in the credentials page of the Google Cloud console.
Learn more about API restrictions for API keys.
You do not add your Gemini API key to your app's codebase when using the Firebase AI Logic SDKs. Learn more about how to keep your Gemini API key secure.
When using the Firebase AI Logic SDKs, do not add your Gemini API key into your app's codebase.
In fact, while developing with the Firebase AI Logic SDKs, you don't directly interact with your Gemini API key. Instead, our Firebase AI Logic proxy service will internally include the Gemini API key in each request to the Gemini Developer API — completely in the backend.
When using the Firebase AI Logic SDKs, it's unlikely that you'll need to change your Gemini API key. However, here are two cases where you might need to:
If you accidentally leaked the key and want to replace it with a new secure key.
If you accidentally deleted the key. Note that you can undelete the key within 30 days of deletion.
Here's how you change the Gemini API key that's used by the Firebase AI Logic SDKs:
If your Firebase-generated Gemini API key still exists, delete it.
You can delete this API key in the APIs & Services > Credentials panel of the Google Cloud console. It's named:
Gemini Developer API key (auto created by Firebase).In that same page of the Google Cloud console, create a new API key. We suggest naming it something like:
Gemini Developer API key for Firebase.To this new API key, add API restrictions and only select Generative Language API.
"Generative Language API" is what the Gemini Developer API is sometimes called in the Google Cloud console.Do not add any app restrictions; otherwise the Firebase AI Logic proxy service won't work as expected.
Run the following command to set this new key as the Gemini API key that the Firebase AI Logic proxy service should use.
PROJECT_ID="PROJECT_ID" GENERATIVE_LANGUAGE_API_KEY="DEVELOPER_CREATED_GEMINI_API_KEY" curl \ -X PATCH \ -H "x-goog-user-project: ${PROJECT_ID}" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ "https://firebasevertexai.googleapis.com/v1beta/projects/${PROJECT_ID}/locations/global/config" \ -d "{\"generativeLanguageConfig\": {\"apiKey\": \"${GENERATIVE_LANGUAGE_API_KEY}\"}}"
Learn about the gcloud CLI.
Make sure to not add this new Gemini API key to your app's codebase. Learn more about how to keep your Gemini API key secure.
No — you should not use your "Firebase API key" as your Gemini API key. We strongly recommend that you do not add the Gemini Developer API to the allowlist for your Firebase API key.
Your Firebase API key is the API key that's listed in your Firebase configuration file or object that you add into your app's codebase to connect your app to Firebase. It's OK to include your Firebase API key in your code when you use the key only with Firebase-related APIs (like Firebase AI Logic). Learn important information about Firebase API keys.
In the APIs & Services > Credentials panel of the Google Cloud console, this is what Firebase API keys look like:
Because you need to add your Firebase API key into your app's codebase for Firebase-related APIs to work, and because the Gemini Developer API is authorized via API key, we strongly recommend that you do NOT add the Gemini Developer API (called the "Generative Language API" in the Google Cloud console) to the API allowlist for your Firebase API key. If you do, then you're exposing the Gemini Developer API to potential abuse.
This FAQ describes some recommended best practices to keep your Gemini API key secure.
If you're calling the Gemini Developer API directly from your mobile or web app:
- Use the Firebase AI Logic client SDKs.
- Do not add your Gemini API key into your app's codebase.
Firebase AI Logic provides a proxy service that internally includes your Gemini API key in each request to the Gemini Developer API — completely in the backend.
Additionally, we strongly recommend the following:
As soon as you start seriously developing your app, integrate with Firebase App Check to help protect your backend resources as well as the APIs used to access generative models.
Do not reuse the Firebase-generated Gemini API key outside of Firebase AI Logic. If you need a Gemini API key for another use case, create a separate key.
In general, you should NOT modify the Firebase-generated Gemini API key. This key is named Gemini Developer API key (auto created by Firebase) in the Google Cloud console.
Do not add any additional APIs to the API allowlist for your Firebase-generated Gemini API key. In its API allowlist, your Gemini API key should only have the Gemini Developer API (called the "Generative Language API" in the Google Cloud console).
Do not add any app restrictions; otherwise the Firebase AI Logic proxy service won't work as expected.
If your Gemini API key has been compromised, follow the instructions to change the Gemini API key that's used to call the Gemini Developer API.
Also, review the recommended best practices to keep your Gemini API key secure.
Troubleshoot errors
If you're attempting to use the Gemini Developer API and you receive a
404 error that says Firebase AI Logic genai config not found
, it usually means
that your Firebase project doesn't have a valid Gemini API key for use
with the Firebase AI Logic client SDKs.
Here are the most likely causes of this error:
You haven't yet set up your Firebase project for the Gemini Developer API.
What to do:
In the Firebase console, go to the Firebase AI Logic page. Click Get started, and then select the Gemini Developer API. Enable the API, and the console will set up your project for the Gemini Developer API. After completing the workflow, try your request again.If you very recently went through the Firebase AI Logic setup workflow in the Firebase console, then your Gemini API key might not yet be available to all required backend services in all regions.
What to do:
Wait a few minutes, and then try your request again.Your Gemini API key might have been deleted from your Firebase project.
What to do:
Learn how to change the Gemini API key used by Firebase AI Logic.
If you're trying to send a multimodal request with a Cloud Storage for Firebase
URL, you might encounter the following 400 error:
Service agents are being provisioned ... Service agents are needed to read the Cloud Storage file provided.
This error is caused by a project that didn't have the required service agents correctly auto-provisioned when the Vertex AI API was enabled in the project. This is a known issue with some projects, and we're working on a global fix.
Here's the workaround to fix your project and correctly provision these service agents so that you can start including Cloud Storage for Firebase URLs in your multimodal requests. You must be an Owner on the project, and you only need to complete this set of tasks once for your project.
Access and authenticate with the gcloud CLI.
The easiest way to do this is from Cloud Shell. Learn more in the Google Cloud documentation.If prompted, follow the instructions displayed in the terminal to make the gcloud CLI run against your Firebase project.
You'll need your Firebase project ID, which you can find at the top of the Project settings in the Firebase console.
Provision the required service agents in your project by running the following command:
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/endpoints -d ''
Wait a few minutes to ensure that the service agents are provisioned, and then retry sending your multimodal request that includes the Cloud Storage for Firebase URL.
If you're still getting this error after waiting several minutes, reach out to Firebase Support.
If you receive a 400 error that says
API key not valid. Please pass a valid API key.
, it usually means that the
API key in your Firebase configuration file/object doesn't exist or isn't setup
to be used with your app and/or Firebase project.
Check that the API key listed in your Firebase configuration file/object matches the API key for your app. You can view all your API keys in the APIs & Services > Credentials panel in the Google Cloud console.
If you discover that they don't match, then obtain a fresh Firebase configuration file/object, and then replace the one that's in your app. The fresh config file/object should contain a valid API key for your app and Firebase project.
If you receive a 403 error that says
Requests to this API firebasevertexai.googleapis.com ... are blocked.
,
it usually means that the API key in your Firebase configuration file/object
doesn't have a required API in its allowlist for the product that you're trying
to use.
Make sure that the API key used by your app has all the required APIs included in the key's "API restrictions" allowlist. For Firebase AI Logic, your API key needs to have at minimum the Firebase AI Logic API in its allowlist.
You can view all your API keys in the APIs & Services > Credentials panel in the Google Cloud console.
If you receive a 403 error that says
PERMISSION_DENIED: The caller does not have permission.
, it usually means that
the API key in your Firebase configuration file/object belongs to a different
Firebase project.
Check that the API key listed in your Firebase configuration file/object matches the API key for your app. You can view all your API keys in the APIs & Services > Credentials panel in the Google Cloud console.
If you discover that they don't match, then obtain a fresh Firebase configuration file/object, and then replace the one that's in your app. The fresh config file/object should contain a valid API key for your app and Firebase project.
Give feedback about your experience with Firebase AI Logic