Menu

Hybrid on-device + cloud AI in a Chrome extension with Firebase AI Logic
📰

Hybrid on-device + cloud AI in a Chrome extension with Firebase AI Logic

DEV Community: firebase·agebreakco-prog·about 8 hours ago
#NQJxEfWb
#devtofirebase#devto#dev#device#nano
Long article (2844 words) — no AI summary yet.
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.