A reproducible, verifiable starter template for running Chrome's built-in Gemini Nano (OptGuide On-Device Model) locally — import the model, validate integrity, and chat with it through a browser interface.
Security researchers publicly disclosed that Google Chrome (PC) silently downloads approximately 4 GB of AI model data (weights.bin) without notifying users, stored at:
%LOCALAPPDATA%\Google\Chrome\User Data\OptGuideOnDeviceModel\
Analysis confirmed this file is Gemini Nano — Chrome's on-device inference model powering the built-in Prompt API. The file is read-only and re-downloads automatically even after manual deletion.
This project's purpose: Since the model is already on your drive, use it intentionally — launch it in a controlled environment, verify its integrity, and interact with it directly.
Left: Interactive terminal menu | Right: Chat test interface
- Import local model package (
weights.bin+ metadata) - Verify model integrity via SHA256
- Launch an isolated Chrome Profile (no impact on daily browsing data)
- Auto-open chat test page with Echo fallback
NANO Exchange Layer: multi-entity identify/log/protect on top of a single model connection- Male-call/Female-call switching (
callerStyleenvelope + routing prefix) - Multi-party chat scenario page for browser/account isolation tests
- Interactive menu for first-time setup
- Run
start.cmdfrom the project root. - Select
5(Import → Check → Start), or run steps1,2,3individually. - Open the URL shown in the terminal:
http://localhost:<port>/chat-window.html - Open the multi-entity scenario page:
http://localhost:<port>/multi-entity-chat.html
This project adds nano-exchange-layer.js as a mandatory conversion/routing layer for both web chat and extension chat before model calls.
identify: routes byentityId / browserId / accountId / callerStyle / channelrecord: writes audit events for every in/out message and runtime routeprotect: redacts email/token patterns, enforces input limits, throttles entities, and serializes calls to protect single-session model runtimeswitch: uses transformed prompt envelopes so one physical model session can safely serve multiple virtual conversation entities
Demo page: probe/multi-entity-chat.html
Built-in entities:
1. 實體 A (`browser-a / user-001 / default`)
2. 實體 B (`browser-b / user-002 / default`)
3. 實體 C (`browser-c / user-003 / default`)Run method:
- Start local environment with
start.cmd. - Open
http://localhost:<port>/multi-entity-chat.html. - Click
一鍵跑情境to execute a scripted conversation mix. - Verify
timeline + audit + entity snapshotto ensure contexts stay isolated.
⚠️ Do not commit model files to Git.weights.binmust remain local only.
The project's .gitignore excludes:
model/**— onlymodel/.gitkeepandmodel/README.mdare tracked
%LOCALAPPDATA%\Google\Chrome\User Data\OptGuideOnDeviceModel\<version>\
<version> is a date-stamped folder (e.g., 2025.8.8.1141). Multiple versions may exist.
Place files under model/<version>/:
model/<version>/weights.binmodel/<version>/manifest.jsonmodel/<version>/on_device_model_execution_config.pbmodel/<version>/_metadata/verified_contents.json
powershell -ExecutionPolicy Bypass -File .\scripts\Import-OptGuideModel.ps1Or specify a custom source path:
powershell -ExecutionPolicy Bypass -File .\scripts\Import-OptGuideModel.ps1 -SourceVersionDir "C:\Path\To\OptGuideOnDeviceModel\<version>"git status --short
git check-ignore -v model\<version>\weights.binIf git status shows model/<version>/weights.bin, stop and review your .gitignore.
| Mode | Description |
|---|---|
Model mode |
Gemini Nano API detected — responses come from the local model |
Echo mode |
No model API detected — input/output pipeline tested via echo |
If stuck in Echo mode:
- Re-run
start.cmdto restart Chrome via the project script. - Confirm the URL is
http://localhost:<port>/chat-window.html(notfile://). - Open
probe/prompt-api-probe.htmlto diagnose the API path.
| File | Description |
|---|---|
start.cmd |
Windows one-click entry point |
Start-QuickStart.ps1 |
Menu launcher entry |
scripts/QuickStart-UI.ps1 |
Interactive menu flow |
scripts/Import-OptGuideModel.ps1 |
Import model package |
scripts/Check-ModelPack.ps1 |
Verify model integrity |
scripts/Start-GeminiNanoChrome.ps1 |
Launch Chrome + test page |
probe/chat-window.html |
Chat test page |
probe/chat-window.js |
Chat logic with exchange layer |
probe/nano-exchange-layer.js |
Web exchange layer core |
probe/multi-entity-chat.html |
Multi-party scenario UI |
probe/multi-entity-chat.js |
Scenario controller |
probe/prompt-api-probe.html |
Prompt API diagnostic page |
extension/chat-window.html |
Side panel UI with exchange layer |
extension/chat-window.js |
Side panel routing logic |
extension/nano-exchange-layer.js |
Extension exchange core |
guide/index.html |
Visual setup guide |
powershell -ExecutionPolicy Bypass -File .\scripts\Import-OptGuideModel.ps1
powershell -ExecutionPolicy Bypass -File .\scripts\Check-ModelPack.ps1
powershell -ExecutionPolicy Bypass -File .\scripts\Start-GeminiNanoChrome.ps1This project was developed with AI assistance
- All AI-generated code reviewed and tested by the project maintainer
- Critical paths (model import, integrity check, Chrome launch) manually verified on Windows
- Git history reflects intentional, reviewed commits only
- Model files (
weights.bin) excluded from version control by design
⚠️ Disclaimer: While the author has made every effort to review and validate the AI-generated code, no guarantee can be made regarding its correctness, security, or fitness for any particular purpose. Use at your own risk.


