Now live on npm · v0.1.1

Apple Intelligence, from React Native.

A TypeScript and Expo SDK for Apple’s Foundation Models framework. The language model runs on the device: private, free to call, and with no API keys to manage.

npx expo install @fourlyn/apple-foundation-models
  • Runs on device
  • No API keys
  • MIT licence

Code

A few lines to a first answer.

The API follows Apple’s framework closely, with the types you expect in TypeScript.

hello.ts
import { AppleFoundationModels, createSession } from '@fourlyn/apple-foundation-models';

if ((await AppleFoundationModels.getAvailability()).available) {
  const session = await createSession({
    instructions: 'You are a helpful assistant.',
  });
  const { text } = await session.respond('Explain quantum computing simply.');
}

Features

The whole framework, not just the basics.

  • Sessions

    Multi-turn conversations, several sessions at once, and automatic request queuing.

  • Streaming

    Use for await over chunks, with deltas and revisions handled for you.

  • Structured output

    Zod or JSON Schema becomes Apple’s GenerationSchema. Typed results and partial objects while streaming.

  • Tool calling

    JavaScript tools with typed arguments, run in parallel, with events as they fire.

  • Cancellation

    AbortSignal is accepted everywhere a request is made.

  • Transcripts

    Typed entries plus lossless JSON, to persist a session and restore it.

  • Tokens and usage

    Count tokens before you send, and read usage per response and per session.

  • Private Cloud Compute

    Check availability and quota, then choose the model: on device, Private Cloud Compute, or auto.

  • Dynamic profiles

    Switch instructions, tools, model and options in the middle of a session.

  • Images and Vision tools

    Image prompts, plus Apple’s OCR and barcode reader tools.

  • React hooks

    useAvailability, useSession and useChat for screens that talk to the model.

  • Safe everywhere

    Importing it on Android, web or Expo Go never crashes. Unsupported states are explicit.

Also included: an optional provider for the Vercel AI SDK, so generateText({ model: apple() }) works.

Privacy

No backend. Nothing collected.

With the default system model, prompts are processed on the device. If you choose Private Cloud Compute, or let auto fall back to it, requests go to Apple’s Private Cloud Compute. The package itself has no server and collects nothing.

Requirements

What you need.

  • iOS or iPadOS 26 or later, on a device that supports Apple Intelligence, with Apple Intelligence turned on. iOS 27 unlocks more features.
  • Xcode 26 or later. Xcode 27 to compile the iOS 27 features.
  • Expo SDK 55 or later with a development build, or bare React Native with Expo Modules. Expo Go is not supported.
  • React Native’s New Architecture, which is the default.

Ready to build? It’s on npm.

Install the package, rebuild your development build, and send your first prompt in minutes.

npx expo install @fourlyn/apple-foundation-models