Dev.to
7/17/2026

Experiments with On-device AI — What building on Gemini Nano actually teaches you
Short summary
A developer shares hard-won lessons from building a Chrome extension using Gemini Nano's on-device AI APIs. Key challenges include managing feature-flag-gated task APIs with fallback chains, handling multi-state availability (unavailable/downloadable/downloading/available), and accounting for a much smaller model than cloud APIs. Practical code examples show how to build resilient on-device AI features that work across real user machines.
- •On-device AI APIs are flag-gated and roll out independently — build fallback chains per capability
- •availability() returns four states, not boolean; first calls trigger slow model downloads
- •Small on-device models make length/count instructions approximate — don't display raw output
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



