Inspiration
Orthopedic specialists, physical therapists, and sideline sports physicians face two opposing clinical realities every day:
- Patient Privacy (PHI) & Unstable Connectivity: Doctors dictate sensitive Protected Health Information (PHI) constantly, often inside shielded radiology rooms, hydrotherapy wings, or sports fields with unstable Wi-Fi. Sending every voice note to the cloud adds latency, token costs, and privacy concerns.
- Complex Multimodal Diagnostics: When analyzing orthopedic X-rays alongside specific anatomical structures to prescribe multi-phase rehabilitation protocols, small local models are not enough—cloud-grade multimodal reasoning is essential.
We built OrthoHybrid AI to bridge both worlds seamlessly using Firebase AI Logic Hybrid Inference (firebase/ai).
What it does
- Interactive 242-Mesh 3D Skeleton: Clinicians rotate a full 3D human skeleton in 360 degrees and click any of the 242 individual bones and intervertebral discs (such as Right Patella or L4-L5 Intervertebral Disc) to inject exact anatomical context and pain severity into every prompt.
- Privacy-First On-Device SOAP Triage (
InferenceMode.PREFER_ON_DEVICE): Raw clinical voice dictations are structured into clean 4-part SOAP clinical notes locally via Chrome's built-in Gemini Nano first—keeping sensitive patient text on-device with zero network latency and offline resilience, while automatically falling back to Gemini 2.5 Flash in the cloud if local inference is unavailable. - Multimodal X-Ray Cloud Escalation (
InferenceMode.PREFER_IN_CLOUD): Radiographic image analysis (inlineDataBase64 + selected 3D bone context) automatically routes through Firebase AI Logic to Gemini 2.5 Flash (GoogleAIBackend), generating radiographic observations and phased rehabilitation plans. - Live SDK Telemetry Inspector: An audit table inspects
result.response.inferenceSource(on_devicevsin_cloud), latency in ms, and local PHI retention count in real time.
How we built it
- Firebase AI Logic Web SDK (
[email protected]+/firebase/ai): ConfiguredgetAI(app, { backend: new GoogleAIBackend() })andgetGenerativeModelwithInferenceMode.PREFER_ON_DEVICE,onDeviceParams(multilingual Chrome Prompt API configuration),inCloudParams(gemini-2.5-flash), and optional Firebase App Check (ReCaptchaEnterpriseProvider). - 3D WebGL Anatomy: Built with React, TypeScript, Vite, Tailwind CSS, Three.js,
@react-three/fiber, and@react-three/dreiraycasting 242 skeletal meshes. - Voice & Bilingual UX: Native Web Speech API voice dictation, Offline Clinic Mode simulator, and instant
EN/EStoggle.
Challenges we ran into
Balancing strict local execution during network drops with seamless cloud escalation when switching from text-only clinical notes to Base64 X-ray images. Inspecting result.response.inferenceSource allowed us to surface transparent routing feedback directly to the physician.
What we learned
Firebase AI Logic's unified getGenerativeModel API eliminates the complexity of maintaining two separate codebases for Chrome's W3C Prompt API and Cloud Gemini endpoints—making privacy-by-default healthcare AI practical on the web today.
What's next for OrthoHybrid AI
Enforcing dual structured JSON schemas (responseSchema + responseConstraint) for HL7 FHIR clinical exports, and expanding to Android and iOS clinical tablets via Firebase AI Logic.

