React Native Apple
Learn how to use the Apple provider for on-device AI.
@react-native-ai/apple is a community provider that brings Apple's on-device AI capabilities to React Native and Expo applications. It allows you to run the AI SDK entirely on-device, leveraging Apple Intelligence foundation models available from iOS 26+ to provide text generation, embeddings, transcription, and speech synthesis through Apple's native AI frameworks.
Setup
The Apple provider is available in the @react-native-ai/apple module. You can install it with:
$ pnpm add @react-native-ai/apple
$ npm install @react-native-ai/apple
$ yarn add @react-native-ai/apple
$ bun add @react-native-ai/apple
Prerequisites
Before using the Apple provider, you need:
- React Native or Expo application: This provider only works with React Native and Expo applications. For setup instructions, see the Expo Quickstart guide
- iOS 26+: Required for Apple Intelligence foundation models and core functionality
Provider Instance
You can import the default provider instance apple from @react-native-ai/apple:
Availability Check
Before using Apple AI features, you can check if they're available on the current device:
Language Models
Apple provides on-device language models through Apple Foundation Models, available on iOS 26+ with Apple Intelligence enabled devices.
Text Generation
Generate text using Apple's on-device language models:
Streaming Text Generation
For real-time text generation:
Structured Output Generation
Generate structured data using Zod schemas:
Model Configuration
Configure generation parameters:
Tool Calling
The Apple provider supports tool calling, where tools are executed by Apple Intelligence rather than the AI SDK. Tools must be pre-registered with the provider using createAppleProvider before they can be used in generation calls.
Since tools are executed by Apple Intelligence rather than the AI SDK,
multi-step features like maxSteps, onStepStart, and onStepFinish are not
supported.
Text Embeddings
Apple provides multilingual text embeddings using NLContextualEmbedding, available on iOS 17+.
Audio Transcription
Apple provides speech-to-text transcription using SpeechAnalyzer and SpeechTranscriber, available on iOS 26+.
Speech Synthesis
Apple provides text-to-speech synthesis using AVSpeechSynthesizer, available on iOS 13+ with enhanced features on iOS 17+.
Basic Speech Generation
Convert text to speech:
Voice Selection
You can configure the voice to use for speech synthesis by passing its identifier to the voice option.
To check for available voices, you can use the getVoices method:
Platform Requirements
Different Apple AI features have varying iOS version requirements:
| Feature | Minimum iOS Version | Additional Requirements |
|---|---|---|
| Text Generation | iOS 26+ | Apple Intelligence enabled device |
| Text Embeddings | iOS 17+ | - |
| Audio Transcription | iOS 26+ | Language assets downloaded |
| Speech Synthesis | iOS 13+ | iOS 17+ for Personal Voice |
Apple Intelligence features are currently available on selected devices. Check Apple's documentation for the latest device compatibility information.