Data stays local
Inference runs on the device, so prompts and replies never reach a server.
Run the models each platform provides, or your own, right on your users’ devices. Drop-in Vercel AI SDK providers for React Native: swap the model per platform and keep the rest of your code. No server, no API key.
npm install @react-native-ai/apple aiimport { apple } from '@react-native-ai/apple'
import { streamText } from 'ai'
const result = streamText({
model: apple(),
prompt: 'Plan a 3-day trip to Kyoto',
})
for await (const delta of result.textStream) {
setReply((text) => text + delta)
}Plan a 3-day trip to Kyoto
Day 1: Fushimi Inari at sunrise, then Gion in the evening.
Day 2: Arashiyama bamboo grove and the Tenryū-ji gardens.
Day 3: Nishiki Market, then Kiyomizu-dera for the view.
apple() · on device
Works with iOS, Android, Apple Foundation Models, Core AI, Gemini Nano, llama.rn, Vercel AI SDK, Expo.
[01] How it works
Add the provider for each platform you ship to, next to the AI SDK.
$ npm install @react-native-ai/apple aiUse apple() on iOS and adk() on Android, or a model you ship with Core AI or Llama.
$ npm install @react-native-ai/adkPass the model to generateText, streamText, embed or any other AI SDK function. The rest of your code stays the same, on iOS and Android.
$ npx expo run:androidimport { apple } from '@react-native-ai/apple'
import { streamText } from 'ai'
const result = streamText({
model: apple(),
prompt: 'Summarize my notes',
})
import { coreAI } from '@react-native-ai/core-ai'
import { streamText } from 'ai'
const result = streamText({
model: coreAI.languageModel({
id: 'qwen3-0.6b',
source: qwen3ModelDirectory,
}),
prompt: 'Summarize my notes',
})import { adk } from '@react-native-ai/adk'
import { streamText } from 'ai'
const result = streamText({
model: adk(),
prompt: 'Summarize my notes',
})
import { downloadModel, llama } from '@react-native-ai/llama'
import { streamText } from 'ai'
const path = await downloadModel(
'bartowski/Qwen_Qwen3.5-2B-GGUF/Qwen_Qwen3.5-2B-Q4_K_M.gguf'
)
const model = llama.languageModel(path)
await model.prepare()
const result = streamText({ model, prompt: 'Summarize my notes' })[02] Runtimes
Apple, Core AI and ADK run on the AI stack the platform provides: native, hardware-accelerated and with its system models. Llama runs GGUF models sized for phones on iOS and Android through llama.rn, a third-party binding.
The model that ships with iOS, plus embeddings, transcription and speech from Apple’s own frameworks.
@react-native-ai/appleNative · by CallstackApple’s runtime for models you ship: text, image prompts, image generation, transcription, embeddings and vision tasks.
@react-native-ai/core-aiNative · by CallstackGoogle’s on-device Gemini through the Agent Development Kit, with tool calling and an opt-in cloud Gemini.
@react-native-ai/adkThird-party bindingThe portable option: an AI SDK provider over the third-party llama.rn binding, for GGUF models small enough for a phone, on both platforms.
@react-native-ai/llama[03] Small context windows
On-device models have a few thousand tokens of context. Wrap any model to keep a rolling window, summarize older turns and drop finished tool calls, without changing your chat state.
Conversation historyimport { apple } from '@react-native-ai/apple'
import { wrapLanguageModelWithHistory } from '@react-native-ai/utils'
import { streamText } from 'ai'
const model = wrapLanguageModelWithHistory(apple(), {
rollingWindowMessages: 12,
dropCompletedToolCalls: true,
})
const result = streamText({ model, messages })[04] What you get
generateText and streamText with every provider, token by token.
Pass a zod schema and get typed objects back from on-device models.
Read moreModels call your JavaScript functions, with Apple and ADK running the loop natively.
Read moreSemantic search on device with embed, embedMany and rerank.
Speech to text with SpeechAnalyzer, and text to speech with system or GGUF voices.
Read moreGenerate images on iPhone with Core AI diffusion models through generateImage.
Build React Native views from tool calls, designed for small models. Experimental.
Read moreSee every AI SDK call as a trace in Rozenite, for on-device and remote models alike.
Read more[05] Private by default
Inference runs on the device, so prompts and replies never reach a server.
No network round trip and nothing to wait for. It works in airplane mode.
System models need no API key, and there is no per-token cost.
Private Cloud Compute and cloud Gemini run only when you ask for them.
[06] FAQ
structuredClone.apple.isAvailable() is false.