Imagen 4 API Shutdown: How to Migrate to Gemini 3.1 Flash Image
Google's documented shutdown date for the three Imagen 4 endpoints was August 17, 2026. If an application still calls imagen-4.0-generate-001, imagen-4.0-ultra-generate-001, or imagen-4.0-fast-generate-001, migration should now be treated as urgent rather than optional.
Google's current Imagen 4 model page and Gemini deprecation table name gemini-3.1-flash-image as the recommended replacement for all three Imagen 4 endpoints. The change is not only a model-name swap: current Gemini image-generation documentation leads with the Interactions API, while Google's legacy Generate Content API remains documented for Gemini image models. Either path has different request and response handling from an Imagen-specific integration.
What changed
| Existing integration | Current migration direction |
|---|---|
imagen-4.0-generate-001 |
Move to gemini-3.1-flash-image as Google's recommended replacement |
imagen-4.0-ultra-generate-001 |
Start with gemini-3.1-flash-image; also evaluate gemini-3-pro-image if professional asset production or complex instructions dominate |
imagen-4.0-fast-generate-001 |
Start with gemini-3.1-flash-image; evaluate gemini-3.1-flash-lite-image when lower latency and cost matter more |
| Imagen-specific generation call | Migrate to Gemini native image generation; current docs lead with interactions.create(...), while legacy generateContent is also documented |
| Imagen image-only response assumptions | Update parsing for Gemini image/text output blocks or content parts |
Google describes Gemini 3.1 Flash Image, also called Nano Banana 2, as its current go-to image-generation model for balancing quality, intelligence, latency and cost. It supports 0.5K, 1K, 2K and 4K output resolutions and supports multimodal image-generation/editing workflows that do not map one-for-one to the Imagen API.
Do not treat this as a search-and-replace migration
A model identifier is usually the smallest part of this migration.
Imagen integrations commonly use an Imagen-specific image-generation call and expect an image-specific response. Google's current Gemini documentation instead shows native image generation through the Interactions API, where generated image data is returned through interaction output blocks. Google also still documents the older Generate Content API, where image data is returned as parts of the model response.
At minimum, review these four areas before sending production traffic to the replacement model:
- Request construction — model name, API surface and image-generation configuration may change.
- Response parsing — code that expects an Imagen-specific image result must deliberately handle Gemini image output blocks or content parts.
- Prompt behavior — a replacement model can interpret the same prompt differently even when subject, style and aspect ratio are unchanged.
- Output validation — resolution, text rendering, composition, safety behavior, latency and cost should be tested against representative production prompts.
A migration that compiles is not necessarily a migration that preserves application behavior.
Which replacement model should you choose?
Gemini 3.1 Flash Image: the default starting point
Google's current Imagen 4 model page and deprecation table explicitly name gemini-3.1-flash-image as the replacement for all three Imagen 4 endpoints.
Use it as the first evaluation target when the application needs a broadly capable image model without moving directly to the heaviest professional-production option.
Google currently positions it as the general go-to image model, balancing intelligence, cost and latency. Its model page lists text and image/PDF inputs and image/text outputs.
Gemini 3.1 Flash Lite Image: when efficiency dominates
Google positions gemini-3.1-flash-lite-image as the efficiency-focused image model for low-latency and cost-sensitive generation and editing.
It is not the formal replacement named in the Imagen deprecation table, so do not select it purely because an old integration used the fast Imagen variant. Benchmark the actual workload first.
Gemini 3 Pro Image: when complex production work matters most
Google positions gemini-3-pro-image for professional asset production and complex instructions. Current documentation also highlights high-resolution generation and search-grounded workflows.
For an application previously using Imagen 4 Ultra because complex composition or production-quality assets mattered more than throughput, Gemini 3 Pro Image is worth evaluating alongside the formal 3.1 Flash Image replacement.
Why some Google pages still show older migration patterns
Developers may encounter apparently inconsistent examples because Google's documentation now spans more than one Gemini API surface and some migration examples predate the current 3.1 image-model recommendation.
The current Imagen model page and deprecation table should govern replacement-model selection: both point to gemini-3.1-flash-image.
For API shape, use the current image-generation documentation for new work. It leads with the Interactions API. Google's legacy Generate Content image-generation documentation remains available, so an existing Gemini integration does not necessarily have to move API surfaces in the same change if it already uses that supported path.
The important rule is to avoid copying an older model identifier or code pattern merely because it appears in a historical migration example.
Minimal migration pattern
For new work following Google's current image-generation documentation, the conceptual transition is:
Imagen 4
model = imagen-4.0-*-generate-001
Imagen-specific generation call
image-specific response
↓
Gemini image generation
model = gemini-3.1-flash-image
Interactions API = interactions.create(...)
response = interaction output image/content blocks
If an application already uses Google's legacy Generate Content API, Gemini 3.1 Flash Image is also documented there. Treat API-surface migration and model migration as separate decisions rather than combining them unnecessarily.
Keep the first migration small. Reproduce one known production prompt, save the generated output, validate the response parser, and only then add newer Gemini-specific capabilities such as image-conditioned editing, search grounding or multi-turn refinement.
Production migration checklist
1. Inventory every Imagen model ID
Search application code, environment variables, job definitions, notebooks and infrastructure templates for:
imagen-4.0-generate-001imagen-4.0-ultra-generate-001imagen-4.0-fast-generate-001
Do not forget background workers or rarely used batch paths.
2. Decide whether you are changing only the model family or also the API surface
For a new implementation, follow Google's current Interactions API image-generation examples. For an existing Gemini Generate Content integration, Google's legacy Generate Content documentation still shows Gemini 3.1 Flash Image support.
Separating these choices reduces the number of simultaneous changes during cutover.
3. Build a representative image test set
Include prompts that expose real failure modes:
- text inside images;
- people and hands;
- brand/product layouts;
- complex scene composition;
- uncommon aspect ratios;
- strict color or object-count requirements;
- prompts that previously triggered safety handling;
- latency-sensitive high-volume requests.
Compare outputs manually as well as through any application-specific automated checks.
4. Validate response handling
With the current Interactions API, image data can be accessed through interaction output blocks and convenience properties such as interaction.output_image for simple cases. For complex interleaved text-and-image responses, Google says to iterate through the interaction steps rather than assume a single image output.
With the legacy Generate Content API, inspect the returned content parts deliberately. In either case, handle refusal, error and text-only outcomes instead of treating missing image bytes as an unexplained parser failure.
5. Recheck quotas, pricing and limits in the live console/docs
Do not assume Imagen 4 throughput limits or billing semantics transfer unchanged to a Gemini image model. Quotas and pricing are operational configuration, not model-family inheritance.
Before production cutover, confirm the current project's limits, billing and regional availability in Google's live documentation/account environment.
6. Keep rollback at the application layer
Because the Imagen endpoints have reached their documented retirement date, rollback should normally mean switching between tested current Gemini image models or restoring the previous application release while still calling a supported model—not depending on Imagen 4 remaining available.
What this means for teams that missed the deadline
If Imagen calls are already failing, prioritize service restoration over prompt-perfect parity:
- route one representative request through
gemini-3.1-flash-image; - update request/response handling for the chosen Gemini API surface;
- verify output storage and encoding;
- run a compact regression set;
- restore traffic gradually;
- tune prompts and model selection after the service path is stable.
If Imagen calls still happen to succeed in a particular environment, treat that as temporary breathing room rather than proof that the deprecation was cancelled. Google's deprecation page says listed shutdown dates are the earliest dates a model may be retired, and its Imagen pages still direct developers to migrate away from Imagen 4.
Bottom line
Do not build new work on Imagen 4, and do not postpone an existing migration because the old endpoint still appears in code or documentation. Google's current replacement path is Gemini 3.1 Flash Image, with Flash Lite Image and Gemini 3 Pro Image available for workloads that prioritize efficiency or high-end production behavior differently.
The migration is larger than changing a model string: verify the API surface you intend to use, update response parsing where required, run representative prompt regressions, and recheck operational limits before production cutover.
Primary sources
- Google AI for Developers — Imagen 4 model page: https://ai.google.dev/gemini-api/docs/models/imagen
- Google AI for Developers — Gemini deprecations: https://ai.google.dev/gemini-api/docs/deprecations
- Google AI for Developers — Image generation (current Interactions API): https://ai.google.dev/gemini-api/docs/image-generation
- Google AI for Developers — Generate Content image generation (legacy API): https://ai.google.dev/gemini-api/docs/generate-content/image-generation
- Google AI for Developers — Gemini 3.1 Flash Image model page: https://ai.google.dev/gemini-api/docs/models/gemini-3.1-flash-image