Inspiration

Developers building AI apps face a constant trade-off between privacy, latency, and cost (on-device models) versus deep reasoning quality (cloud models). For #BuildHybridAI 2026, we wanted to make hybrid AI routing transparent, observable, and reliable—so teams can design and stress-test hybrid project specs in one workspace.

What it does

SpecPulse Hybrid is a developer workspace that routes spec-refinement tasks between on-device and cloud models using Firebase AI Logic (firebase/ai) strategies:

  • Routing Modes: Switch live between Auto Hybrid, Local Preferred (InferenceMode.PREFER_ON_DEVICE), and Cloud Preferred (InferenceMode.ONLY_IN_CLOUD).
  • Quick Polish (Local-first): Tightens rough project notes into concise engineering sections, prioritizing on-device Chrome Built-in AI (LanguageModel / Gemini Nano) when available.
  • Deep Critique (Cloud): Performs a rigorous hackathon readiness review, hybrid architecture analysis, edge cases, and next steps via cloud reasoning.
  • Local Privacy Guard: Scrubs emails, phone numbers, API keys, and bearer tokens locally in the browser before any Cloud or Fallback network call.
  • Routing & Fallback Log + Diagnostics: Audits every run with the resolved route badge (Local, Cloud, or Fallback), InferenceMode, PII scrub count, latency, and routing reason, plus a live Diagnostics modal and one-click .md export.

How we built it

  • Frontend: React, TypeScript, Tailwind CSS, Vite, and the firebase/ai SDK (getAI, GoogleAIBackend, getGenerativeModel, InferenceMode, InferenceSource).
  • On-Device Probing: Live capability detection for Chrome's LanguageModel Prompt API (including promptStreaming and download progress monitoring when downloadable).
  • Resilient Cloud Fallback & Streaming: Server-side SSE streaming (/api/infer/stream) on Vercel Serverless Functions & Express using @google/genai (gemini-4-hydrogen with automatic secondary failover to gemini-3.1-flash-lite).

Challenges we ran into

  • Ensuring zero broken states across browsers that do not yet expose on-device Gemini Nano by building a multi-layer fallback chain and transparent route logging.
  • Handling transient cloud demand spikes (503) cleanly via streaming failover, and adapting Express routes to Vercel Serverless Functions for production deployment.

What we learned

Hybrid AI works best when fallback behavior, latency, and privacy boundaries are first-class UI elements rather than hidden backend details.

What's next

  • Adding team spec collaboration and persisted evaluation benchmarks in Cloud Firestore.
  • Expanding offline local queue sync for multi-step spec reviews.

Built With

Share this project:

Updates

Submission history