Original: https://codingcat.dev/post/hybrid-web-ai-routing-gemini-nano-firebase-ai-logic-workers
The biggest mistake web engineering teams make when adopting client-side AI is treating it as an all-or-nothing binary choice: either 100% of inference runs in the browser or 100% runs in the cloud. In real-world production, visitor hardware spans everything from an M4 Max MacBook Pro with Chrome's on-device Gemini Nano cached in VRAM to a budget mobile browser on a cellular connection. The solution is Hybrid Browser-to-Edge AI Routing .
By pairing Chrome's local window.LanguageModel API with Firebase AI Logic (or a Cloudflare Worker edge gateway calling Gemini Flash ), you can build a unified TypeScript router that offloads 70%+ of routine summarization, classification, and UI drafting tasks to the user's device at $0 cost while seamlessly routing complex reasoning or unsupported browsers to the edge.
The Mental Model: Adaptive Capability & Complexity Routing
Our hybrid router evaluates three deterministic…