Extension runs entirely on Chrome's built-in AI, no server needed

A developer built a called Comment Vibe that runs entirely on Chrome's built-in model, with no server, build tooling, or external . It analyzes the tone of text as you type it into a comment box in real time and suggests softer rewrites for harsh comments. Chrome's Prompt API (accessed through the object) became stable for extensions in Chrome 138 and for the open web in Chrome 148, meaning no flags or origin trial tokens are required — Chrome downloads the model automatically the first time it's used.

Older Chrome builds only expose the legacy window.ai. object, while newer ones expose the global , so code needs to detect both to work everywhere. Getting reliable structured JSON out of the model takes extra effort: few-shot examples combined with prefix prompting mostly forces valid JSON, but the model still occasionally invents different key names, so the response has to be normalized against the expected schema afterward. Debouncing aggressively is essential — waiting 900 milliseconds after the last keystroke before prompting, since running inference on every keystroke ruins the experience.

The Language Detector and Translator APIs also compose well with this setup: detecting a comment's language and translating feedback into it, with caching per language pair.

Key points

  • Built 'Comment Vibe,' a that runs fully on-device via built-in — no server
  • Prompt API is stable without flags: Chrome 138 for extensions, Chrome 148 for the open web
  • Older Chrome exposes window.ai., newer exposes global — detect both for
  • Model output JSON keys can drift, so responses need post-hoc to match the expected schema
  • 900ms debounce after the last keystroke avoids running inference on every single keypress
Read original