How to Use Transformers.js in a Chrome Extension
We recently released a Transformers.js demo browser extension powered by Gemma 4 E2B to help users navigate the web.
While building it, we ran into several practical observations about Manifest V3 runtimes, model loading, and messaging that are worth sharing.
Who this is for
This guide is for developers who want to run local AI features in a Chrome extension with Transformers.js under Manifest V3 constraints.
By the end, you will have the same architecture used in this project: a background service worker that hosts models, a side panel chat UI, and a content script for page-level actions.
What we will build
In this guide, we will recreate the core architecture of Transformers.js Gemma 4 Browser Assistant, using the published extension