NanoOrCloud is a web app that helps developers decide which AI tasks to run on-device (Gemini Nano in Chrome) and which to send to the cloud. All inference goes through Firebase AI Logic hybrid inference, with App Check protecting the cloud path. Developers paste their real prompts, compare quality, latency and estimated cost side by side, and get a routing recommendation plus projected monthly savings. It replaces guesswork with data, so small teams can cut AI costs without hurting quality.

How Firebase AI Logic is used: the app uses the Firebase AI Logic Hybrid Inference SDK for Web (firebase/ai). It initialises the Gemini Developer API backend with getAI, creates one model instance per task with InferenceMode.ONLY_ON_DEVICE and one with InferenceMode.ONLY_IN_CLOUD, and calls generateContent() on both so it is unambiguous where each answer came from. A cloud judge model (ONLY_IN_CLOUD) scores the answers with structured JSON output. initializeDeviceModel() runs on the user's click before on-device requests. App Check protects the Gemini API (debug tokens are used for local development). Routing thresholds are adjustable sliders with in-code defaults (0.90 / 0.70); no system prompt is set and Remote Config is not used.

Features:

  • Add real task prompts (summarize, classify, extract JSON, rewrite, extract fields from an exchange notification) or load the five starter presets
  • Side-by-side runner: every task runs on-device and in the cloud, with outputs, latency, estimated cost and errors in one table
  • Deterministic checks (non-empty, valid JSON with expected keys, length bounds) plus a cloud judge score (1-5), shown in random A/B order
  • Per-task routing recommendation (on-device / escalate / cloud) with confidence and a short reason; thresholds are adjustable sliders
  • Savings calculator: monthly cloud cost before and after, and savings, clearly labeled as an estimate
  • One-page report with JSON + TypeScript export, copy to clipboard
  • Sample report mode (static sample data, labeled SAMPLE) for browsers without the on-device model

Value proposition: small teams can cut AI costs without hurting quality — by measuring, per task, what the on-device model can already handle. Quality scores are estimates; the app does not claim features that are not built.

Try it out: https://offrecord-4161f.web.app/ Code: https://github.com/BaraGitDoodle-bit/nanoorcloud Demo video: https://www.youtube.com/watch?v=FkcT_pua0Qg

Built with: Firebase AI Logic, Firebase App Check, Firebase Hosting, Gemini Nano, Gemini API, Chrome, TypeScript, React, Vite

Built With

Share this project:

Updates

Submission history