Gemini Nano in Chrome: a practical guide to in-browser AI (and what shipping it taught us)

Chrome's built-in AI runs Gemini Nano on the visitor's device: no API key, no per-token bill. The APIs, the 22 GB catch, and lessons from shipping it.

Desktop Chrome now ships with a language model inside it. A web page can ask it a question with a few lines of JavaScript, get an answer streamed back word by word, and never send a byte to a server. There is no API key, no account and no per-token bill, because the model runs on the visitor’s own machine.

That model is Gemini Nano, and the APIs around it are called built-in AI. This site uses it in two places: the AI summary in the search box (press /) and “Ask this article” on every post. This guide covers what the APIs are, what they need from the visitor’s machine, how the model gets onto it, and the lessons we learned the hard way when we shipped it.

For the bigger picture of running models locally, with CPU benchmarks against Claude Haiku, see Local LLMs on a CPU. This post is the browser half of that story.

In short

  • What it is: an on-device LLM (Gemini Nano) that Chrome downloads once and shares across every site, plus JavaScript APIs to use it.
  • Status: Translator, Language Detector and Summarizer are stable since Chrome 138. The general-purpose Prompt API is stable on the web from Chrome 148 (it was extensions-only before). Writer and Rewriter are in developer trial, Proofreader in origin trial.
  • The catch: desktop only (Windows 10/11, macOS 13+, Linux, Chromebook Plus), 22 GB of free disk, and either a GPU with more than 4 GB of memory or 16 GB of RAM with 4+ cores. Many visitors will not have it.
  • What it is good at: short, focused jobs on text the page already has: summarise, rewrite, classify, extract, answer from a given passage.
  • What it is bad at: knowledge questions on its own, long documents, anything that must be right every time.
  • The lesson from shipping it: build the experience for visitors without it first, then let the model improve it when it is there.

What “built-in AI” is

With a cloud API, you pay per token and every prompt leaves the device. With a model you bundle yourself (for example through WebLLM or Transformers.js), each site downloads its own copy. Built-in AI is a third option: the browser owns the model. Chrome downloads Gemini Nano once, updates it, and exposes it to pages through standard JavaScript APIs. A visitor who already has it from another site gets your feature instantly.

The APIs come in two kinds:

API What it does Status in Chrome
Prompt API (LanguageModel) General prompting: system prompt, chat, streaming, structured output, image and audio input Stable on the web from 148 (extensions from 138)
Summarizer Key points, TL;DR, teaser or headline of a text Stable from 138
Translator Translate between language pairs Stable from 138
Language Detector Detect the language of a text Stable from 138
Writer / Rewriter Draft new text, or rewrite tone and length Developer trial
Proofreader Grammar and spelling fixes Origin trial

The task APIs (Summarizer, Translator and friends) are narrow but predictable, and they are the safest place to start. The Prompt API is the flexible one, and the rest of this post is mostly about it.

Chrome is not alone: Microsoft Edge implements the same Prompt API shape on top of its own on-device model (Phi-4-mini), so code written for one can run on the other.

What the visitor’s machine needs

From Chrome’s documentation:

Requirement Detail
Operating system Windows 10 or 11, macOS 13+, Linux, ChromeOS on Chromebook Plus. Not Android or iOS
Free disk At least 22 GB on the drive with the Chrome profile. Chrome removes the model again if free space later drops below 10 GB
GPU More than 4 GB of video memory, or
CPU 16 GB of RAM and 4+ cores
Network An unmetered connection for the one-time download

The model itself takes a few GB (reports put the current file at around 4 GB); the 22 GB rule is headroom Chrome insists on. That rule is the one that catches people. On a laptop with 5 GB free, everything looks right, the flags are on, and the model simply never arrives. chrome://on-device-internals tells you why: look for “Enough disk space to install”. On our own test machine it said false (5513 MiB available, 20480 MiB required) until we freed space.

How the model gets onto the device

Every API has an availability() call that returns one of four states:

LanguageModel.availability() and what happens nextunavailabledevice can't run itdownloadableneeds a click or keydownloadingprogress 0 → 100%installingsilent, minutesavailablecreate() is quicksession → clone() per questioncontext read onceNot reported by Chrome: the install step after 100%.Show a status with a timer so it doesn't look stuck.
The four states availability() reports, plus the one it doesn't: the silent install after the download reaches 100%.
  • unavailable: this device can’t run it (hardware, disk, platform or policy). Nothing you can do from the page.
  • downloadable: it can, but the model is not there yet. Calling create() starts the download.
  • downloading: a download is already running, maybe started by another site.
  • available: ready. create() returns a session quickly.

