# LocalMode
**Local-first, privacy-first, offline-first AI for the browser.** Run ML models entirely in your browser. No servers. No API keys. Your data never leaves your device. [](./LICENSE) [](https://localmode.dev) [](https://localmode.ai) [](https://localmode.ai/blocks) - Docs website: https://localmode.dev - UI Components: https://localmode.ai - Blocks & Apps: https://localmode.ai/blocks ## What is LocalMode? LocalMode is a monorepo of packages for building AI-powered applications that run 100% in the browser. Everything from embeddings and vector search to LLM chat, vision, audio, agents, and structured output works offline after the initial model download. **16 packages. 36 demo blocks. Zero cloud dependencies.** ### Why LocalMode? - **Privacy** -- Your data never leaves your device. No telemetry, no tracking, no network requests from core. - **Offline** -- Works without internet after model download. Automatic fallbacks for every capability. - **Fast** -- No network latency. WebGPU acceleration where available. Instant inference. - **Free** -- No API costs, no rate limits, unlimited usage. - **Universal** -- Works in Chrome, Edge, Firefox, and Safari. Adapts to device capabilities. - **Interoperable** -- Vercel AI SDK patterns. LangChain.js adapters. Import from Pinecone/ChromaDB. --- ## Packages | Package | Version | Description | | ------- | ------- | ----------- | | [`@localmode/core`](./packages/core/README.md) | [](https://www.npmjs.com/package/@localmode/core) | Zero-dependency core -- VectorDB (HNSW, typed metadata, WebGPU search, SQ8/PQ quantization), pipelines, inference queue, model cache, agent framework (ReAct + tools with opt-in human-in-the-loop tool approval + memory), evaluation SDK, vector import/export, multimodal content, knowledge base engine (`createKnowledgeBaseEngine` + frozen `KnowledgeBaseEngine` contract), all interfaces | | [`@localmode/react`](./packages/react/README.md) | [](https://www.npmjs.com/package/@localmode/react) | 64 React hooks, 10 pipeline step factories, batch/list processing, and browser helpers -- incl. `useEncryptedVault` passphrase-locked encrypted storage, `useAgent` tool-approval surface (`pendingApproval`/`approve`/`deny`), `useRerank` document reranking, `useModelLoad` unified model-download lifecycle, `useChat` usage tracking + `regenerate()` reply variants, `useProviderFallback` per-capability Chrome AI ⇄ Transformers.js resolution, `usePhotoLibrary` shared CLIP photo library, and `useKnowledgeBase` knowledge-base session orchestration | | [`@localmode/ai-sdk`](./packages/ai-sdk/README.md) | [](https://www.npmjs.com/package/@localmode/ai-sdk) | Vercel AI SDK provider for local models | | [`@localmode/transformers`](./packages/transformers/README.md) | [](https://www.npmjs.com/package/@localmode/transformers) | HuggingFace Transformers.js provider -- 26 model factories covering embeddings, classification, vision, audio, OCR, multimodal (CLIP), and LLM inference via ONNX (Qwen3.5 vision support) | | [`@localmode/webllm`](./packages/webllm/README.md) | [](https://www.npmjs.com/package/@localmode/webllm) | WebLLM provider for LLM inference via WebGPU -- 32 curated models including DeepSeek-R1, Qwen3, Llama 3.2, Phi 3.5 Vision | | [`@localmode/wllama`](./packages/wllama/README.md) | [](https://www.npmjs.com/package/@localmode/wllama) | GGUF model provider via llama.cpp WASM -- 30 curated models (text, vision, embeddings, reranking), true streaming, structured output (JSON mode), reasoning mode, WebGPU acceleration, tool calling, grammar sampling (GBNF), LoRA adapters, model management, GGUF model discovery (`searchGGUFModels`/`listGGUFFiles`), 160K+ HuggingFace models, universal browser support | | [`@localmode/litert`](./packages/litert/README.md) | [](https://www.npmjs.com/package/@localmode/litert) | Google LiteRT-LM provider (`.litertlm` models, WebGPU + CPU WASM fallback). Text-only, early preview. Catalog ships Gemma 4 E2B/E4B and Qwen3 0.6B, all verified end-to-end. Gated Gemma 3n / Gemma 3 1B loadable via custom URL. | | [`@localmode/mediapipe`](./packages/mediapipe/README.md) | [](https://www.npmjs.com/package/@localmode/mediapipe) | Google MediaPipe Tasks provider -- real-time hand/pose/face landmark tracking, gesture recognition, image & audio classification, language detection. WASM + WebGL, all browsers. | | [`@localmode/chrome-ai`](./packages/chrome-ai/README.md) | [](https://www.npmjs.com/package/@localmode/chrome-ai) | Chrome Built-in AI provider -- your app ships no model files; Chrome supplies Gemini Nano. Automatic fallback | | [`@localmode/langchain`](./packages/langchain/README.md) | [](https://www.npmjs.com/package/@localmode/langchain) | LangChain.js adapters -- drop-in local embeddings, chat, vector store, and reranker for existing LangChain apps, plus `createLangChainKnowledgeBaseEngine` (the `KnowledgeBaseEngine` contract over LangChain adapters) | | [`@localmode/devtools`](./packages/devtools/README.md) | [](https://www.npmjs.com/package/@localmode/devtools) | In-app AI observability -- 9 React hooks via the `@localmode/devtools/react` subpath for model cache, VectorDB stats, and inference queue data (the bundled DevTools widget UI was **removed in v3.0.0** in favor of the hooks + the `ui/devtools` registry family and `ui/blocks/devtools-drawer` at localmode.ai) | | [`@localmode/bench`](./packages/bench/README.md) | [](https://www.npmjs.com/package/@localmode/bench) | LocalMode Bench harness -- cross-runtime browser-AI benchmarking with MLPerf-Client-compatible metrics (TTFT, pp/tg throughput), raw trace capture, versioned submission-integrity rules, and leaderboard aggregation; powers the public leaderboard at [localmode.ai/bench](https://localmode.ai/bench) | | [`@localmode/pdfjs`](./packages/pdfjs/README.md) | [](https://www.npmjs.com/package/@localmode/pdfjs) | PDF text extraction with PDF.js | | [`@localmode/dexie`](./packages/dexie/README.md) | [](https://www.npmjs.com/package/@localmode/dexie) | Dexie.js storage adapter with schema versioning and transactions | | [`@localmode/idb`](./packages/idb/README.md) | [](https://www.npmjs.com/package/@localmode/idb) | Minimal IndexedDB storage adapter using the idb library | | [`@localmode/localforage`](./packages/localforage/README.md) | [](https://www.npmjs.com/package/@localmode/localforage) | Cross-browser storage adapter with automatic fallback | --- ### `@localmode/ui` — UI registry (not an npm package) [**LocalMode UI**](https://localmode.ai) is a shadcn-style registry of copy-owned AI UI components: **107 primitives across 10 families**, plus **37 blocks** that wire them to real on-device models. Like shadcn/ui, you install with the shadcn CLI and own the copied code, styled with shadcn/ui CSS variables so it inherits your theme. See the [docs](https://localmode.ai/docs), [installation guide](https://localmode.ai/docs/installation), and [`apps/ui/README.md`](./apps/ui/README.md). The primitives are presentational and install with **zero `@localmode/*` packages**, so they work with any React AI app — the LocalMode hooks (on-device), the [Vercel AI SDK](https://localmode.ai/docs/use-with-ai-sdk), or [your own data](https://localmode.ai/docs/bring-your-own-data). Local-first by design, cloud-compatible by contract. ```bash # components.json → { "registries": { "@localmode": "https://localmode.ai/r/{name}.json" } } npx shadcn@latest add @localmode/ui/conversation/message # a single component npx shadcn@latest add @localmode/ui/conversation # a whole family npx shadcn@latest add @localmode/ui/all # the whole catalog ``` | Family | Count | What it covers | | ------ | ----- | -------------- | | [Conversation](https://localmode.ai/docs/conversation/conversation) | 24 | Chat shell, prompt input, reasoning, sources, tools, agent timelines, branches, citations | | [Local-First](https://localmode.ai/docs/local-first/model-downloader) | 25 | Model download/selection, Hub search, capability gates, storage quota, cache status, VectorDB observability | | [Results & Insights](https://localmode.ai/docs/results/confidence-score-badge) | 12 | Confidence badges, scored result bars, similarity meters, evaluation dashboards, entity displays | | [Input Controls](https://localmode.ai/docs/input-controls/char-limit-indicator) | 11 | Char-limit rings, fill-mask inputs, mode pickers, parameter sliders, slash-command palettes | | [Audio](https://localmode.ai/docs/audio/waveform-activity-bars) | 10 | Voice buttons/orbs, waveform bars, TTS voice pickers, streaming-speech panels, transcript viewers | | [Media & Vision](https://localmode.ai/docs/media-vision/media-dropzone) | 7 | Image dropzones, bounding-box overlays, before/after viewers, webcam canvas, result galleries | | [Data & Documents](https://localmode.ai/docs/data-documents/file-dropzone) | 5 | File dropzones, indexed-document cards, format badges, category facets, chunk visualizers | | [Security & Privacy](https://localmode.ai/docs/security-privacy/password-strength-bar) | 5 | Password-strength bar, differential-privacy controls, passphrase gate, vault item card, lock badge | | [Artifacts & Canvas](https://localmode.ai/docs/artifacts/artifact) | 4 | Docked canvas, sortable data tables, charts, code diffs — output rendered *beside* the chat | | [DevTools](https://localmode.ai/docs/devtools) | 4 | Inference-queue monitor, event-log viewer, pipeline-run inspector, model-cache table | **Blocks** are complete experiences composed from the primitives — the wiring layer, and the only items that depend on `@localmode/*`. Each runs real models on-device and gates its download behind an explicit in-block action. Try them in the [`/blocks` gallery](https://localmode.ai/blocks), then install with `npx shadcn@latest add @localmode/ui/blocks/Built for Privacy. Designed for Developers. Powered by the Browser.