/firebase-ai-logic-basics
Integrates Firebase AI Logic (formerly Vertex AI for Firebase) into mobile and web apps (Android, iOS, Web, and Flutter) to call Gemini models from client code. Use when provisioning or initializing Firebase AI Logic, or adding Gemini features to an app: text generation,
Claude Code
$ npx -y skills add firebase/agent-skills --skill firebase-ai-logic-basics --agent claude-code
Codex
$ npx skills add firebase/agent-skills --skill firebase-ai-logic-basics -a codex -y
Cursor
$ npx skills add firebase/agent-skills --skill firebase-ai-logic-basics -a cursor -y
Gemini CLI
$ npx skills add firebase/agent-skills --skill firebase-ai-logic-basics -a gemini-cli -y
GitHub Copilot
$ npx skills add firebase/agent-skills --skill firebase-ai-logic-basics -a github-copilot -y
OpenCode
$ npx skills add firebase/agent-skills --skill firebase-ai-logic-basics -a opencode -y
Windsurf
$ npx skills add firebase/agent-skills --skill firebase-ai-logic-basics -a windsurf -y
SKILL.md
firebase-ai-logic-basics.SKILL.mdname: firebase-ai-logic-basics
description: >-
Integrates Firebase AI Logic (formerly Vertex AI for Firebase) into mobile and web apps (Android, iOS, Web, and Flutter) to call Gemini models from client code. Use when provisioning or initializing Firebase AI Logic, or adding Gemini features to an app: text generation, multimodal input, chat, streaming, structured output, hybrid on-device inference, App Check protection, or switching models with Remote Config.
version: 1.0.1
metadata:
author: Google LLC
category: AiAndMachineLearning
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. The app can directly call Gemini models via Firebase AI Logic without the developer needing to manage a dedicated backend. Firebase AI Logic was previously known as "Vertex AI for Firebase".
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
- **Agent Platform Gemini API** (formerly branded Vertex AI): Ideal for scale
with enterprise-grade production readiness, requires Blaze pricing plan
Use the Gemini Developer API as a default, and only Agent Platform Gemini API (formerly branded Vertex AI) if the application requires it.
______________________________________________________________________
Setup & initialization
Prerequisites
- Identify the platform the user is interested in building on prior to starting:
Android, iOS, Web, or Flutter.
- 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)
- The Firebase CLI commands below run through `npx` on every platform, so they
need **Node.js 20+** and npm. Use the `firebase-basics` skill to check for them and to log in to the Firebase CLI. If Node.js is missing or older than version 20, ask the user to install it as that skill describes. Don't install system packages yourself, for example with `sudo apt-get`, because that changes the user's machine without their consent.
1. Provision Firebase AI Logic (ALL platforms)
Use the **Firebase CLI** to provision Firebase AI Logic for the Firebase Project:
1. Make sure that you're in a firebase directory (with a `firebase.json`).
1. Verify that you're running Firebase CLI commands against the intended Firebase Project. When you run this command, the active project is marked with "current":
npx -y firebase-tools@latest projects:list
1. Make sure there's at least one Firebase App for the target platform registered with the current Firebase Project:
npx -y firebase-tools@latest apps:list
1. Provision Firebase AI Logic for the Firebase Project:
npx -y firebase-tools@latest init ailogic
This command will enable the Gemini Developer API in the Firebase project.
> [!WARNING] **CRITICAL: Provisioning Firebase AI Logic is Required** For all > platforms (Android, iOS, Web, or Flutter), even if the app already uses > Firebase, you MUST run `npx -y firebase-tools@latest init ailogic` to > provision the service. The configuration files of `GoogleService-Info.plist`, > `google-services.json`, and `firebase_options.dart` ONLY handle client > configuration and do NOT enable the Firebase AI Logic service, leading to > `PERMISSION_DENIED` errors.
If you can't run `init ailogic` yourself (for example because Node.js is missing or the Firebase CLI isn't logged in) do NOT skip it. The app's requests to Gemini models will fail until the Firebase AI Logic service is provisioned. Tell the user to run this command in their project directory, and include it in your final summary:
npx -y firebase-tools@latest init ailogic
2. Add the SDK and initialize the service in the app
Adding the SDK dependency and initializing the service are platform-specific. Before writing code, read the reference for the target platform listed under [Initialization Code References](#initialization-code-references).
More info in [Firebase AI Logic Getting Started](https://firebase.google.com/docs/ai-logic/get-started.md.txt)
______________________________________________________________________
Core Capabilities
> [!WARNING] **CRITICAL: Use current model names:** Always check the > [Firebase AI Logic Models documentation](https://firebase.google.com/docs/ai-logic/models.md.txt) > for the currently supported model names. Do NOT use any Gemini 1.x or Gemini > 2.x models (such as `gemini-1.5-flash`, `gemini-1.5-pro`, `gemini-2.0-flash`, > `gemini-2.0-pro`, `gemini-2.5-flash`, `gemini-2.5-flash-lite`, or > `gemini-2.5-pro`), as older models are deprecated or shut down. Always use a > currently supported Gemini 3+ model; if URL access is blocked in your > environment, proceed directly without searching local files.
Text-Only Generation
Multimodal (Text + Images/Audio/Video/PDF input)
Firebase AI Logic allows Gemini models to analyze image files directly from your app. This enables features like creating captions, answering questions about images, detecting objects, and categorizing images. Beyond images, Gemini can analyze other media types like audio, video, and PDFs by passing them as inline data with their MIME type. For files larger than 20 megabytes (which can cause HTTP 413 errors as inline data), store them in Cloud Storage for Firebase and pass their URLs to the Gemini Developer API.
Chat Session (Multi-turn)
Maintain history automatically using `startChat`.
Streaming Responses
To improve the user experience by showing partial results as they arrive (like a typing effect), use `generateContentStream` instead of `generateContent` for faster display of results.
Text-to-Speech (TTS) Generation
Generate spoken audio dire
Read more
name: firebase-ai-logic-basics description: >- Integrates Firebase AI Logic (formerly Vertex AI for Firebase) into mobile and web apps (Android, iOS, Web, and Flutter) to call Gemini models from client code. Use when provisioning or initializing Firebase AI Logic, or adding Gemini features to an app: text generation, multimodal input, chat, streaming, structured output, hybrid on-device inference, App Check protection, or switching models with Remote Config. version: 1.0.1 metadata: author: Google LLC category: AiAndMachineLearning
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. The app can directly call Gemini models via Firebase AI Logic without the developer needing to manage a dedicated backend. Firebase AI Logic was previously known as "Vertex AI for Firebase".
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
- **Agent Platform Gemini API** (formerly branded Vertex AI): Ideal for scale
with enterprise-grade production readiness, requires Blaze pricing plan
Use the Gemini Developer API as a default, and only Agent Platform Gemini API (formerly branded Vertex AI) if the application requires it.
______________________________________________________________________
Setup & initialization
Prerequisites
- Identify the platform the user is interested in building on prior to starting:
Android, iOS, Web, or Flutter.
- 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)
- The Firebase CLI commands below run through `npx` on every platform, so they
need **Node.js 20+** and npm. Use the `firebase-basics` skill to check for them and to log in to the Firebase CLI. If Node.js is missing or older than version 20, ask the user to install it as that skill describes. Don't install system packages yourself, for example with `sudo apt-get`, because that changes the user's machine without their consent.
1. Provision Firebase AI Logic (ALL platforms)
Use the **Firebase CLI** to provision Firebase AI Logic for the Firebase Project:
1. Make sure that you're in a firebase directory (with a `firebase.json`).
1. Verify that you're running Firebase CLI commands against the intended Firebase Project. When you run this command, the active project is marked with "current":
npx -y firebase-tools@latest projects:list
1. Make sure there's at least one Firebase App for the target platform registered with the current Firebase Project:
npx -y firebase-tools@latest apps:list
1. Provision Firebase AI Logic for the Firebase Project:
npx -y firebase-tools@latest init ailogic
This command will enable the Gemini Developer API in the Firebase project.
> [!WARNING] **CRITICAL: Provisioning Firebase AI Logic is Required** For all > platforms (Android, iOS, Web, or Flutter), even if the app already uses > Firebase, you MUST run `npx -y firebase-tools@latest init ailogic` to > provision the service. The configuration files of `GoogleService-Info.plist`, > `google-services.json`, and `firebase_options.dart` ONLY handle client > configuration and do NOT enable the Firebase AI Logic service, leading to > `PERMISSION_DENIED` errors.
If you can't run `init ailogic` yourself (for example because Node.js is missing or the Firebase CLI isn't logged in) do NOT skip it. The app's requests to Gemini models will fail until the Firebase AI Logic service is provisioned. Tell the user to run this command in their project directory, and include it in your final summary:
npx -y firebase-tools@latest init ailogic
2. Add the SDK and initialize the service in the app
Adding the SDK dependency and initializing the service are platform-specific. Before writing code, read the reference for the target platform listed under [Initialization Code References](#initialization-code-references).
More info in [Firebase AI Logic Getting Started](https://firebase.google.com/docs/ai-logic/get-started.md.txt)
______________________________________________________________________
Core Capabilities
> [!WARNING] **CRITICAL: Use current model names:** Always check the > [Firebase AI Logic Models documentation](https://firebase.google.com/docs/ai-logic/models.md.txt) > for the currently supported model names. Do NOT use any Gemini 1.x or Gemini > 2.x models (such as `gemini-1.5-flash`, `gemini-1.5-pro`, `gemini-2.0-flash`, > `gemini-2.0-pro`, `gemini-2.5-flash`, `gemini-2.5-flash-lite`, or > `gemini-2.5-pro`), as older models are deprecated or shut down. Always use a > currently supported Gemini 3+ model; if URL access is blocked in your > environment, proceed directly without searching local files.
Text-Only Generation
Multimodal (Text + Images/Audio/Video/PDF input)
Firebase AI Logic allows Gemini models to analyze image files directly from your app. This enables features like creating captions, answering questions about images, detecting objects, and categorizing images. Beyond images, Gemini can analyze other media types like audio, video, and PDFs by passing them as inline data with their MIME type. For files larger than 20 megabytes (which can cause HTTP 413 errors as inline data), store them in Cloud Storage for Firebase and pass their URLs to the Gemini Developer API.
Chat Session (Multi-turn)
Maintain history automatically using `startChat`.
Streaming Responses
To improve the user experience by showing partial results as they arrive (like a typing effect), use `generateContentStream` instead of `generateContent` for faster display of results.
Text-to-Speech (TTS) Generation
Generate spoken audio dire
Other skills on firebase.
More skills from other plugins.
karpathy-guidelines
Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid…
agent-builder
Design and build AI agents for any domain. Use when users: (1) ask to "create an agent", "build an assistant", or "design an AI…
Questions about firebase-ai-logic-basics.
- Which coding agents can use firebase-ai-logic-basics?
- firebase-ai-logic-basics installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.

