How to Use Transformers.js in a Chrome Extension
AI-generated summary of reporting by Huggingface Blog. Read the original for the full story.
Why it matters
Developers can now build Chrome extensions that run LLM inference fully locally using Transformers.js, avoiding server costs and keeping user data on-device under Manifest V3 constraints.
Hugging Face published a guide and open-source example showing how to run its Transformers.js tool, software that runs AI models directly in a web browser, inside a Chrome browser extension. The example extension uses the Gemma 4 E2B model as a local chat assistant that can read web pages, manage tabs, and search browsing history without sending data to any server. It matters for developers building browser-based AI helpers and for users who want AI features that process data entirely on their own computer.
Hugging Face released a working reference architecture and open-source code for shipping local AI in Chrome extensions under Manifest V3, using Gemma 4 E2B plus a MiniLM embedding model. The pattern, background service worker hosting models, side panel chat UI, content script for page access, lets teams offer privacy-friendly AI features without inference servers or per-token API spend. The trade-off is managing model downloads, MV3 service-worker restarts, and broad host permissions that raise store-review risk.
The guide recreates Hugging Face's Gemma 4 Browser Assistant: a background service worker hosts Transformers.js pipelines, text-generation with onnx-community/gemma-4-E2B-it-ONNX (q4f16) using DynamicCache KV caching, and feature-extraction with all-MiniLM-L6-v2 (fp32) for semantic search over history and page content. Typed message contracts link side panel and content script; tool calls are parsed from Gemma-4 chat-template tokens via extractToolCalls. State is split across background memory, chrome.storage.local, and IndexedDB; artifacts cache under the extension origin. MV3 service-worker suspension requires re-initializable model state.
Read the original
This summary exists to save you time, not to replace the source.
Key terms
Transformers.js Gemma 4 E2B Manifest V3 Chrome DynamicCache IndexedDB chrome.storage.local
Was this summary useful?
One click, anonymous. It tells us which summaries to re-run.
Related reading
Code-driven AI illustrations are more useful than images from dedicated image models
Code-driven AI illustrations let designers edit assets directly in code, saving time on iteration and ensuring consistency, which is a game-changer for teams that need rapid, reusable visual content.
datasette-charts 0.5a0
Datasette Charts 0.5a0 adds calendar heatmaps, box plots and active-over-time charts, enabling richer data visualisation directly in the browser without extra libraries.
A hierarchical note-taking app for building large personal knowledge bases
Trilium lets users build and navigate massive personal knowledge bases without duplicating content, saving time on organization and retrieval.
Desktop apps in Go with native UI or web frontend
Go developers can now ship cross-platform desktop and mobile apps in a single small binary without cgo or heavy runtimes, cutting build complexity and deployment size.
OpenBitFun: an agent workspace with four harness modes and phone remote control
OpenBitFun lets agents run on any machine and be controlled from a phone, eliminating the need to choose between local power and remote access, saving developers time switching contexts.