All Gemini 1.0 and Gemini 1.5 models are now retired. To avoid service disruption, update to anewer model(for example,gemini-2.5-flash-lite).Learn more.
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 before retiring the model.
Where to find the retirement date of a model?
Here are some ways you can find the retirement date of a model:
At the time of release: We list each model's expected retirement date
several places in theGemini APIprovider documentation as well as in the
Firebase documentation
(see thesupported models page).
As the retirement date approaches: We send emails to appropriate
project members, and we post reminders in the release notes and other channels
about any upcoming retirements (for example,reminder of retirement datesfor the Gemini 1.5 and 1.0 stable models).
What to do if the model you're using is about to retire?
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, fine tuning a model, embeddings generation, semantic retrieval, and native audio?
The following features are supported by various models and the API providers,
butthey are not available when usingFirebase AI Logic:
Context caching
Fine tuning a model
Embeddings generation
Semantic retrieval
Native audio for theLive API
If you would like to add these as feature requests or vote on an existing
feature request, visitFirebase UserVoice.
For Swift apps on Apple platforms - What to do about the module name change fromFirebaseAItoFirebaseAILogic?
For Apple platform apps, starting with Firebase SDK v12.5.0,Firebase AI Logicis now distributed under theFirebaseAILogicmodule.
We've made this change non-breaking and backwards-compatible.
Why did we make this change?
We formerly distributed this service under theFirebaseAImodule. However, we
needed to rename it toFirebaseAILogicfor the following reasons:
Avoid a name collision between module and class that causes issues in binary
distributions.
Enable us to use Swift macros for future feature development.
What to do if you're upgrading to v12.5.0+?
The module name change toFirebaseAILogicis non-breaking and
backwards-compatible. However, eventually, we may remove the old module
alongside a future major Firebase SDK breaking change release(time frame currently undetermined).
There areno required changesfor this module name change, but werecommendthat you do the following:
When choosing Swift PM dependencies, chooseFirebaseAILogic(instead ofFirebaseAI).
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 in your app has
restrictions that prevent it from calling the required API.
To fix this, you need to update your API key's restrictions in theGoogle Cloudconsole to include the required API. ForFirebase AI Logic,
you must ensure theFirebase AI Logic API(firebasevertexai.googleapis.com) is included in the list of selected
APIs that can be called using the API key.
Select the API key that your application is configured to use (for example,
the "iOS key" for an iOS app).
On theEdit API keypage, find theAPI restrictionssection.
Ensure theRestrict keyoption is selected. If it isn't, your key is
unrestricted, and this is likely not the source of the error.
In theSelected APIsdrop-down menu, search for and select theFirebase AI Logic APIto add it to the list of selected
APIs that can be called using the API key.
ClickSave.
It may take up to five minutes for the changes to take effect.
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.
How do I fix the 404 error that says a model "was not found or your project does not have access to it"?
For example: "Publisher Model projects/PROJECT-ID/locations/us-central1/publishers/google/models/gemini-2.5-flash-image-preview was not found or your project does not have access to it. Please ensure you are using a valid model version."
There are a couple different reasons why you could get an error like this.
Invalid model name
Cause: The model name you've provided isn't a valid model name.
Fix: Check your model name and model version against the list of allsupported and available models.
Be sure to check the segments and their order in the model name.
For example, the "nano banana" model name isgemini-2.5-flash-image-previewnotgemini-2.5-flash-preview-image-generation.
Invalid location(only applicable if using theVertex AIGemini APIprovider and apreviewmodel)
Cause: You're using apreviewversion of a model
(for example,gemini-2.5-flash-image-preview), and you didn't specify thegloballocation.
If you use theVertex AIGemini API, all Gemini 2.5 and later
preview models released after June 2025 are only available in thegloballocation (including the preview version of "nano banana"). However, sinceFirebase AI Logicdefaults to theus-central1location, you need to explicitly
specify thegloballocation when initializing theVertex AIGemini APIbackend service in your code when using thesepreviewmodels.
Fix: When you initialize theVertex AIGemini APIservice,
specify the locationglobal. Learn more about how tospecify the location for accessing the model(including code snippets).
Invalid location(only applicable if using theVertex AIGemini APIprovider)
Cause: You're using a model that's not supported in the location where
you're trying to access it.
Imagenmodels arenotsupported in thegloballocation.
Gemini Live APImodels (likegemini-2.0-flash-live-preview-04-09) areonlysupported in theus-central1location.
Gemini 2.5 models (likegemini-2.5-pro) areonlyavailable in thegloballocation, the US locations, and some European locations
(and sometimes in other locations if your project has special
options).
[[["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-10-30 UTC."],[],[]]