The latest Gemini models, likeGemini 3.1 Flash Image(Nano Banana 2), are available to use with Firebase AI Logic!Learn more.
Gemini 2.0 Flash and Flash-Lite models will shut down onJune 1, 2026. To avoid service disruption, update to a newer model likegemini-2.5-flash-lite.Learn more.
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.
How do I disable APIs in my Firebase project?
ForFirebase AI Logic, we try to make setup of your Firebase project to use
your chosenGemini APIprovider as easy as possible. This includes enabling
therequired APIsin your Firebase project during specific journeys, like the guided workflow in
theFirebaseconsole.
However, if you decide to not useFirebase AI Logicor one of theGemini APIproviders, you can disable the associated APIs in your
Firebase project.
Disable APIs associated with usingGemini Developer API
To use theFirebase AI Logic SDKs with theGemini Developer API, your project must have the following two APIs
enabled:
If you want to stop usingFirebase AI Logiccompletely:
Click each API link above to go to the respective API pages in theGoogle Cloudconsole, then clickManage.
View theMetricstab to verify that there's no usage of the API.
If you still want to disable the API, clickDisable APIat the top of
the page.
Remove theFirebase AI Logic API from the list of selected
APIs that can be called using your Firebase API keys. Reviewthis FAQ about the allowlist for Firebase API keysto learn about modifying this list.
If you want to continue usingFirebase AI Logic, but with theVertex AIGemini APIinstead:
If you want to stop usingFirebase AI Logiccompletely:
Click each API link above to go to the respective API pages in theGoogle Cloudconsole, then clickManage.
View theMetricstab to verify that there's no usage of the API.
If you still want to disable the API, clickDisable APIat the top of
the page.
Remove theFirebase AI Logic API from the list of selected
APIs that can be called using your Firebase API keys. Reviewthis FAQ about the allowlist for Firebase API keysto learn about modifying this list.
If you want to continue usingFirebase AI Logic, but with theGemini Developer APIinstead:
Go to theVertex AI APIpage in theGoogle Cloudconsole, then clickManage.
View theMetricstab to verify that there's no usage of the API.
If you still want to disable the API, clickDisable APIat the top of
the page.
Make sure that your project has therequired APIs enabledfor theGemini Developer API.
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 shut down (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 shutdown date of a model?
Here are some ways you can find the shutdown date of a model:
At the time of release: We list each model's expected shutdown date
several places in theGemini APIprovider documentation as well as in the
Firebase documentation
(see thesupported models page).
As the shutdown date approaches: Google sends emails to appropriate
project members, and we post reminders in the release notes and other channels
about any upcoming shutdowns (for example,reminder of shutdown datesfor the Gemini 1.5 and 1.0 stable models).
What to do if the model you're using is about to be shut down?
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.
How do I reduce latency and high token usage?
If you're experiencing high latency or high token usage, it's likely due to thethinking levelconfigurationfor the model you're using.
Gemini 3and later models always use an internal "thinking process"
that significantly improves their reasoning and multi-step planning abilities,
making them highly effective for complex tasks such as coding, advanced
mathematics, and data analysis.
However, depending on the task, higher levels of thinking aren't always needed,
and you can configure the model to use a lower thinking level.A lower
thinking level will help reduce latency and token usage.To help you decide
how much a model might need its thinking capability, review thecomparison of task difficulties.
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: grounding with Google Image Search, grounding with Google Maps, 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:
Grounding with Google Image Search
Grounding with Google Maps
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.
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).
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.
[[["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 2026-04-20 UTC."],[],[]]