At WWDC 2026, Apple opened the Foundation Models framework to third-party model adapters. Starting with iOS 27, macOS 27, iPadOS 27, watchOS 27, and visionOS 27, model providers can implement the public LanguageModel protocol and plug in.
We’ve made it possible to bring Gemini cloud models into the framework, delivered through Firebase, starting in preview today. If you’re already using Apple’s Foundation Models framework, switching to Gemini models is a small code change: swap the model instance.
Call Gemini models directly from the Foundation Models framework
This Firebase integration provides a fully native development experience – cloud-hosted Gemini models can plug directly into the Foundation Models framework using the same API. That means the on-device Apple model and cloud-hosted Gemini models sit behind a shared API surface, so you can easily swap between local and cloud inference to fit your use case.
- On-device models offer privacy, optimal cost, and offline support.
- Cloud-hosted models offer large context windows, advanced capabilities, and more reasoning power.
A request to a Gemini model via LanguageModel is routed through Firebase AI Logic. Every request is attested when using Firebase App Check, so calls from tampered devices, emulators, and scripts are rejected before they reach the model. Firebase helps you secure your Gemini-powered features by setting up an attestation provider for Apple apps and enforcing it for all Gemini API access from the client.
The practical result: you can securely and directly call the Gemini API from your Swift app.
What it looks like
If you’re new to the Foundation Models framework, the high-level overview is: instantiate a model, hand it to a LanguageModelSession, then call respond(to:) or streamResponse(to:). Here’s that flow with Gemini:
import FirebaseAppCheck
import FirebaseCore
import FirebaseAILogic
import FoundationModels
// Configure Firebase once at app startup with your preferred App Check
// attestation provider.
AppCheck.setAppCheckProviderFactory(AppCheckDebugProviderFactory())
FirebaseApp.configure()
func generateStory(
topic: String,
wordCount: Int,
language: String
) async throws -> String {
let ai = FirebaseAI.firebaseAI()
let model = ai.geminiLanguageModel(name: "gemini-3.5-flash")
let session = LanguageModelSession(
model: model,
instructions: """
You are a creative storyteller who writes engaging, vivid prose.
You must write strictly in \(language).
Your stories must be approximately \(wordCount) words long.
You must return ONLY the story text.
Do not include a preamble, title, or conversational filler.
"""
)
let response = try await session.respond(
to: "Write a short story about \(topic)."
)
return response.content
}
// Usage:
let story = try await generateStory(
topic: "a lighthouse keeper who discovers a message in a bottle",
wordCount: 300,
language: "Spanish"
)
print(story) If you’re already using the Foundation Models framework, you can use Gemini instead of the on-device model by initializing your LanguageModelSession with a GeminiLanguageModel instead of a SystemLanguageModel. Your existing SwiftUI views, your @Generable parsing structures, your tool definitions: none of it changes.
This matters if you are building your own custom hybrid model inference. Because on-device and Gemini both sit behind the same protocol, you decide per call which to use based on whatever logic fits your app: required model strength and capabilities, network availability, cost, sensitivity of the input. The framework doesn’t route the request for you; the decision is controlled by you in your code.
What you can do beyond text
Here’s what you can build with this integration:
- Answers grounded in the real world. By registering the
googleMapsorgoogleSearchtools with your session, your app can recommend actual venues with live details. It can also answer questions with current information from the web, instead of relying on when the model was trained. - Apps that understand more than words. Pass images, audio, video, or PDFs alongside your prompt and build features around what users see, hear, and read, not just type.
- Image generation in your app. Generate and edit images conversationally with a Nano Banana model, so your users can create visual content without leaving your app.
- Conversational features that feel responsive. Stream responses, and keep multi-turn chat history without managing it yourself. By using
@Generableyou get responses as native Swift types that drop straight into your data model. - Agents that act on your app’s behalf. Tool calling lets Gemini invoke your code, and thought signatures preserve its reasoning across turns, so you can build agentic features that stay coherent over a session.
Getting started
If you already have a Swift app that uses Firebase (like an iOS or macOS app), you have some of the basic setup already in place. This integration leverages the Firebase Apple SDK – specifically the Firebase AI Logic library.
Here’s the shortest path from zero to a working Gemini call:
- Create a Firebase project in the Firebase console and register your Apple app.
- Enable Firebase AI Logic and pick your Gemini API provider: the Gemini Developer API if you want the free tier, or the Gemini Enterprise Agent Platform API (formerly Vertex AI) if you need enterprise compliance.
- Add the Firebase Apple SDK to Xcode via Swift Package Manager (or update to the latest version if you already have it). Select the Dependency Rule as Branch and enter
wwdc26-preview(during this preview stage, this branch is necessary to use this integration in your app). - Add the
FirebaseAILogiclibrary when prompted. - Add
FirebaseApp.configure()to your app startup, andimport FirebaseAILogicwherever you want to use the integration. - Add a generative AI feature to your app (for example, the snippet earlier in this blog post).
- Configure and enforce App Check for using any of the available attestations providers for Apple, including debug providers.
- Run the app on your device.
Check out the getting started guide for all the details!
What’s next
This integration is in preview starting today. To get started, check out the open-source GitHub repo, our documentation, and a quickstart sample app demonstrating tool calling, image input, and image output.
Try it, file issues, and tell us if anything is missing. There are so many experiences to build in your app, from real-world grounding to multimodal input to image generation, and we want to see where you take it.
Thanks for sharing so many insights and feedback with us; they push us to keep improving. Please continue to do so, and don’t hesitate to reach out.
Happy building!

