This guide shows you how to get started making calls to the Gemini API directly from your app using the Firebase AI Logic client SDKs for your chosen platform.
Prerequisites
Swift
This guide assumes that you're familiar with using Xcode to develop apps for Apple platforms (like iOS).
Make sure that your development environment and Apple platforms app meet these requirements:
- Xcode 26.2 or higher
- Your app targets iOS 15 or higher, or macOS 12 or higher
Kotlin
This guide assumes that you're familiar with using Android Studio to develop apps for Android.
Make sure that your development environment and Android app meet these requirements:
- Android Studio (latest version)
- Your app targets API level 21 or higher
Java
This guide assumes that you're familiar with using Android Studio to develop apps for Android.
Make sure that your development environment and Android app meet these requirements:
- Android Studio (latest version)
- Your app targets API level 21 or higher
Web
This guide assumes that you're familiar with using JavaScript to develop web apps. This guide is framework-independent.
Make sure that your development environment and web app meet these requirements:
- (Optional) Node.js
- Modern web browser
Dart
This guide assumes that you're familiar with developing apps with Flutter.
Make sure that your development environment and Flutter app meet these requirements:
- Dart 3.2.0+
Unity
This guide assumes that you're familiar with developing games with Unity.
Make sure that your development environment and Unity game meet these requirements:
- Unity Editor 2021 LTS or newer
Check out helpful resources
Swift
Try out the quickstart app
Use the quickstart app to try out the SDK quickly and see a complete implementation of various use cases. Or use the quickstart app if you don't have your own Apple platforms app. To use the quickstart app, you'll need to connect it to a Firebase project.
Watch a video tutorial
This video demonstrates how to get started with Firebase AI Logic by building a real-world AI-powered meal planning app that generates recipes from a text prompt.
You can also download and explore the codebase for the app in the video.
View the codebase for the video's app
Kotlin
Try out the quickstart app
Use the quickstart app to try out the SDK quickly and see a complete implementation of various use cases. Or use the quickstart app if you don't have your own Android app. To use the quickstart app, you'll need to connect it to a Firebase project.
Watch a video tutorial
This video demonstrates how to get started with Firebase AI Logic by building a real-world AI-powered meal planning app that generates recipes from a text prompt.
You can also download and explore the codebase for the app in the video.
View the codebase for the video's app
Java
Try out the quickstart app
Use the quickstart app to try out the SDK quickly and see a complete implementation of various use cases. Or use the quickstart app if you don't have your own Android app. To use the quickstart app, you'll need to connect it to a Firebase project.
Watch a video tutorial
This video demonstrates how to get started with Firebase AI Logic by building a real-world AI-powered meal planning app that generates recipes from a text prompt.*
You can also download and explore the codebase for the app in the video.
View the codebase for the video's app
* This video and its app are in Kotlin, but they can still help Java developers understand the basics about how to get started with Firebase AI Logic.
Web
Try out the quickstart app
Use the quickstart app to try out the SDK quickly and see a complete implementation of various use cases. Or use the quickstart app if you don't have your own web app. To use the quickstart app, you'll need to connect it to a Firebase project.
Dart
Try out the quickstart app
Use the quickstart app to try out the SDK quickly and see a complete implementation of various use cases. Or use the quickstart app if you don't have your own Flutter app. To use the quickstart app, you'll need to connect it to a Firebase project.
Watch a video tutorial
This video demonstrates how to get started with Firebase AI Logic by building a real-world AI-powered meal planning app that generates recipes from a text prompt.
You can also download and explore the codebase for the app in the video.
View the codebase for the video's app
Unity
Try out the quickstart app
Use the quickstart app to try out the SDK quickly and see a complete implementation of various use cases. Or use the quickstart app if you don't have your own Unity game. To use the quickstart app, you'll need to connect it to a Firebase project.
Step 1: Set up a Firebase project and enable APIs
Sign into the Firebase console, and then select your Firebase project.
If you don't already have a Firebase project, click the button to create a new Firebase project, and then use either of the following options:
Option 1: Create a wholly new Firebase project (and its underlying Google Cloud project automatically) by entering a new project name in the first step of the workflow.
Option 2: "Add Firebase" to an existing Google Cloud project by clicking Add Firebase to Google Cloud project (at bottom of page). In the first step of the workflow, start entering the project name of the existing project, and then select the project from the displayed list.
Complete the remaining steps of the on-screen workflow to create a Firebase project. Note that when prompted, you do not need to set up Google Analytics to use the Firebase AI Logic SDKs.
In the Firebase console, go to AI Services > AI Logic.
Click Get started to launch a guided workflow that helps you set up the required APIs and resources for your project.
If prompted, follow the on-screen instructions to register your app and add your Firebase configuration to your app.
When asked to choose a "Gemini API provider", we recommend selecting the Gemini Developer API, which lets you get started quickly at no cost.
At any point later, you can always set up the Agent Platform Gemini API (formerly Vertex AI) (and its requirement for billing).
Continue in the workflow to set up the required APIs and associated services for Firebase AI Logic.
Starting early July 2026, this stage of the workflow automatically enforces Firebase App Check for AI Logic, which is a critical service to help protect the Gemini API when it's directly accessed from your app. As part of getting started (see steps later in this guide), you'll need to configure the App Check debug provider for local development when App Check is enforced.
Continue to the next step in this guide to add the required SDKs to your app.
Step 2: Add the required SDKs
With your Firebase project set up and the required APIs enabled (see previous step), you can now add the required SDKs to your app.
Swift
Use Swift Package Manager to install and manage Firebase dependencies. Learn about other installation options, if needed.
The Firebase AI Logic library provides access to the APIs for interacting
with Gemini models. The library is included as part of the
Firebase SDK for Apple platforms (firebase-ios-sdk).
If you're already using Firebase, then make sure your Firebase package is v12.5.0 or later.
In Xcode, with your app project open, navigate to File > Add Package Dependencies.
When prompted, add the Firebase Apple platforms SDK repository:
https://github.com/firebase/firebase-ios-sdkSelect the latest SDK version.
Select the
FirebaseAILogiclibrary and theFirebaseAppChecklibrary.
When finished, Xcode will automatically begin resolving and downloading your dependencies in the background.
Kotlin
The Firebase AI Logic SDK for Android (firebase-ai) provides
access to the APIs for interacting with Gemini models.
In your module (app-level) Gradle file
(like <project>/<app-module>/build.gradle.kts),
add the dependencies for the Firebase AI Logic and App Check libraries
for Android. We recommend using the
Firebase Android BoM
to control library versioning.
dependencies { // ... other androidx dependencies // Import the BoM for the Firebase platform implementation(platform("com.google.firebase:firebase-bom:34.17.0")) // Add the dependencies for the Firebase AI Logic and App Check libraries // When using the BoM, you don't specify versions in Firebase library dependencies implementation("com.google.firebase:firebase-ai") implementation("com.google.firebase:firebase-appcheck-debug") }
By using the Firebase Android BoM, your app will always use compatible versions of Firebase Android libraries.
If you choose not to use the Firebase BoM, you must specify each Firebase library version in its dependency line.
Note that if you use multiple Firebase libraries in your app, we strongly recommend using the BoM to manage library versions, which ensures that all versions are compatible.
dependencies { // Add the dependencies for the Firebase AI Logic and App Check libraries // When NOT using the BoM, you must specify versions in Firebase library dependencies implementation("com.google.firebase:firebase-ai:17.15.0") implementation("com.google.firebase:firebase-appcheck-debug:19.4.0") }
Java
The