Add image generation to your apps with Imagen 3 in Firebase: Web Architecture & Implementation Guide Google added Imagen 3 and Imagen 3 Fast image-generation support to the Vertex AI in Firebase SDKs, letting web, Android, iOS, and Flutter apps call the models from client code via generateImages() while keeping API credentials off the wire and enforcing Firebase App Check. The offering, since renamed Firebase AI Logic, also supports centrally managed server-side prompt templates and configurable generation settings such as aspect ratio, watermarking, and safety filters. CodingCat.dev's breakdown walks through wiring the SDK into TypeScript, Next.js, Astro, SvelteKit, React, and Angular apps. Original: https://codingcat.dev/post/firebase-2025-03-imagen3-support-on-vertex-ai-sdks https://codingcat.dev/post/firebase-2025-03-imagen3-support-on-vertex-ai-sdks Calling frontier multimodal models directly from a web or mobile client is a security minefield if you expose raw API keys or hardcode brittle system prompts in your frontend bundle. Following the announcement of Add image generation to your apps with Imagen 3 by Miguel Ramos on the Official Firebase Blog https://firebase.blog/posts/2025/03/imagen3-support-on-vertex-ai-sdks/ 2025-03-03 , here is our hands-on CodingCat.dev breakdown of what actually shipped, how it works under the hood, and how we wire it into production TypeScript, Next.js, Astro, SvelteKit, React, and Angular applications. Update: As of May 2025, Vertex AI in Firebase has evolved into an offering named Firebase AI Logic to give developers more options for easily integrating generative AI models into their apps. Check out the documentation to learn more. As a Google Developer Expert GDE for Firebase and Senior Solutions Architect at CodingCat.dev, I evaluate every Firebase update through one lens: does it reduce boilerplate while keeping our runtime security and cloud bills predictable? Firebase AI Logic lets you invoke Gemini and Imagen models from client and edge apps using the Firebase Web SDK while keeping your API credentials off the wire, enforcing Firebase App Check, and managing server-side prompt templates centrally. AJ Pro-Tip from Alex: Combine Firebase AI Logic with server prompt templates, Firebase Remote Config feature flags, and project spend caps so you can iterate on prompts or swap Gemini models instantly without redeploying your Next.js or Astro frontend. Vertex AI in Firebase allows developers to integrate generative AI into their applications by providing a streamlined, serverless, and secure way to access the Gemini AI models. Used by thousands of apps today, it handles the complexities of AI infrastructure, simplifies development, letting you focus on building great user experiences. Now, we’re taking that further adding support for the Imagen models https://cloud.google.com/vertex-ai/generative-ai/docs/image/overview Imagen 3 and Imagen 3 Fast , in addition to the Gemini family of models. This lets you add image generation directly to your Android, iOS, Flutter, and Web applications, bringing the same ease of use and scalability you expect. The Vertex AI in Firebase SDKs allow to choose between speed and quality giving you access to both Imagen 3 models: Here’s what’s possible, directly within your client-side code: String prompt = "A futuristic cityscape at sunset"; - that’s all it takes. Take a look at these photos generated with Imagen 3: To integrate Imagen 3 into your Firebase project, you should enable Vertex AI in Firebase, add the Firebase SDK to your project, and initialize the service. Once set up, generate an image by initializing your chosen Imagen model and calling generateImages with your text prompt. // Initialize the Vertex AI service let // Initialize with an Imagen 3 model that supports your use case // like "imagen-3.0-generate-002" or "imagen-3.0-fast-generate-001" let // Provide an image generation prompt – this could come from user input let // To generate an image, call generateImages with the text prompt let // Handle the generated image guard fatalError } let js // Specify the number of images final model generationConfig ; const final final for // Process the image } If you need more control over the image generation, you can configure the model and even set safety settings, for example: js const aspectRatio: ImagenAspectRatio.LANDSCAPE 16x9, imageFormat: ImagenImageFormat. addWatermark: }; const model: generationConfig, safetySettings: { safetyFilterLevel: ImagenSafetyFilterLevel.BLOCK LOW AND ABOVE, personFilterLevel: ImagenPersonFilterLevel.ALLOW ADULT, } } ; const // If fewer images were generated than were requested, // then filteredReason will describe the reason they were filtered out if console. } While this release brings significant power to your client-side code, some advanced Imagen 3 features are not yet supported: Whether we are deploying on Firebase App Hosting https://firebase.google.com/docs/app-hosting , Cloudflare Workers, or Vercel, shipping AI features to production requires defense-in-depth across three layers: Accelerate your full-stack web and AI development by pairing Add image generation to your apps with Imagen 3 with strict Security Rules, Firebase App Check, and local emulator testing. Come tell us on X @CodingCatDev https://x.com/CodingCatDev and LinkedIn CodingCat.dev https://www.linkedin.com/company/codingcatdev how you are using Firebase in your stack, and subscribe to the CodingCat.dev YouTube Channel https://www.youtube.com/@CodingCatDev?sub confirmation=1 so you don't miss what we build next Want to see how we architect and debug Firebase web applications live? Watch our related CodingCat.dev session Firebase SQL with Data Connect https://youtu.be/N25khadfUag below, and make sure to Subscribe to CodingCat.dev on YouTube https://www.youtube.com/@CodingCatDev?sub confirmation=1 for weekly full-stack web and AI deep dives: Add image generation to your apps with Imagen 3 announced 2025-03-03 by the Firebase team enhances the platform for Firebase, Google Cloud, Web Dev, AI, TypeScript, Serverless workloads. Update: As of May 2025, Vertex AI in Firebase has evolved into an offering named Firebase AI Logic to give developers more options for easily integrating generative AI models into their apps. Check out the documentation to learn more. Developers can review the primary announcement on the Firebase Blog https://firebase.blog/posts/2025/03/imagen3-support-on-vertex-ai-sdks/ alongside our implementation patterns and production checklist above. Web developers can integrate these features using the modular Firebase JavaScript/TypeScript SDK, Firebase Data Connect web bindings, and Firebase App Hosting https://firebase.google.com/docs/app-hosting . Always pair client-side SDK initialization with Firebase App Check and strict Security Rules, and test locally with the Firebase Local Emulator Suite before deploying. You can watch our hands-on Firebase video walkthroughs on the CodingCat.dev YouTube Channel https://www.youtube.com/@CodingCatDev?sub confirmation=1 , including Firebase SQL with Data Connect https://youtu.be/N25khadfUag , and follow us on X @CodingCatDev https://x.com/CodingCatDev for weekly full-stack tutorials.