Back to Runanywhere Sdks

RunAnywhere React Native SDK

sdk/runanywhere-react-native/README.md

0.20.126.5 KB
Original Source

RunAnywhere React Native SDK

On-device AI for React Native — run LLMs, speech-to-text, text-to-speech, and voice pipelines locally. Private, offline-capable, production-ready.

<p align="center"> <a href="https://docs.runanywhere.ai/react-native/introduction"></a> <a href="https://discord.gg/N359FBbDVd"></a> <a href="../../LICENSE"></a> </p> <p align="center"> <a href="#"></a> <a href="#"></a> <a href="#"></a> <a href="#"></a> </p>

Requirements

ComponentMinimumRecommended
React Native0.83.1+0.85.3
Node.js22.12+24 LTS
iOS17.5+17.5+
AndroidAPI 24 (7.0+)API 28+
Xcode26+26+
RAM3 GB6 GB+ for larger models

Apple Silicon devices and Android phones with 6 GB+ RAM are recommended for 3B+ models.


Installation

Install the core package plus the backends you need. Pin to 0.20.11:

bash
npm install @runanywhere/[email protected] @runanywhere/[email protected]
PackagePurpose
@runanywhere/coreCore SDK — required
@runanywhere/llamacppLLM / VLM (GGUF via llama.cpp)
@runanywhere/onnxSTT, TTS, VAD (Whisper, Piper, Silero)
@runanywhere/mlxApple MLX on physical iOS devices
@runanywhere/qhexrtOptional Qualcomm Hexagon NPU acceleration (Snapdragon Android)

iOS: run cd ios && pod install && cd .. after installing packages.

Android: no extra setup — native libraries are bundled and downloaded during the Gradle build.


Quick Start

typescript
import { RunAnywhere, SDKEnvironment } from '@runanywhere/core';
import { LlamaCPP } from '@runanywhere/llamacpp';

await RunAnywhere.initialize({
  environment: SDKEnvironment.SDK_ENVIRONMENT_DEVELOPMENT,
});

await LlamaCPP.register();

await RunAnywhere.downloadModel('smollm2-360m');
await RunAnywhere.loadModel('smollm2-360m');

const result = await RunAnywhere.generate('What is the capital of France?');
console.log(result.text);

For streaming tokens, voice (STT/TTS), vision, RAG, and tool calling, see the documentation.

Production initialization

typescript
await RunAnywhere.initialize({
  apiKey: '<YOUR_API_KEY>',
  baseURL: 'https://api.runanywhere.ai',
  environment: SDKEnvironment.SDK_ENVIRONMENT_PRODUCTION,
});
EnvironmentDescription
SDK_ENVIRONMENT_DEVELOPMENTKeyless OSS mode, verbose logging
SDK_ENVIRONMENT_STAGINGTesting with real services
SDK_ENVIRONMENT_PRODUCTIONAuthenticated control plane, telemetry

Capabilities

The SDK exposes a unified RunAnywhere namespace. Register backend modules (LlamaCPP, ONNX, MLX) before downloading or loading models.

CapabilityKey APIsBackend package
LLMgenerate, generateStream@runanywhere/llamacpp, @runanywhere/mlx
VLMprocessImage, processImageStream@runanywhere/llamacpp, @runanywhere/mlx
STTtranscribe, transcribeStream@runanywhere/onnx
TTSsynthesize, synthesizeStream@runanywhere/onnx
VADVoice activity detection helpers@runanywhere/onnx
Voice agentinitializeVoiceAgent, streamVoiceAgent, processVoiceTurnCore + ONNX + LLM backend
ModelsregisterModel, downloadModel, loadModel, listModels@runanywhere/core
RAG / toolsragQuery, generateWithTools@runanywhere/core

Supported model formats

FormatUse caseBackend
GGUFLLM, some VLMLlamaCPP
ONNX / Sherpa archivesSTT, TTS, VADONNX
MLX bundlesLLM, VLM, speech on Apple siliconMLX
QHexRT bundlesNPU-accelerated models on SnapdragonQHexRT

Built-in catalog models (e.g. smollm2-360m) are discovered automatically after initialization — no manual registerModel call required for catalog entries.


Error Handling

Errors throw SDKException with a proto ErrorCode:

typescript
import { SDKException, ErrorCode, isSDKException } from '@runanywhere/core';

try {
  await RunAnywhere.generate('Hello!');
} catch (error) {
  if (isSDKException(error)) {
    console.error(error.code, error.message);
  }
}

Documentation & Examples

ResourceLink
Docs sitedocs.runanywhere.ai/react-native/introduction
API referenceDocs/Documentation.md
Example appexamples/react-native/RunAnywhereAI/
Contributing / building from sourceDocs/DEVELOPMENT.md

FAQ

Do I need an internet connection?
Only for initial model download. Inference runs entirely on-device afterward.

Is user data sent to the cloud?
No. All inference is local. Production mode may collect anonymous telemetry (configurable).

Can I use custom models?
Yes — register any compatible GGUF, ONNX/Sherpa, or MLX bundle via RunAnywhere.registerModel().


Support


License

RunAnywhere License. See LICENSE for details.