firebase-ai-logic
Client-side Gemini integration for web apps with multimodal inference, streaming, and on-device hybrid execution.
- Supports text-only and multimodal inputs (images, audio, video, PDFs); files over 20 MB route through Cloud Storage
- Includes chat sessions with automatic history, streaming responses for real-time display, and structured JSON output enforcement
- Offers hybrid on-device inference via Gemini Nano in Chrome, with automatic fallback to cloud execution
- Requires App Check for production security and supports dynamic model versioning through Remote Config to avoid redeployment
- Choose between Gemini Developer API (free tier, prototyping) or Vertex AI Gemini API (enterprise scale, requires Blaze plan)
Firebase AI Logic Basics
Overview
Firebase AI Logic is a product of Firebase that allows developers to add gen AI to their mobile and web apps using client-side SDKs. You can call Gemini models directly from your app without managing a dedicated backend. Firebase AI Logic, which was previously known as "Vertex AI for Firebase", represents the evolution of Google's AI integration platform for mobile and web developers.
It supports the two Gemini API providers:
- Gemini Developer API: It has a free tier ideal for prototyping, and pay-as-you-go for production
- Vertex AI Gemini API: Ideal for scale with enterprise-grade production readiness, requires Blaze plan
Use the Gemini Developer API as a default, and only Vertex AI Gemini API if the application requires it.
Setup & Initialization
Prerequisites
- Before starting, ensure you have Node.js 16+ and npm installed. Install them if they aren’t already available.
- Identify the platform the user is interested in building on prior to starting: Android, iOS, Flutter or Web.
- If their platform is unsupported, Direct the user to Firebase Docs to learn how to set up AI Logic for their application (share this link with the user https://firebase.google.com/docs/ai-logic/get-started)
More from firebase/agent-skills
firebase-basics
>-
50.9Kfirebase-auth-basics
Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.
50.5Kfirebase-hosting-basics
Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.
49.2Kfirebase-app-hosting-basics
Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.
49.0Kfirebase-data-connect
Builds and deploys Firebase SQL Connect (aka Firebase Data Connect) backends with PostgreSQL securely. Use when designing schemas with tables and relations, writing authorized queries and mutations, configuring real-time data updates, or generating type-safe SDKs. Use when you need a relational database with Firebase, or when the user mentions SQL Connect or Data Connect.
48.7Kdeveloping-genkit-js
Develop AI-powered applications using Genkit in Node.js/TypeScript. Use when the user asks about Genkit, AI agents, flows, or tools in JavaScript/TypeScript, or when encountering Genkit errors, validation issues, type errors, or API problems.
47.6K