AI disclosure: This article was written with AI assistance (Claude). The project it describes was also built with AI assistance. All code below is copied from the public repository, and the behaviour described matches its unit tests.
Chrome now ships a small language model, Gemini Nano, that a page or extension can call through the Prompt API. That is great for privacy and cost: the text never leaves the machine and you pay nothing per call. It is less great for anything long. Nano's context window is small, it isn't available on every machine, and the first call may have to download the model.
Firebase AI Logic has a "hybrid" mode that wraps both worlds in one getGenerativeModel() call: you say whether you prefer on-device or cloud, and the SDK falls back to the other one. That covers the basic case.…