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

react-native-apple-ai

v0.1.0

Published

A React Native Nitro module

Readme

react-native-apple-ai

React Native Nitro module for Apple's Foundation Models (Apple Intelligence). Enables AI capabilities in React Native applications using Apple's on-device model, with tool calling support and streaming responses on iOS 26.0+.

Requirements

  • iOS 26.0 or later
  • Apple Intelligence enabled in Settings > Apple Intelligence & Siri
  • Compatible Apple devices (Apple Silicon Macs, recent iPhones/iPads)
  • React Native with Nitro modules support

Installation

npm install react-native-apple-ai react-native-nitro-modules
yarn add react-native-apple-ai react-native-nitro-modules
bun add react-native-apple-ai react-native-nitro-modules

Usage

Basic Chat Session

import { LanguageModelSession } from 'react-native-apple-ai';

const session = new LanguageModelSession({
  instructions: 'You are a helpful assistant'
});

// Stream responses
await session.streamResponse('Hello, how are you?', (response) => {
  console.log('Streaming response:', response);
});

Using React Hooks

import { useLanguageModel } from 'react-native-apple-ai';

function ChatComponent() {
  const { send, response, loading, error, isSessionReady } = useLanguageModel({
    instructions: 'You are a helpful coding assistant',
    onResponse: (response) => console.log('Got response:', response),
    onError: (error) => console.error('Error:', error)
  });

  const handleSendMessage = async () => {
    if (isSessionReady) {
      await send('Explain React hooks');
    }
  };

  return (
    <View>
      <Text>{response}</Text>
      <Button onPress={handleSendMessage} disabled={loading} title="Send" />
    </View>
  );
}

Tool calling

import { createTool, LanguageModelSession } from 'react-native-apple-ai';
import { z } from 'zod';

const weatherTool = createTool({
  name: 'weather_tool',
  description: 'Get current weather for a city',
  arguments: z.object({
    city: z.string(),
  }),
  handler: async (args) => {
    const response = await fetch(`/weather?city=${args.city}`);
    const res = await response.json();
    return res.data
  },
});

const session = new LanguageModelSession({
  instructions: 'You are a weather assistant',
  tools: [weatherTool]
});

API Reference

LanguageModelSession

Core class for managing AI conversations.

constructor(config?: {
  instructions?: string;
  tools?: Tool[];
})

useLanguageModel(config)

React hook for session management with automatic lifecycle handling.

Returns:

  • session - The current session instance
  • response - Latest AI response
  • loading - Whether a request is in progress
  • error - Any error that occurred
  • send(prompt) - Send a message to the AI
  • reset() - Reset the conversation state
  • isSessionReady - Whether the session is ready to use

useStreamingResponse(session)

Lower-level hook for streaming responses.

checkFoundationModelsAvailability()

Check if Apple Intelligence is available on the device.

Development

This project uses a workspace structure with:

  • package/ - The nitro module source code
  • example/ - Example app demonstrating usage

Setup

bun install
bun run build

Running the example

cd example
bun start    # Start Expo dev server
bun ios      # Run on iOS

Note: Android is not supported as this module requires Apple's Foundation Models framework.