Three things surprised us here:

  1. The download needs user activation. create() only starts a download right after a click or a key press (navigator.userActivation.isActive). Typing counts, which is handy: in our search box, pressing Enter or pausing for two seconds after typing is enough to start it, with no extra button. Call create() from a timer long after the last key press and it fails.
  2. 100% is not the end. The downloadprogress event reports a fraction from 0 to 1. After it reaches 1, Chrome still unpacks, installs and loads the model, and reports nothing while it does. The first time, that took a few minutes on our machine. Our status line originally said “Downloading: 100%” for all of it, and it looked broken. Now it says “Downloaded. Chrome is installing and loading the model (first time only)…” with a seconds counter.
  3. It is shared. Once one site has caused the download, every other site sees available. Do not assume your page is the one paying for it.
const opts = { expectedInputs: [{ type: 'text', languages: ['en'] }],
               expectedOutputs: [{ type: 'text', languages: ['en'] }] };
const state = await LanguageModel.availability(opts);   // same options as create()

const session = await LanguageModel.create({
  ...opts,
  initialPrompts: [{ role: 'system', content: 'Answer only from the text the user gives you.' }],
  monitor(m) { m.addEventListener('downloadprogress', (e) => show(e.loaded)); },
});

The Prompt API in practice

A session is one conversation with its own context window. The parts that matter in practice:

  • Streaming. promptStreaming() returns a stream of text chunks; prompt() waits for the whole answer. For anything a person watches, stream: a small model on a laptop writes a few words at a time, and seeing them arrive makes the wait feel short.
  • Cancelling. Pass an AbortSignal to create(), clone(), prompt() or promptStreaming(). When the reader keeps typing, abort the old answer instead of letting it finish in the background.
  • clone() for long context. clone() forks a session with its context already processed. Put a long document in the session once, then answer each question on a clone. Reading the document is the slow part, so this turns “slow every time” into “slow once”. It is the browser version of the shared-context cache we measured with a local server, where later requests started 110 times faster.
  • append() adds context to a session before you prompt, for example a document the reader just opened.
  • The context window. session.contextWindow and session.contextUsage tell you the limit and how much is used, and measureContextUsage() estimates a prompt before you send it. When a conversation overflows, the oldest turns are dropped (never the system prompt) and a contextoverflow event fires; if even that can’t make room, you get a QuotaExceededError. The size depends on the Chrome version and device, so measure at runtime instead of hard-coding a number.
  • Structured output. Pass a JSON Schema as responseConstraint and the answer is guaranteed to match it. Great for classification or extraction (“return {category, urgency}”), and far more reliable than asking a small model nicely for JSON.
  • Images and audio. Sessions can take image and audio input (declare them in expectedInputs); output is always text. Audio needs a GPU.
  • Sampling. On the web, a samplingMode option (from most predictable to most creative) is in an origin trial; extensions can set temperature and topK directly.
// Read a long article once, answer many questions about it
const base = await LanguageModel.create({ ...opts,
  initialPrompts: [{ role: 'system', content: 'Answer from this article only.\n\n' + articleText }] });

async function ask(question, signal) {
  const s = await base.clone({ signal });          // article already processed
  try {
    let text = '';
    for await (const chunk of s.promptStreaming(question, { signal })) render(text += chunk);
    return text;
  } finally { s.destroy(); }
}

Two smaller rules: the APIs are not available in Web Workers, and cross-origin iframes need an allow="language-model" (or summarizer, and so on) permission.

What we learned shipping it on this site

This site uses Gemini Nano in two ways. The search box finds the closest paragraphs with a small embedding model, then Nano writes a short summary of them. “Ask this article” gives Nano the whole article and answers questions about it. Neither sends anything to a server. Here is what we would tell anyone doing the same.

1. Design for visitors without it first. Most visitors are on phones, other browsers, or machines that fail the hardware check. The search works without Nano (the paragraphs are the result); the AI card is an extra. When it is unavailable, we show one collapsed line, “AI assisted summary · not available”, with the reason inside, rather than a big empty box or nagging.

