GitHub - Vishwamitra/explain-this: Select text on any page, right-click, and get a plain-language explanation, powered by a local in-browser LLM. No server, no API key. · GitHub
/" data-turbo-transient="true" />
Skip to content
Search or jump to...
Search code, repositories, users, issues, pull requests...
-->
Search
Clear
Search syntax tips
Provide feedback
--><br>We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
Saved searches
Use saved searches to filter your results more quickly
-->
Name
Query
To see all available qualifiers, see our documentation.
Cancel
Create saved search
Sign in
/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
Vishwamitra
explain-this
Public
Notifications<br>You must be signed in to change notification settings
Fork
Star
main
BranchesTags
Go to file
CodeOpen more actions menu
Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit
History<br>28 Commits<br>28 Commits
.github/workflows
.github/workflows
public/icons
public/icons
src
src
.gitignore
.gitignore
LICENSE
LICENSE
README.md
README.md
manifest.config.ts
manifest.config.ts
package-lock.json
package-lock.json
package.json
package.json
tsconfig.json
tsconfig.json
vite.config.ts
vite.config.ts
View all files
Repository files navigation
Explain This
Select any text on a page, right-click, hit "Explain This," get a plain-language explanation. Runs entirely in your browser tab using a local LLM over WebGPU. No server, no API key, nothing ever leaves your machine.
Why
I was messing around with Ollama and vLLM locally for privacy-sensitive stuff (translating docs, RAG over my own notes) and got curious about WebLLM, which runs models straight in the browser via WebGPU instead of needing a separate server process. It used to be pretty slow and limited. Turns out it's gotten a lot better lately, so I built this to actually test it on something real instead of just reading benchmarks.
Requirements
Chrome or Edge, recent desktop version (needs WebGPU, which is Chrome 113+ roughly). Won't work on browsers without WebGPU support, and the extension will tell you that instead of just failing silently.
First run
The first time you use it, it downloads the model (Llama 3.2 1B, quantized, about 880MB) and caches it in the browser. That happens once. Every explanation after that is instant and fully offline. You'll see a progress bar the first time so it's obvious what's happening.
Installing it (dev mode, not on the Chrome Web Store yet)
git clone https://github.com/Vishwamitra/explain-this.git<br>cd explain-this<br>npm install<br>npm run build
Then in Chrome: go to chrome://extensions, turn on Developer mode, click "Load unpacked," and point it at the dist folder.
How it works
The tricky part of this project isn't the AI, it's Chrome's extension architecture. Manifest V3 background scripts are service workers, and service workers don't have access to WebGPU. So the model can't just live in the background script.
The fix is a chrome.offscreen document: a hidden page Chrome lets extensions spin up that has full DOM/WebGPU access, unlike a service worker. That's where the actual model lives and runs.
So the flow is:
You right-click selected text, the background script gets the selection and the tab id from Chrome directly
Background creates the offscreen document if it's not already running, and forwards the text to it
The offscreen document runs the model and streams tokens back
Background relays those streamed tokens to the content script in your tab, since the offscreen document has no way to talk to a tab directly
The content script renders them into a small popup near your selection
Three separate contexts talking to each other through chrome.runtime messages, because that's genuinely the only way to do this under MV3 right now.
Changing the model
The model is a single constant in src/shared/config.ts. WebLLM supports a lot of models at different sizes, the one here is picked for a small first download, not necessarily the best quality. Swap it if you want something bigger/better and don't mind a longer first download.
License
MIT, see LICENSE.
About<br>Select text on any page, right-click, and get a plain-language explanation, powered by a local in-browser LLM. No server, no API key.<br>Resources<br>Readme<br>MIT license<br>Activity<br>Stars<br>2 stars<br>Watchers<br>0 watching<br>Forks<br>0 forks<br>Report repository
Releases
Packages
Contributors
Languages
You can’t perform that action at this time.