A step-by-step guide to using the Chrome On-Device Prompt API (Gemini Nano) to run AI locally in the browser. Covers enabling the required Chrome flags, checking model availability, triggering the ~1.5 GB model download with progress tracking, prompting the model with optional system prompts, and cleaning up sessions. Angular signals are used to manage download state in a service. The API is Chrome-specific and experimental, with a small model and limited token count.

4m read timeFrom playfulprogramming.com
Post cover image
Table of contents
Conclusion Copy link Link copied!

Sort: