@stewmore/expo-ai-apple-foundation-models
Apple Foundation Models (on-device, iOS 26+) provider for the Expo AI Runtime.
Install & use
import { ExpoAI } from '@stewmore/expo-ai-core';
import '@stewmore/expo-ai-apple-foundation-models'; // registers the iOS adapter (side-effect import)
const caps = await ExpoAI.getCapabilities();
if (caps.available && caps.provider === 'apple-foundation-models') {
const result = await ExpoAI.generate({ prompt: 'Write a haiku about Swift.' });
console.log(result.text); // privacy: on-device
}
Requirements
- iOS / iPadOS 26+ on an Apple Intelligence–capable device with Apple Intelligence enabled.
- A development build (custom native code — not Expo Go):
npx expo prebuild && npx expo run:ios.
On unsupported OS/devices the adapter reports available: false with a reason
(unsupported_os_version, unsupported_device, apple_intelligence_disabled,
model_initializing), so the runtime can fall back per the app's policy.
What it maps
| Runtime | Foundation Models |
|---|---|
generate | LanguageModelSession.respond(to:options:) |
stream | LanguageModelSession.streamResponse(...) (cumulative snapshots → token deltas) |
createSession | native stateful LanguageModelSession (generateInSession / resetSession / disposeSession) |
| capability detection | SystemLanguageModel.availability |
| errors | LanguageModelSession.GenerationError → ExpoAIError |
Structured output (generateObject), summarize/rewrite/proofread are provided by the
core runtime over generate. Native guided generation via DynamicGenerationSchema
is a planned enhancement.
note
The FoundationModels API surface follows the WWDC25 docs; verify exact symbol names against your installed Xcode SDK if the native build flags a mismatch.