Built-in AI Web APIs: Task Inference, Prompt Sessions, Lifecycle, and Fallback
How Chrome built-in AI APIs work, device requirements, model download, polyfills, and hybrid cloud fallback for web apps.
This page summarizes Chrome’s documentation on built-in AI: browser-managed foundation and expert models, JavaScript APIs for common tasks, and patterns for users who cannot run on-device inference. Your site calls APIs such as Summarizer or LanguageModel; Chrome downloads, updates, and runs the models locally when hardware and storage requirements are met.
With built-in AI, your website or web application can perform AI-powered tasks, without needing to deploy, manage, or self-host models.
— Google Chrome, Built-in AI overview
Built-in AI vs server-side AI: when local inference fits
Section titled “Built-in AI vs server-side AI: when local inference fits”Built-in AI is a form of client-side inference: the browser connects your page to the local processor and returns model output through web APIs. Chrome highlights deployment ease (the browser distributes and updates models), hardware acceleration (GPU, NPU, or CPU), local handling of sensitive data, lower latency without a server round trip, offline use after download, and broader reach for preview-tier features.
While client-side AI can handle a large array of use cases, some use cases require server-side support. Server-side AI is a great option for large models, and it can support a wider range of platforms and devices.
— Google Chrome, Built-in AI overview
A hybrid setup uses on-device APIs when available and falls back to the cloud for unsupported browsers, weak devices, or tasks that exceed a small on-device context window. Chrome documents hybrid prompting with Firebase AI Logic and experimental Prompt API and task API polyfills for the same goal from a different angle.
| Approach | Best for | Trade-offs |
|---|---|---|
Built-in task APIs (Translator, Summarizer, …) |
Defined product features (translate, summarize, detect language) | Desktop-focused; foundation-model APIs need strong hardware |
Prompt API (LanguageModel) |
Open-ended prompts, multimodal input | Stricter OS and storage rules; wider API surface to design for |
| Server or hybrid (e.g. Firebase AI Logic) | All users, large context, complex tasks | Data leaves the device; API keys and App Check matter |
| Library-based client AI (TensorFlow.js, Transformers.js) | Custom models you ship | You own model size, caching, and security (cache models) |
Built-in AI APIs: task APIs and the Prompt API
Section titled “Built-in AI APIs: task APIs and the Prompt API”Chrome groups APIs into task APIs (fixed capabilities backed by expert or language models) and the Prompt API (window.LanguageModel), which sends natural language to the on-device foundation model.
You can access built-in AI capabilities primarily with task APIs, such as the Translator API or the Summarizer API. Task APIs are designed to run inference against the best model for the assignment, be it a language or expert model.
— Google Chrome, Built-in AI overview
Built-in AI APIs lists availability by surface (open web, extensions) and stage (Chrome stable, origin trial, Early Preview Program). Examples that matter for production planning:
| API | Role in Chrome docs | Typical status (see live table in docs) |
|---|---|---|
| Translator / Language Detector | Expert models; desktop | Shipped in recent Chrome stable (e.g. 138) |
| Summarizer | Condense long text | Shipped in Chrome 138 stable per Summarizer API guide |
| Writer / Rewriter / Proofreader | Writing assistance | Often developer trial or origin trial |
| Prompt API | Free-form LanguageModel sessions |
Web and extensions at different milestones; see Prompt API |
The Translator and Language Detector APIs use expert models. Summarizer, Writer, Rewriter, Proofreader, and Prompt API use the foundation model (generative). Chrome recommends the People + AI Guidebook for UX when using generative APIs.
Summarizer API: summarize articles and chats in the browser
Section titled “Summarizer API: summarize articles and chats in the browser”The Summarizer API produces summaries in several types (key-points, tldr, teaser, headline), formats (markdown, plain-text), and lengths (short, medium, long). Feature-detect with 'Summarizer' in self, then call Summarizer.availability() before Summarizer.create().
For very long input, Chrome’s summary-of-summaries pattern splits text, summarizes chunks, and recursively summarizes again when concatenated output still exceeds the on-device context window—trading accuracy and speed for fitting client-side limits.
Prompt API (LanguageModel): open-ended prompts and multimodal input
Section titled “Prompt API (LanguageModel): open-ended prompts and multimodal input”The Prompt API exposes LanguageModel.create() and session.prompt() / promptStreaming(). Declare expected input and output modalities up front (text, image, audio) so the browser can refuse unsupported combinations and load the right assets.
Always pass the same options to LanguageModel.availability() that you use for create() and prompt(); Chrome states this is critical for language and modality alignment (inform users of model download).
Hardware, storage, and platform limits for built-in AI
Section titled “Hardware, storage, and platform limits for built-in AI”Requirements apply to developers and end users. Get started with built-in AI and on-device translation requirements repeat the same rules for foundation-model APIs.
| Requirement | Foundation-model APIs (Prompt, Summarizer, Writer, Rewriter, Proofreader) | Translator / Language Detector |
|---|---|---|
| OS | Windows 10/11, macOS 13+, Linux, ChromeOS (Chromebook Plus from stated platform build) | Chrome desktop |
| Mobile | Android, iOS, non–Chromebook Plus ChromeOS not supported for foundation APIs | Not supported on mobile |
| Storage | ≥ 22 GB free on the Chrome profile volume; model removed if free space falls below ~10 GB after download | Expert models; follow current doc sizes |
| GPU path | > 4 GB VRAM | N/A |
| CPU path | ≥ 16 GB RAM and ≥ 4 CPU cores | N/A |
| Network | Unmetered/unlimited for initial model download only | Download rules per API |
| Audio input on Prompt API | GPU required | — |
No data is sent to Google or any third party when using the model.
— Google Chrome, Get started with built-in AI
Check installed model footprint at chrome://on-device-internals. Chrome may pick a larger or smaller Gemini Nano variant after a GPU shader benchmark (model management).
Model lifecycle: availability(), download UX, and browser management
Section titled “Model lifecycle: availability(), download UX, and browser management”availability() states before create()
Section titled “availability() states before create()”The first call to a built-in API can trigger a download. availability() resolves to:
unavailable— device or session options not supporteddownloadable— needs download; user activation may be required beforecreate()downloading— wait for completionavailable— callcreate()immediately
Pass session options (languages, modalities) consistently across availability(), create(), and inference calls.
User activation and download progress
Section titled “User activation and download progress”When status is downloadable or downloading, Chrome expects meaningful user activation before create()—for example a “Summarize” click—checked via navigator.userActivation.isActive (get started).
Use the monitor option on create() and listen for downloadprogress so users see progress and an indeterminate state while the model is extracted into memory (inform users of model download). For client-side-only apps, block features until download completes; for hybrid apps, serve cloud inference immediately and switch to local sessions when ready (Miravia example in the same doc).
Chrome can purge models under disk pressure, hot-swap updates, and resume interrupted downloads—your UI should handle sudden unavailable after purge (understand built-in model management).
Cross-browser fallback: Prompt polyfill, task polyfills, and Firebase
Section titled “Cross-browser fallback: Prompt polyfill, task polyfills, and Firebase”Built-in AI is Chrome-first; Edge aligns on some APIs (e.g. Summarizer in Modern Web Guidance Summarizer guide), while Firefox and Safari may not expose the APIs yet.
Prompt API polyfill (experimental polyfill doc) implements window.LanguageModel over cloud backends or a local Transformers.js backend. Load only when native support is missing:
if (!('LanguageModel' in window)) { await import('prompt-api-polyfill');}For production cloud routing, Chrome recommends Firebase AI Logic Hybrid SDK with Firebase App Check so API keys are not abused from the client. Cloud-backed polyfills lose offline guarantees and may fake downloadprogress (difference from browser Prompt API).
Task API polyfills (built-in AI task API polyfills) mirror Chrome’s internal pattern: task APIs ultimately use system prompts on the foundation model. The package exposes globals such as window.Summarizer when missing, using dynamic imports per API.
Firebase AI Logic is the documented hybrid path: same app code can use Gemini Nano via the Prompt API in Chrome and cloud Gemini via Firebase in other browsers—with explicit user disclosure when data is processed in the cloud.
Debug, best practices, and common mistakes
Section titled “Debug, best practices, and common mistakes”Inspect on-device inference
Section titled “Inspect on-device inference”Open chrome://on-device-internals, use Event Logs to see prompts and errors, and Broker State when localhost fails (debug the built-in model). Misformatted multimodal input can appear as [object Object] in logs—match the shapes shown in the Prompt API multimodal examples.
Dos and don’ts
Section titled “Dos and don’ts”Built-in AI APIs: Do and don’t covers moving from demo to production. Patterns from related guides:
- Mismatching
availability()options vsprompt()options - Summarizing raw HTML instead of
innerText(Summarizer API) - Exposing Gemini or OpenAI keys in client-side polyfill config without App Check
- Assuming the model stays available after long sessions (purge mid-session is possible)
- Client-only toxicity or sentiment checks without server validation (product reviews on-device)
For self-hosted models in the browser (outside built-in AI), prefer explicit caching via the Cache API for large weights (cache models in the browser).
How to check this on your site
Section titled “How to check this on your site”-
Confirm API presence and eligibility: in Chrome on a supported desktop OS, open DevTools on your origin and run feature detection (
'Summarizer' in self,'LanguageModel' in self) andawait Summarizer.availability()orawait LanguageModel.availability({...})with production options, following Get started with built-in AI. -
Verify hardware and model state: visit
chrome://on-device-internals, review storage and Broker State, and use Event Logs after a test prompt as described in Debug the built-in model. -
Walk through first-time download UX: trigger
create()only after user activation, confirmdownloadprogressupdates in your UI using the pattern from Inform users of model download. -
Test fallback paths: in a browser without built-in AI, confirm your dynamic import of Prompt API polyfill or task API polyfills, or Firebase hybrid behavior per Firebase AI Logic.
-
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page does not match Chrome’s current behavior, or you need a detail clarified, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about.