npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

expo-foundation-models

v1.0.2

Published

Expo module for Apple's Foundation Models (on-device LLM) and CoreML

Readme

expo-foundation-models

Expo bindings for Apple's Foundation Models API and Core ML.

npm version License: MIT

Overview

expo-foundation-models runs Apple's on-device language model from React Native and Expo apps. Prompts and responses stay on the device. The package also runs custom Core ML models.

Features

| Feature | Description | |---------|-------------| | On-device LLM | Generate text with Apple Intelligence without sending prompts to an external server | | Structured output | Generate JSON that matches a schema | | Tool calling | Allow the model to call JavaScript functions | | Streaming | Receive responses as they are generated | | Session management | Keep conversation history, prewarm a session, or resume one | | Adapters | Load fine-tuned models | | Core ML | Run custom Core ML models |

Platform support

| Capability | iOS | Android | |------------|-----|---------| | Core ML | iOS 16.0+ | Not supported | | Foundation Models | iOS 26.0+ | Not supported | | Token counting (getTokenCount, getContextSize) | iOS 26.4+ | Not supported | | Private Cloud Compute sessions (model.type: 'privateCloudCompute') | iOS 27.0+ | Not supported | | Image attachments | iOS 27.0+ | Not supported | | Context options (contextOptions) | iOS 27.0+ | Not supported | | Tool calling mode (toolCallingMode) | iOS 27.0+ | Not supported | | Model variant info (getModelVariant) | Reserved. The iOS 27 SDK does not include the symbol, so this returns null. | Not supported |

Foundation Models requires an Apple Silicon device (A17 Pro or later) with Apple Intelligence enabled in Settings. Capabilities past the base API track OS versions; check them at runtime with getFeatures(), and see KNOWN_ISSUES.md for the known iOS 26/27 differences.

Installation

Requires Expo SDK 54+.

npx expo install expo-foundation-models

For bare React Native projects:

npm install expo-foundation-models
npx pod-install

Quick start

import { FoundationModels } from 'expo-foundation-models';

// Check whether Foundation Models is available.
if (FoundationModels.isAvailable()) {
  const sessionId = await FoundationModels.createSession('You are a helpful assistant.');

  const response = await FoundationModels.respond(sessionId, 'Hello!');
  console.log(response);

  await FoundationModels.closeSession(sessionId);
}

Feature detection

Call getFeatures() before using an optional capability, and branch on the returned booleans. Each flag reports whether the capability actually works on this device, not just whether the OS version should contain it: on iOS 27+, privateCloudCompute can still be false when no Private Cloud Compute model is available for the user's account. Calling a method below its minimum OS version rejects with featureUnavailable instead of crashing.

const features = await FoundationModels.getFeatures();

if (features.features.imageAttachments) {
  // iOS 27+: send an image alongside the prompt.
  const sessionId = await FoundationModels.createSession();
  const caption = await FoundationModels.respond(sessionId, {
    text: 'Describe this photo.',
    images: [{ uri: 'file:///tmp/photo.jpg' }],
  });
}

The full flag list and per-capability examples are in docs/getting-started.md and docs/foundation-models.md.

Documentation

| Guide | Description | |-------|-------------| | Getting started | Install and configure the package | | Foundation Models | Generate and stream text | | Structured output | Generate values from JSON Schema | | Tool calling | Define and run tools | | Session management | Manage transcripts, prewarming, and history | | Adapters | Train and load fine-tuned models, including the full LoRA training workflow | | Feedback | Record response quality | | Core ML | Run custom Core ML models | | Error handling | Handle package errors |

A demo of every API lives in the example app: cd example && npx expo run:ios.

License

MIT

Links