Skip to content
Proyectos

Acerca de

On-device AI for Expo and React Native. Local LLM, speech-to-text, vision, and embeddings. No API keys, no cloud.

Desarrollo web y de aplicaciones

Cómo se miden estas cifras

Crecimiento de estrellas medido

in 24h
0
in 7 days
+1
in 15 days
+1
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

expo-ai-kit

npm version npm downloads license platforms

On-device AI for React Native. Local LLM, speech-to-text, vision, and embeddings for Expo apps and React Native apps with Expo modules installed. No API keys, no cloud.

Documentation · Examples · npm · Changelog

  • Private and offline. Inference runs on the device. Prompts, audio, and images never leave it.
  • No API key, no per-request cost. Nothing to provision, meter, or proxy.
  • One TypeScript API for both platforms. Apple Foundation Models, Speech, and Vision on iOS; ML Kit and MediaPipe on Android; LiteRT-LM for downloadable models such as Gemma.
  • Pay only for what you use. Every feature is opt-in, so unused native code, models, and permissions never ship. Zero runtime JavaScript dependencies.

Install

npx expo install expo-ai-kit

Turn on the features you use in your app config, then make a native build. Until you enable a feature, none of its native code is compiled into your app. To use text generation:

{
  "expo": {
    "plugins": [["expo-ai-kit", { "llm": true }]]
  }
}

Requires Expo SDK 54+ (or compatible Expo modules in an existing React Native app) and a native development or production build. Expo Go is not supported. Follow Get Started for native setup and a working app example. Device and OS requirements vary by feature; see platform support.

First request

With llm enabled, on a device with a supported built-in text model:

import { isAvailable, prepareBuiltInModel, sendMessage } from 'expo-ai-kit';

async function ask(question: string) {
  if (!(await isAvailable())) {
    return 'The built-in text model is unavailable on this device.';
  }
  await prepareBuiltInModel();
  const { text } = await sendMessage([{ role: 'user', content: question }]);
  return text;
}

const answer = await ask('Explain gravity in one sentence.');

The built-in text model requires Apple Intelligence on iOS 26+ or a supported Android device. Android may download its model during preparation. You can also download a model such as Gemma.

LLM

Generate and stream text, return structured JSON, or let the model call your functions. Stream tokens into your UI as they arrive:

import { streamMessage } from 'expo-ai-kit';

const { promise, stop } = streamMessage(
  [{ role: 'user', content: 'Write a haiku about the sea.' }],
  (event) => setText(event.accumulatedText)
);

await promise; // call stop() to cancel early

Pass the full message history on each call. One generation runs at a time. Enable the llm option and rebuild.

Speech

Transcribe microphone audio or recorded files with streamTranscription and transcribe. Enable the speech plugin option and rebuild. iOS requires 26+; Android requires 12+ and processes file audio at real-time rate.

Vision

Remove backgrounds, label images, and read text with removeBackground, labelImage, and recognizeText. Find faces with detectFaces:

import { detectFaces } from 'expo-ai-kit';

const { width, height, faces } = await detectFaces({ uri: photo.uri });
// faces[0].bounds (normalized 0–1) and faces[0].pixelBounds, largest face first

Enable vision on Android and rebuild, or name only the features you use, for example { "vision": ["face-detection"] }, so the app ships only that detector. Face detection uses a bundled model and needs no download.

Embeddings

Semantic search and retrieval with embed, chunkText, and createVectorStore. iOS uses the system embedding model; Android requires the androidEmbeddings option and an explicit model download.

Build options

Every option is off by default. Each one compiles a single feature into the app; leave it off and that feature's native code, models, and permissions stay out of the build, and its functions throw a typed *_NOT_ENABLED error. Changing an option requires a new native build.

Option Enables Adds to the app
llm Text generation, JSON output, tool calling, model downloads, the AI SDK provider LiteRT-LM runtime (about 30 MB of iOS arm64 code, 21 MB on Android); Android minSdkVersion 26
speech transcribe, streamTranscription Android ML Kit speech and microphone permission; iOS microphone usage string
vision Android removeBackground, labelImage, recognizeText, detectFaces true adds every ML Kit vision client and bundled model; an array such as ["face-detection"] adds only those features. iOS needs no option
androidEmbeddings Android embed MediaPipe TextEmbedder (about 25 MB); the model downloads at runtime

The config reference covers bare React Native setup and every option in detail.

More

MIT © Said Kaban.

Explorar proyectos relacionados

Cargando…