Replacing an Imagen model name is not enough. The request configuration and the way an application reads generated images must match the replacement API and SDK.

Check the endpoint you actually use
Google's Gemini API retirement table lists August 17, 2026 for the standard, Fast and Ultra Imagen 4 endpoints. Its Firebase migration guide also confirms the shutdown and maps replacements to Gemini 3.1 Flash Image or Gemini 3 Pro Image, depending on the previous model. Record the full model ID, backend and SDK version before editing code.
Firebase and direct API examples differ
For Firebase AI Logic, the migration changes ImagenModel/generateImages to GenerativeModel/generateContent, configures image output and reads image data from the returned parts. The guide documents unsupported legacy options, including numberOfImages and imageFormat. These are migration instructions for that integration, not a promise that every Gemini interface has the same response shape.
The current direct Gemini image guide instead demonstrates Interactions calls. It provides an output_image convenience property for the last generated image and explains that interleaved text/image output requires reading the output steps. It also shows MIME configuration. Copying a parser between these examples without adapting it can silently lose images or mistake a text response for a file.
Make failure visible
Keep the provider-specific code behind an adapter that returns the fields your application needs: image bytes, MIME type, status and diagnostic details. Define how to handle a successful HTTP response that contains no usable image. Do not display an empty download link or retry indefinitely.
A small migration fixture can contain four cases: one valid image; text without an image; a blocked or failed generation; and several interleaved output blocks. The adapter should either return the intended image set or an explicit error. These are proposed contract tests, not results from paid API calls we have run.
If your product needs four variants, make the job track four accepted outputs. Repeating calls can implement that behaviour where supported, but parallel requests still share quotas and incur their own costs and failures. Preserve partial successes instead of restarting the whole batch.
Finally, compare the same visual brief before changing defaults: framing, required text, subject consistency and revision behaviour. API compatibility only establishes that your application can consume the response. It does not establish equivalent images, latency or cost.
Verify shutdown and current replacement models; distinguish Firebase generateContent from direct Gemini Interactions API and remove universal one-image/PNG assumptions.