LocalMode
Chrome AI

Overview

Zero-download, instant AI inference via Chrome built-in Gemini Nano

@localmode/chrome-ai

Zero-download, instant AI inference via Chrome's built-in Gemini Nano model. No model downloads, no bundle size impact, no API keys — the model ships with the browser.

See it in action

Try Smart Writer for a working demo using Chrome AI with automatic fallback to transformers.

Features

  • Zero model downloads — Gemini Nano ships with Chrome
  • Zero bundle size impact — browser-native APIs
  • Instant inference — no model loading delay
  • Implements SummarizationModel and TranslationModel from @localmode/core
  • Feature detection utilities for graceful fallback

Installation

pnpm add @localmode/chrome-ai @localmode/core
npm install @localmode/chrome-ai @localmode/core
yarn add @localmode/chrome-ai @localmode/core
bun add @localmode/chrome-ai @localmode/core

Quick Start

import { summarize } from '@localmode/core';
import { chromeAI } from '@localmode/chrome-ai';

const { summary } = await summarize({
  model: chromeAI.summarizer(),
  text: 'Long article text...',
});

console.log(summary);

Comparison

AspectChrome AITransformers.jsWebLLM
First inferenceInstantAfter model download (50MB–2GB)After model download (1–4GB)
Bundle size0 bytes~2MB (WASM runtime)~1MB
Model downloadNoneRequiredRequired
Browser supportChrome 138+ onlyAll browsersChrome/Edge (WebGPU)
OfflineYes (native)Yes (after cache)Yes (after cache)
Model qualityGood (Gemini Nano)Varies by modelHigh (larger models)

Available APIs

APIStatusLocalMode InterfaceChrome Version
SummarizerStableSummarizationModel138+
TranslatorStableTranslationModel138+
Prompt APIExtensions onlyLanguageModel138+
WriterOrigin trial
RewriterOrigin trial

Only the Summarizer and Translator APIs are currently supported by @localmode/chrome-ai. The Prompt API is restricted to Chrome Extensions and is not available to web pages.

Requirements

Chrome AI is only available on desktop browsers. Mobile (Android/iOS) and Incognito mode are not supported.

RequirementDetail
BrowserChrome 138+ (or Edge 138+)
OSWindows 10+, macOS 13+ (Ventura), Linux, ChromeOS (Chromebook Plus)
Disk space22 GB free on the volume containing your Chrome profile
HardwareGPU with >4 GB VRAM, or CPU with 16 GB+ RAM and 4+ cores

Enabling Chrome AI

  1. Navigate to chrome://flags/#optimization-guide-on-device-model and set to Enabled
  2. Navigate to chrome://flags/#prompt-api-for-gemini-nano and set to Enabled
  3. For higher-quality summaries: chrome://flags/#summarization-api-for-gemini-nanoEnabled with Adaptation
  4. Restart Chrome
  5. Gemini Nano downloads automatically in the background (~1.5 GB)
  6. Verify in DevTools Console:
// Check if Summarizer is ready
await Summarizer.availability(); // "readily" = ready, "after-download" = downloading

// Check if Translator is ready
const caps = await Translator.availability({ sourceLanguage: 'en', targetLanguage: 'es' });

If availability() returns "after-download", the model is still downloading. Creating a session with create() requires a user activation (click, tap, or keypress) to trigger the download.

Provider Factory

import { createChromeAI, chromeAI } from '@localmode/chrome-ai';

// Default instance
const summarizer = chromeAI.summarizer();
const translator = chromeAI.translator({ targetLanguage: 'de' });

// Custom instance
const provider = createChromeAI();
const customSummarizer = provider.summarizer({ type: 'key-points', format: 'markdown' });

Feature Detection

import {
  isChromeAISupported,
  isSummarizerAPISupported,
  isTranslatorAPISupported,
} from '@localmode/chrome-ai';

if (isChromeAISupported()) {
  console.log('Chrome AI is available');
}

if (isSummarizerAPISupported()) {
  console.log('Summarizer API is ready');
}

Next Steps

Showcase Apps

AppDescriptionLinks
Smart WriterChrome AI summarization and translation with automatic transformers fallbackDemo · Source

On this page