Skip to main content

on-device-llm-android

2.0.0 · The Android on-device provider for the TaalTree LLM toolkit.

@taaltreelabs/on-device-llm-android connects React Native and Expo apps to Gemini Nano through Google's ML Kit GenAI Prompt API and AICore. It implements the LLMProvider contract from @taaltreelabs/on-device-llm, so it works with the same router, context manager, and React hooks.

Why a separate package?​

The Apple package provides Apple's native inference path and the shared JavaScript toolkit. Android inference is a separate, deliberate install because the Google SDK has a different data policy: generation is on-device, but ML Kit sends performance and usage metrics to Google. Google's privacy documentation explains the distinction.

Installing the Apple package does not opt your app into ML Kit. The Android provider also leaves Google's SDK out of its runtime dependencies: your app must explicitly add it to the Android build.

Start here​

  1. Read Privacy & SDK terms.
  2. Check Compatibility & limitations.
  3. Follow the two-part Getting started setup.
  4. Add the provider to your app using Usage & routing.

What lives where?​

PackageResponsibilities
@taaltreelabs/on-device-llmApple provider, shared types, context management, router, OpenAI-compatible provider, React hooks
@taaltreelabs/on-device-llm-androidAndroid provider and Kotlin bridge for ML Kit / AICore

The main package is a peer dependency (^1.0.0), so both packages use the same provider contract. Android exports createAndroidProvider, AndroidProvider, and AndroidProviderConfig from the package root; use that root import for this integration. The shared package does not export an Android provider.

Source and release status​

These docs cover Android 2.0.0 with shared 1.0.0 or newer in the 1.x series. Shared 0.x is no longer supported. Follow the installation guide to upgrade both packages together.

The Android package includes its Expo config plugin and consumer R8 rules. See GitHub for source and release updates.