Skip to main content
The complete integration path for adding on-device LLM, STT, and TTS to a React Native app with the RunAnywhere SDK, written against SDK 0.20.27. It is written step by step, so a coding agent can follow it as-is. Every step assumes the app runs in RunAnywhere AI Studio rather than standard Expo Go.

Working starter project

The RunAnywhere Expo Demo is a working Expo template with a prebuilt Android APK.

RunAnywhere AI Studio app

You must run the app inside RunAnywhere AI Studio, a fork of Expo Go carrying the native libraries the SDK needs. Standard Expo Go does not include them, so RunAnywhere.initialize() and every inference call below fail there with a missing native module.
Your JS bundle connects to Metro as usual and runs inside AI Studio, which supplies the native layer: LlamaCPP for LLM, ONNX Runtime for STT and TTS, and the native audio module.

1. Install

package.json
Add @runanywhere/mlx (^0.20.27) for Apple MLX on physical iOS devices, and @runanywhere/qhexrt (^0.20.19, note the different version) for the Qualcomm Hexagon NPU.

2. Register a backend, then initialize

App.tsx
Register backends before initialize(). The plugin registry has to know which engines exist before the first model load.

3. Register models

API reference

Model management

There is no models.get(id) on React Native. Use models.loaded(category), or list() and filter.

LLM

Break out of the loop to cancel. A conversation is the same method with an array:

Speech to text

Streaming, when you have an async iterable of audio:
There is no stt.openStream on React Native.

Text to speech

Voice agent

The ModelService pattern

A React context that owns registration and readiness, so screens do not each re-initialize.
ModelService.tsx

Chat screen

ChatScreen.tsx
Two things here matter and are easy to skip: the cancelled ref stops the loop writing state after unmount, and buffering tokens on a 50ms interval stops a re-render per token.

Errors

On React Native, an in-flight streaming failure is thrown into the consumer, so a try around the for await catches it. That differs from the Web SDK, where the failure arrives as a failed event.

Package compatibility

react-native-reanimated

Works. Keep it on the version Expo’s SDK pins rather than the latest, since a mismatch surfaces as a native crash that looks like an SDK problem.

Other native libraries

Anything that ships its own native code has to be present in the AI Studio build. If you add a native dependency the fork does not carry, the JS side loads and the native module is missing at runtime.

Troubleshooting