Stay organized with collectionsSave and categorize content based on your preferences.
This page provides answers to frequently asked questions (FAQs) and
troubleshooting information about theGemini APIand theFirebase AI Logic SDKs. For additional questions, check out theGemini APIFAQin theGoogle Clouddocumentation.
Why did the name change from "Vertex AI in Firebase" to "Firebase AI Logic"?
Back in 2024, we launched a set of Firebase client SDKs that could use theVertex AIGemini APIas 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 theGemini Developer API,
including the ability to protect theGemini Developer APIfrom abuse
using our integration withFirebase 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 themigration guideto make sure you get all the latest features fromFirebase AI Logic(and
optionally start using theGemini Developer API).
What are the differences between using theGemini Developer APIand theVertex AIGemini API?
The following table lists important differences between the two
"Gemini API" providersin general regardless of how you access them:
Public files and files protected byFirebase Security Rules
Support for YouTube URLs and Browser URLs
YouTube URLs only
YouTube URLs and Browser URLs
1The two API providers have different pay-as-you-go pricing
(learn more in their respective documentation).
2TheFiles APIfor theGemini Developer APIis not supported through theFirebase AI Logic SDKs.
The following table lists the availability of commonly asked about features for
the two "Gemini API" providers. This table appliesspecifically when
using theFirebase AI Logicclient SDKs.
Select to get started with theGemini Developer API.
This launches a guided workflow that enables the two APIs for you. The
console will also generate aGeminiAPI key, as well as add theFirebase AI Logic API to the allowlist for your
Firebase API key.
Which models can be used with theFirebase AI Logic SDKs?
Seelists of supported models.
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).
Gemini Developer API
BothGeminiandImagenfoundation models.
Note that theGemini Developer API(regardless of how it's
accessed) only supportsspecific stableImagenmodels.
Vertex AIGemini API
BothGeminiandImagenfoundation models.
Regardless of your chosenGemini APIprovider
Firebase AI Logicdoesnotsupport the following:
Non-foundationGeminimodels
(like PaLM models, tuned models, or Gemma-based models).
OlderImagenmodels orimagen-3.0-capability-001.
What to do when models are retired?
When we release a stable model version, we strive to ensure that it's available
forat minimumone year. We list this "retirement date" several places in
Firebase andGemini APIprovider documentation (for example, in the"Models" page of the Firebase documentation).
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 usingFirebase Remote Configso that you candynamically change the model and version in your appwithout 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 usingFirebase AI Logic, there'susuallyno modification needed for any of the
code which actually calls to the model.
Here are the retirement dates for various stable models:
Gemini 1.5 Promodels:
gemini-1.5-pro-002(andgemini-1.5-pro): September 24, 2025
gemini-1.5-pro-001: May 24, 2025
Gemini 1.5 Flashmodels:
gemini-1.5-flash-002(andgemini-1.5-flash): September 24, 2025
gemini-1.5-flash-001: May 24, 2025
Gemini 1.0 Pro Visionmodels: April 21, 2025(previously scheduled for April 09, 2025)
Gemini 1.0 Promodels: April 21, 2025(previously scheduled for April 09, 2025)
How do I set a per-user rate limit?
By default,Firebase AI Logicsets 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 theFirebase AI Logic API.
Learn more about theFirebase AI Logic API quota.
On that page, you can also learn how to view and edit your quota.
Which permissions are required to use theFirebase AI Logic SDKs?
Action
Required IAM permissions
IAM role(s) that include required permissions by default
Upgrade billing to pay-as-you-go (Blaze) pricing plan
An exception to providing the MIME type is inline image inputs for
requests from native Android and Apple platform apps.
TheFirebase 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 thatwhen you provideimages as inline datausing the Android and Apple platforms SDKs, you don't
need to specify the MIME type in the request.
This simplified handling is shown in theFirebase AI Logicdocumentation 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
(seeexample).
For more control over image formats and conversions, you may provide the
images as anInlineDataPartand 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
(seeexample).
For more control over image formats and conversions, you may provide the
images as anInlineDataPartand supply the specific MIME type.
For example:
InlineDataPart(data: Data(/* PNG Data */), mimeType: "image/png")
Are these features available when usingFirebase AI Logic? Context caching, code execution, fine tuning a model, embeddings generation, and semantic retrieval?
The following features are supported by various models and the API providers,
butthey are not available when usingFirebase AI Logic:
Context caching
Code execution
Fine tuning a model
Embeddings generation
Semantic retrieval
If you would like to add these as feature requests or vote on an existing
feature request, visitFirebase UserVoice.
GeminiAPI key FAQ
These FAQ are only applicable if you're using theGemini Developer API.
What's aGeminiAPI key?
TheGemini Developer APIuses a "GeminiAPI key" to authorize
the caller. So, if you're using theGemini Developer APIthrough theFirebase AI Logic SDKs, then you need a validGeminiAPI key
in your Firebase project to make calls to that API.
A "GeminiAPI key" just means an API key that has theGemini Developer APIin its API allowlist.
When you go through theFirebase AI Logicsetup workflowin theFirebaseconsole, we create aGeminiAPI key that's
restricted to only theGemini Developer API, and we set up theFirebase AI Logicproxy service to use this API key. This Firebase-generatedGeminiAPI key is namedGemini Developer API key (auto created by Firebase)in the credentials page of
theGoogle Cloudconsole.
You donotadd yourGeminiAPI key to your app's codebase when
using theFirebase AI Logic SDKs. Learn more about how tokeep yourGeminiAPI key secure.
Should I add myGeminiAPI key into my mobile or web app's codebase?
When using theFirebase AI Logic SDKs, donotadd yourGeminiAPI key into your app's codebase.
In fact, while developing with theFirebase AI Logic SDKs, you don't
directly interact with yourGeminiAPI key. Instead, ourFirebase AI Logicproxy service will internally include theGeminiAPI key in each request to theGemini Developer API—
completely in the backend.
How can I change theGeminiAPI key used to call theGemini Developer API?
When using theFirebase AI Logic SDKs, it's unlikely that you'll need
to change yourGeminiAPI 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 canundelete the keywithin 30 days of deletion.
Here's how you change theGeminiAPI key that's used by theFirebase AI Logic SDKs:
If your Firebase-generatedGeminiAPI key still exists, delete it.
You can delete this API key in theAPIs & Services>Credentialspanelof theGoogle Cloudconsole. It's named: Gemini Developer API key (auto created by Firebase).
In that same page of theGoogle Cloudconsole,create a new API key.We suggest naming it something like: Gemini Developer API key for Firebase.
To this new API key,add API restrictionsand only selectGenerative Language API. "Generative Language API" is what theGemini Developer APIis
sometimes called in theGoogle Cloudconsole.
Donotadd anyapp restrictions;
otherwise theFirebase AI Logicproxy service won't work as expected.
Run the following command to set this new key as theGeminiAPI key
that theFirebase AI Logicproxy service should use.
Make sure tonotadd this newGeminiAPI key to your app's
codebase. Learn more about how tokeep yourGeminiAPI key secure.
Can I use my "Firebase API key" as myGeminiAPI key?
No — you shouldnotuse your "Firebase API key" as yourGeminiAPI key. We strongly recommend that you donotadd theGemini Developer APIto 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
codewhen you use the key only with Firebase-related APIs
(likeFirebase AI Logic).Learn important information about Firebase API keys.
Because you need to add your Firebase API key into your app's codebase for
Firebase-related APIs to work, and because theGemini Developer APIisauthorizedvia API key,we strongly recommend that you do NOT add theGemini Developer API(called the "Generative Language API" in theGoogle Cloudconsole) to the API allowlist for your Firebase API key. If you
do, then you're exposing theGemini Developer APIto potential abuse.
How do I keep myGeminiAPI key secure?
This FAQ describes some recommended best practices to keep yourGeminiAPI key secure.
If you're calling theGemini Developer APIdirectly from your
mobile or web app:
Use theFirebase AI Logicclient SDKs.
Donotadd yourGeminiAPI key into your app's codebase.
Firebase AI Logicprovides a proxy service that internally includes yourGeminiAPI key in each request to theGemini Developer API—
completely in the backend.
Additionally, we strongly recommend the following:
As soon as you start seriously developing your app,integrate withFirebase App Checkto help
protect your backend resources as well as the APIs used to access generative
models.
Donotreuse the Firebase-generatedGeminiAPI key outside ofFirebase AI Logic. If you need aGeminiAPI key for another use
case, create a separate key.
In general, you should NOT modify the Firebase-generatedGeminiAPI key. This key is namedGemini Developer API key (auto created by Firebase)in theGoogle Cloudconsole.
Donotadd any additional APIs to the API allowlist for your
Firebase-generatedGeminiAPI key. In its API allowlist, yourGeminiAPI key shouldonlyhave theGemini Developer API(called the "Generative Language API" in theGoogle Cloudconsole).
Donotadd anyapp restrictions;
otherwise theFirebase AI Logicproxy service won't work as expected.
MyGeminiAPI key was compromised. What do I need to do?
If yourGeminiAPI key has been compromised, follow the instructions tochange theGeminiAPI keythat's used to call theGemini Developer API.
How do I fix this 404 error?Firebase AI Logic genai config not found
If you're attempting to use theGemini Developer APIand you receive a
404 error that saysFirebase AI Logic genai config not found, it usually means
that your Firebase project doesn't have a validGeminiAPI key for use
with theFirebase AI Logicclient SDKs.
Here are the most likely causes of this error:
You haven't yet set up your Firebase project for theGemini Developer API.
What to do: In theFirebaseconsole, go to theFirebase AI Logicpage. ClickGet started, and then select theGemini Developer API. Enable
the API, and the console will set up your project for theGemini Developer API. After completing the workflow, try your request
again.
If you very recently went through theFirebase AI Logicsetup workflow
in theFirebaseconsole, then yourGeminiAPI 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.
YourGeminiAPI key might have been deleted from your
Firebase project.
How do I fix this 400 error?Service agents are being provisioned ... Service agents are needed to read the Cloud Storage file provided.
If you're trying to send a multimodal request with aCloud Storage for FirebaseURL, 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 theVertex 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 includingCloud Storage for FirebaseURLs in your
multimodal requests. You must be anOwneron the project, and you only need to
complete this set of tasks once for your project.
Access and authenticate with thegcloud CLI. The easiest way to do this is fromCloud Shell. Learn more in theGoogle Clouddocumentation.
If prompted, follow the instructions displayed in the terminal to make thegcloud CLIrun against your Firebase project.
You'll need your Firebase project ID, which you can find at the top of thesettingsProject settingsin theFirebaseconsole.
Provision the required service agents in your project by running the
following command:
Wait a few minutes to ensure that the service agents are provisioned, and
then retry sending your multimodal request that includes theCloud Storage for FirebaseURL.
If you're still getting this error after waiting several minutes, reach out toFirebase Support.
How do I fix this 400 error?API key not valid. Please pass a valid API key.
If you receive a 400 error that saysAPI 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 theAPIs & Services>Credentialspanel in theGoogle Cloudconsole.
If you discover that they don't match, thenobtain a fresh Firebase configuration file/object,
and thenreplacethe one that's in your app. The fresh config file/object
should contain a valid API key for your app and Firebase project.
How do I fix this 403 error?Requests to this API firebasevertexai.googleapis.com ... are blocked.
If you receive a 403 error that saysRequests 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.
How do I fix this 403 error?PERMISSION_DENIED: The caller does not have permission.
If you receive a 403 error that saysPERMISSION_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 theAPIs & Services>Credentialspanel in theGoogle Cloudconsole.
If you discover that they don't match, thenobtain a fresh Firebase configuration file/object,
and thenreplacethe one that's in your app. The fresh config file/object
should contain a valid API key for your app and Firebase project.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-05 UTC."],[],[],null,[]]