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
SummarizationModelandTranslationModelfrom@localmode/core - Feature detection utilities for graceful fallback
Installation
pnpm add @localmode/chrome-ai @localmode/corenpm install @localmode/chrome-ai @localmode/coreyarn add @localmode/chrome-ai @localmode/corebun add @localmode/chrome-ai @localmode/coreQuick 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
| Aspect | Chrome AI | Transformers.js | WebLLM |
|---|---|---|---|
| First inference | Instant | After model download (50MB–2GB) | After model download (1–4GB) |
| Bundle size | 0 bytes | ~2MB (WASM runtime) | ~1MB |
| Model download | None | Required | Required |
| Browser support | Chrome 138+ only | All browsers | Chrome/Edge (WebGPU) |
| Offline | Yes (native) | Yes (after cache) | Yes (after cache) |
| Model quality | Good (Gemini Nano) | Varies by model | High (larger models) |
Available APIs
| API | Status | LocalMode Interface | Chrome Version |
|---|---|---|---|
| Summarizer | Stable | SummarizationModel | 138+ |
| Translator | Stable | TranslationModel | 138+ |
| Prompt API | Extensions only | LanguageModel | 138+ |
| Writer | Origin trial | — | — |
| Rewriter | Origin 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.
| Requirement | Detail |
|---|---|
| Browser | Chrome 138+ (or Edge 138+) |
| OS | Windows 10+, macOS 13+ (Ventura), Linux, ChromeOS (Chromebook Plus) |
| Disk space | 22 GB free on the volume containing your Chrome profile |
| Hardware | GPU with >4 GB VRAM, or CPU with 16 GB+ RAM and 4+ cores |
Enabling Chrome AI
- Navigate to
chrome://flags/#optimization-guide-on-device-modeland set to Enabled - Navigate to
chrome://flags/#prompt-api-for-gemini-nanoand set to Enabled - For higher-quality summaries:
chrome://flags/#summarization-api-for-gemini-nano→ Enabled with Adaptation - Restart Chrome
- Gemini Nano downloads automatically in the background (~1.5 GB)
- 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
Summarization
Summarize text with configurable type, format, and length
Translation
Translate text between languages instantly
Fallback Patterns
Graceful degradation for non-Chrome browsers