Gemini API using Vertex AI in Firebase

Build AI-powered mobile and web apps and features with the Gemini and Imagen models using Vertex AI in Firebase

Vertex AI in Firebase gives you access to the latest generative AI models from Google: the Gemini models and Imagen 3 models.

If you need to call the Vertex AI Gemini API or Imagen API directly from your mobile or web app – rather than server-side — you can use the Vertex AI in Firebase SDKs. These client SDKs are built specifically for use with mobile and web apps, offering security options against unauthorized clients as well as integrations with other Firebase services.

With these client SDKs, you can add AI personalization to your app, build an AI chat experience, create AI-powered optimizations and automation, and much more!


Ready to get started? Choose your platform:

iOS+ Android Web Flutter

If you're looking for ways to access the Gemini or Imagen models server-side (like with Python, Node.js, or Go), check out the server-side Vertex AI SDKs, Firebase Genkit, or Firebase Extensions for the Gemini API.

Key capabilities

Multimodal and natural language input The Gemini models are multimodal, so prompts sent to the Gemini API can include text, images, PDFs, video, and audio.

Both the Gemini and Imagen models can be prompted with natural language input.

Growing suite of capabilities With the SDKs, you can call the Gemini API or Imagen API directly from your mobile or web app to build AI chat experiences, generate images, use function calling (tools), and more.
Security and abuse prevention for production apps Use Firebase App Check to protect the APIs that access the Gemini and Imagen models from abuse by unauthorized clients.

Vertex AI in Firebase also has rate limits per user by default, and these per-user rate limits are fully configurable.

Robust infrastructure Take advantage of scalable infrastructure that's built for use with mobile and web apps, like managing files with Cloud Storage for Firebase, managing structured data with Firebase database offerings (like Cloud Firestore), and dynamically setting run-time configurations with Firebase Remote Config.

How does it work?

The Vertex AI in Firebase SDKs allow you to call the Vertex AI Gemini API and Imagen API directly from your mobile or web app removing the need to set up a backend.

Learn more about the Gemini API from Vertex AI, which gives you access to the Gemini models.

Implementation path

Connect your app to Firebase Register your app with your Firebase project, and then add your Firebase configuration to your app.
Install the SDK and initialize Install the Vertex AI in Firebase SDK that's specific to your app's platform, and then initialize the Vertex AI service and the generative model in your app.
Send prompt requests to the Gemini and Imagen models Use the SDKs to send text-only or multimodal prompts to the Gemini model to generate text, code, and (coming soon!) image and audio output. Alternatively, you can prompt an Imagen model to generate images.

Use more complex calls to build chat experiences or use function calling.

Prepare for production Implement important integrations for mobile and web apps, like protecting the API from abuse with Firebase App Check and including large files in requests using Cloud Storage for Firebase URLs.

Next steps

Get started with accessing a model from your mobile or web app

iOS+ setup Android setup Web setup Flutter setup

Experiment with prompts

Go to Vertex AI Studio

Learn more about the supported models

Learn about the models available for various use cases and their quotas and pricing.