2. Stream, show progress, and cancel. We show a spinner in the search bar while anything is working, stream answers token by token, and abort the running answer the moment the reader types again. Waiting is fine; waiting without feedback is not.

3. Put retrieval in front of the model, and let it say “nothing”. Our first version always gave Nano the six “closest” paragraphs, even for “where is tajmahal?”. Nano dutifully wrote four paragraphs about why the ClickHouse paragraphs didn’t mention the Taj Mahal. Vector search always returns something; it needs a minimum score. Off-topic questions scored 0.05 to 0.23 and real ones 0.39 and up, so anything under 0.30 now means “nothing on this site matches” and the model is never asked.

4. Expect a small model to ramble, and guard against it. Told to “say so in one sentence” when the paragraphs don’t answer, Nano wrote four paragraphs. Small models can also get stuck repeating a sentence. Strict instructions help (1 to 4 sentences, the direct answer first), but code helps more: we stop the stream if a sentence repeats, and cut it at a hard word limit.

5. Read long context once, ahead of time. For “Ask this article” the whole article (around 2,000 to 6,000 tokens on this blog) goes into a session as soon as the search box opens, while the reader is still typing. Each question then runs on a clone(). On our machine reading a 2,000-word article took around twenty seconds, so starting early hides most of it. If an article doesn’t fit the context window, we send only the sections that best match the question, and say so.

6. Label AI output clearly. Every AI answer sits in its own card with a sparkle icon and “generated on your device by Chrome’s Gemini Nano”, separate from the real paragraphs below it. Readers should always know which text is the author’s and which is the model’s.

7. Keep the prompt short and the job narrow. “Use only these paragraphs; keep numbers exactly as written; 1 to 4 sentences; plain text” works. Long, clever system prompts mostly eat context window. Nano is a summariser and rephraser, not an oracle.

Built-in AI vs other ways to run AI in the browser

Chrome built-in AI Your own model (WebLLM, Transformers.js) Cloud API
Download for the visitor Once per browser, shared by all sites Once per site, your model’s size None
Who it works for Desktop Chrome/Edge that pass the hardware check Any modern browser with enough memory (WebGPU helps) Everyone
Model choice Gemini Nano (or Phi in Edge), no choice Any model you can fit Any
Privacy Text never leaves the device Text never leaves the device Text goes to the provider
Cost Free Free (you host the files) Per token
Quality Small model: good at short, focused tasks Depends on the model; small ones are similar Frontier quality

Our search uses both browser columns: a 23 MB embedding model we ship ourselves (it works in every browser) for finding paragraphs, and Chrome’s built-in model only for the summary on top. Each does what it is good at, and the page still works when the built-in half is missing.

When not to use it

  • When every visitor must get the feature: phones and most mid-range laptops can’t run it.
  • For facts the model would have to know: a small model with no source text will make things up.
  • For long documents that don’t fit the context window and can’t be split.
  • For anything where a wrong answer is costly and hard to check.

FAQ

Is Gemini Nano in Chrome free to use?

Yes. It runs on the visitor’s device, so there is no API key and no per-token cost. You pay nothing; the visitor pays with disk space and compute.

How big is the Gemini Nano download?

A few gigabytes, downloaded once per browser and shared by every site. Chrome also requires 22 GB of free disk before it will install it, and removes it if free space drops below 10 GB.

Why does my page say the model is unavailable?

Usually hardware or disk. Open chrome://on-device-internals and check the model status and “Enough disk space to install”. Mobile Chrome, iOS and devices below the GPU/RAM requirements report unavailable.

Does the prompt leave the device?

No. The model runs locally; the page sends nothing to Google or anyone else for inference.

Does it work in Edge or Firefox?

Edge implements the same Prompt API with its own on-device model (Phi-4-mini). Firefox and Safari do not currently ship these APIs, so feature-detect with 'LanguageModel' in self.

What is the best first project?

Something the page already has text for: summarise an article, suggest tags, classify a support message with a JSON schema, or answer questions about the current page with clone(). Keep a non-AI fallback.

Sources: Chrome’s built-in AI APIs, Prompt API and Summarizer API documentation; Microsoft’s Prompt API in Edge documentation. Statuses as of November 2026.