What problem does it solve?
Firebase AI Logic removes the need to run and maintain a dedicated backend for generative AI by enabling web and mobile apps to call Gemini models directly from client code, simplifying integration of text, image, audio, and document inference into user-facing experiences.
Core Features & Use Cases
- Client-side Gemini access: Initialize and call Gemini Developer or Vertex Gemini APIs from JavaScript without managing server infrastructure.
- Multimodal inference: Send images, audio, video, and PDFs as inline data or Cloud Storage references for captioning, Q&A, and object detection.
- Streaming & chat: Support for streaming partial responses, multi-turn chat sessions, and hybrid on-device/cloud inference with Gemini Nano fallbacks.
- Structured outputs & image generation: Enforce JSON schemas for reliable structured responses and generate images using image-capable Gemini models.
- Production guidance: Recommendations for App Check, Remote Config for dynamic model switching, and billing considerations for Developer vs Vertex APIs.
- Use Case: Build an in-app assistant that answers questions about uploaded photos, generates descriptive captions, and streams responses to improve UX.
Quick Start
Initialize the Firebase AI Logic SDK in your web app, configure the GoogleAIBackend, create a GenerativeModel with your chosen Gemini variant, and call generateContent or generateContentStream with your prompt.