Get started with the Gemini API using the Firebase AI Logic SDKs

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.

Go to the quickstart app

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.

Go to the quickstart app

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.

Go to the quickstart app

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.

Go to the quickstart app

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.

Go to the quickstart app

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.

Go to the quickstart app

Step 1: Set up a Firebase project and enable APIs

  1. Sign into the Firebase console, and then select your Firebase project.

  2. In the Firebase console, go to AI Services > AI Logic.

  3. Click Get started to launch a guided workflow that helps you set up the required APIs and resources for your project.

  4. If prompted, follow the on-screen instructions to register your app and add your Firebase configuration to your app.

  5. 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).

  6. 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.

  7. 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.

  1. In Xcode, with your app project open, navigate to File > Add Package Dependencies.

  2. When prompted, add the Firebase Apple platforms SDK repository:

    https://github.com/firebase/firebase-ios-sdk
    
  3. Select the latest SDK version.

  4. Select the FirebaseAILogic library and the FirebaseAppCheck library.

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.

Java

The