Skip to main content

Imagen 4 vs Nano Banana: Retirement Dates and API Migration

Imagen 4 shut down on August 17, 2026. Move Gemini API jobs to gemini-nano-banana-2.1, replace the request and image parser, and confirm Firebase's model list.

LaoZhang AI TeamPublishedUpdated 14 min read
On this page
Earlier illustration of Imagen 4 and Nano Banana replacement choices

For an existing Imagen 4 workflow, start with gemini-nano-banana-2.1 on the Gemini Developer API. It supports image generation and editing at 1K, 2K, and 4K. Consider Lite for a simpler 1K workflow, and compare Pro on jobs where rejected images or manual repairs are expensive. These are workload choices, not evidence that one model reproduces your Imagen style.

As of October 8, 2026, Google's Developer API retirement table lists August 17, 2026 as the shutdown date for all three Imagen 4 IDs, with gemini-nano-banana-2.1 as their replacement. That date has passed. The same table marks gemini-3.1-flash-image (Nano Banana 2) as deprecated with no shutdown date announced, and Vertex AI supports it until May 28, 2027 or later. It is a bridge for existing clients, not the destination for a fresh migration.

Two facts changed in early October 2026. The October 29, 2026 Nano Banana 2 shutdown date shown at the 2.1 launch was removed from Google's table, and the 2.1 Standard price at 4K changed from $0.0756 to $0.113 per image. The checklist and cost table below use the current figures.

If you use Firebase AI Logic, choose within its documented SDK support before adopting a model. Firebase lists Pro and Lite, but its current support page does not list 2.1. A model appearing in the lower-level Google API documentation does not establish that your Firebase integration accepts it.

The migration has three parts: choose the replacement, change the request and image response handling, and decide which outputs are good enough to ship. Changing only a nickname or a model string leaves most of the work unfinished.

The retirement date depends on the surface

The Developer API date is clear; the Firebase documentation is internally inconsistent. Both published Imagen deadlines are already behind us, so neither supports a plan to keep Imagen 4 as a production fallback.

Conceptual integration-scoped lifecycle map separating Developer API deprecation without a Nano Banana 2 deadline, Vertex support and Firebase model checks

IntegrationPublished dates and scopeWhat to do with that information
Gemini Developer APIimagen-4.0-generate-001, imagen-4.0-ultra-generate-001, and imagen-4.0-fast-generate-001: August 17, 2026 shutdown; recommended replacement gemini-nano-banana-2.1Replace the Imagen route. June 24, 2025 in this table is the release date, not a 2026 shutdown date.
Firebase AI LogicThe migration page and support-page introduction say August 17, 2026; detailed Imagen rows on the support page say June 30, 2026Both dates have passed. The reason for the differing SDK dates remains unclear; check the Firebase contract separately.
Cloud / Agent Platform Gemini APIFirebase's migration page includes this provider in its August 17 statement. The current Cloud image guide lists Gemini successors, including 2.1Use the Cloud integration's project, location, credentials, and model support. A Developer API key example is not a Cloud configuration.
Old Vertex AI SDK generative modulesNew SDK releases after June 24, 2026 remove generative modules; Google directs applications to the Google Gen AI SDKMigrate affected SDK imports separately. This is not the Imagen 4 model shutdown date or removal of the entire Cloud SDK.

Sources: Developer API deprecations, Firebase Imagen migration, Firebase supported models, Cloud image generation, and Vertex SDK migration.

Google defines Developer API shutdown dates as the earliest possible removal dates. The table is a planning source, not a successful or failed request from your account. An old SDK method remaining installed likewise does not establish that its retired model is usable.

The successor models have their own lifecycles, and they differ by surface:

ModelGemini Developer APIVertex AIFirebase AI Logic
gemini-3.1-flash-image (Nano Banana 2)Deprecated, no shutdown date; migrate to 2.1Supported until May 28, 2027 or laterNo earlier than May 28, 2027
gemini-2.5-flash-image (original Nano Banana)March 15, 2027 in the deprecations table; the pricing page still warns of October 2, 2026March 15, 2027October 2, 2026

Vertex AI states that its retirement dates refer to support on that platform. Do not combine these columns into one universal timeline or assume that a Cloud or SDK page extends the Developer API lifetime. For 2.5 Flash Image, Google's own pages conflict and the earliest listed date has already passed, so migrate it now rather than counting on it still running. For Nano Banana 2, the lack of a Developer API date is room to migrate on your own schedule, not a reason to make a deprecated model your new default.

Migrate by model ID, not by nickname

Use exact IDs in requests and logs. The current image-generation guide and 2.1 model card make the useful differences explicit:

Model IDUseful starting pointConstraint that changes the choice
gemini-nano-banana-2.1Direct API generation, edits, reference-based work, and 1K/2K/4K deliveryNo 512px output. Inputs include text, images, video, and PDF; video input does not mean video generation.
gemini-3.1-flash-lite-imageSimple 1K work where its feature set is sufficient1K only; no Search grounding.
gemini-3-pro-imageCandidate for demanding final assets, text, or reference work1K/2K/4K; image/text input, without a direct PDF-input promise. Compare actual acceptance before paying the premium.
gemini-3.1-flash-imageA bridge for an existing compatible client, including a 512px requirementDeprecated on the Developer API with no shutdown date; Google recommends 2.1 for all new projects.

Both 2.1 and Pro support 4K. Resolution alone no longer justifies a Pro default. For reference-heavy work, 2.1 documents up to 14 references with category limits of 10 objects and 4 characters. Pro has different object/character limits and fidelity qualifications. Neither listing promises perfect preservation of every supplied reference.

For a prompt-only Imagen workload, begin with 2.1 and retain the intent of the old prompt. For a 1K thumbnail pipeline without grounding, include Lite in the comparison. For packaging text, product identity, or a client deliverable that requires costly repair when wrong, include Pro. Judge the result against the actual deliverable rather than assuming that Google's positioning proves a quality or speed advantage. In a same-prompt test of Nano Banana 2.1, Pro, and GPT Image 2.5 with nine prompts at 1K and one draw each, Pro kept the requested wording while 2.1 changed it in three text tasks. One draw per prompt is a warning sign for text-heavy jobs, not an average error rate.

Firebase's current model support table explicitly lists Pro, 3.1 Flash Image, and Lite, requires the billing-enabled Blaze plan, and does not list 2.1. Pro and Lite are therefore documented candidates for a Firebase migration; your installed SDK, provider, and account still need to accept the chosen configuration. Firebase also lacks image-search grounding, even where an underlying model supports it.

Change the request and the image response together

First identify the callsite you already have. An Imagen generate_images request, a Gemini generateContent request, and a Gemini Interactions request use different contracts.

Existing callMigration work
Imagen generationReplace the endpoint or SDK model class, then translate configuration and parse the Gemini response. Renaming the model inside the old Imagen request is insufficient.
Gemini generateContentThe protocol remains supported. Check the new model and configuration, then handle image parts in candidates[].content.parts[].
New direct API integrationInteractions is Google's recommended starting point; use input, response_format, and chronological steps.

On Vertex AI, gemini-nano-banana-2.1 runs in the global region and returns an API error if the request sets seed, topK, temperature, topP, or logprobs; it also does not support Flex processing. Strip those settings from any configuration you carry over, as listed on the Vertex AI Nano Banana 2.1 model page.

The Interactions overview says the legacy generateContent API remains fully supported. Model retirement does not force an existing Gemini client to change protocol at the same time. Keeping a working protocol can reduce the number of changes you must diagnose.

A direct API request body

For the Developer API Interactions route, the following is a request-body example, not a complete network client. Send it as JSON to POST https://generativelanguage.googleapis.com/v1beta/interactions using an appropriate Google project key in the x-goog-api-key header. Cloud credentials and gateway bearer keys are different authentication contracts.

json
{
  "model": "gemini-nano-banana-2.1",
  "input": "Create a square studio product photograph of a blue ceramic mug on a warm gray background. Leave clear space above the mug for a heading; do not add text.",
  "response_format": {
    "type": "image",
    "mime_type": "image/png",
    "aspect_ratio": "1:1",
    "image_size": "1K"
  },
  "store": false
}

These fields come from the current image-generation contract. Size uses uppercase K. For reference input, input can instead contain text and image parts; an image part uses type: "image", raw Base64 data, and mime_type. Do not carry over Imagen's numberOfImages or expect its predictions response.

Here store: false makes the example stateless. It is not a zero-data-retention guarantee, and the resulting interaction cannot supply stored server history or run in background mode. If you use stored conversations instead, resend current options each turn: previous_interaction_id inherits history, not every tool, instruction, or generation setting.

Save image blocks, not the first response part

An HTTP 200 response containing only text is not a delivered image. Interactions can contain multiple steps and content blocks. The SDK's output_image shortcut returns only the last image; do not save it again after saving that same image from the blocks.

This standalone Python utility reads a saved Interactions JSON response and extracts every image block in its model_output steps. It uses only the standard library and creates a new output directory, so it will not silently overwrite a previous job. Save it as extract_images.py, then run python3 extract_images.py response.json output-job-001 after obtaining your response through your own client.

python
import base64
import binascii
import json
import sys
from pathlib import Path

EXTENSIONS = {
    "image/png": ".png",
    "image/jpeg": ".jpg",
    "image/webp": ".webp",
}


def extract_images(response):
    images = []
    for step in response.get("steps", []):
        if step.get("type") != "model_output":
            continue
        for block in step.get("content", []):
            if block.get("type") != "image":
                continue
            mime = block.get("mime_type")
            if mime not in EXTENSIONS:
                raise ValueError(f"Unsupported image MIME type: {mime!r}")
            try:
                data = base64.b64decode(block["data"], validate=True)
            except (KeyError, TypeError, ValueError, binascii.Error) as exc:
                raise ValueError("Invalid image data") from exc
            if not data:
                raise ValueError("Empty image data")
            images.append((mime, data))
    if not images:
        raise ValueError("No image output; inspect the response before retrying")
    return images


def main():
    if len(sys.argv) != 3:
        raise SystemExit("Usage: extract_images.py response.json new-output-dir")
    response = json.loads(Path(sys.argv[1]).read_text(encoding="utf-8"))
    images = extract_images(response)
    destination = Path(sys.argv[2])
    destination.mkdir(parents=True, exist_ok=False)
    for number, (mime, data) in enumerate(images, start=1):
        filename = destination / f"image-{number:03d}{EXTENSIONS[mime]}"
        filename.write_bytes(data)
        print(filename)


if __name__ == "__main__":
    main()

The extractor excludes other step types and non-image content; it does not certify that the bytes decode into a valid picture or that the picture meets your requirements. Decode the files with your normal image tooling and check dimensions and content before delivery. The script and the JSON example have been run only against synthetic responses offline, not against a live model call, a specific SDK version, or a billed job, so they say nothing about latency or cost.

Firebase configuration changes

Firebase's migration table changes ImagenModel to GenerativeModel, ImagenGenerationConfig to GenerationConfig plus ImageConfig, and ImagenSafetySettings to SafetySetting. ImageConfig is available from the May 2026 SDK releases. Move aspectRatio into it and request IMAGE or IMAGE plus TEXT response modalities.

Several old settings require workflow changes rather than new names:

  • numberOfImages is unavailable on this Firebase route, which returns one generated image. More variants require more requests; candidate count is not a substitute.
  • imageFormat is unavailable, and Firebase image responses are PNG. Convert afterward if your delivery system needs another format.
  • addWatermark is unavailable; Gemini-generated images include SynthID. Do not promise watermark-free output.
  • personGeneration is unavailable; people generation follows the model's default behavior and safety rules. Preserve appropriate safety thresholds when changing types.
  • negativePrompt is unavailable, but Imagen 4 itself did not support it. Express required constraints clearly in the main prompt rather than claiming a lost Imagen 4 feature.

The November 2, 2026 App Check enforcement notice concerns Firebase AI Logic. It is not a prerequisite for the direct Developer API request shown above.

Keep the cost boundary date-bound

Compare the same output size and billing scope before choosing a replacement. The following values are USD, Gemini Developer API Standard image-output cost only, calculated from the Gemini API pricing page as of October 8, 2026. Vertex AI lists the same Standard prices for 2.1. They exclude input, text/thinking output, grounding, and additional attempts.

Model1K image output2K image output4K image output
2.1$0.0336$0.0504$0.113
Lite$0.0336UnsupportedUnsupported
3.1 Flash Image$0.0672$0.1008$0.1512
Pro$0.1344$0.1344$0.2400

For 2.1, 1K uses 1,120 image tokens at $30 per million: 1,120 × 30 / 1,000,000 = $0.0336. Its Standard input rate is $1.50 per million tokens, and text/thinking output is $7.50 per million. A 4K 2.1 image counts as 3,780 image tokens: 3,780 × 30 / 1,000,000 ≈ $0.113. Lite's equal 1K image-output price does not mean equal total bills or equal capabilities. The Nano Banana 2.1 API pricing guide shows what thinking and text add to each call, and the Nano Banana 2 API pricing guide covers the deprecated model if you keep it as a bridge.

2.1's Batch image-output rate is $15 per million, giving $0.0168, $0.0252, and $0.0567 at those sizes. Batch support on the model card does not establish an /interactions/batch endpoint; use a separately documented batch interface. The current 2.1 and Pro pricing rows do not offer a free API tier. An AI Studio trial is not an unlimited free API entitlement.

Search grounding can add cost too: the pricing page lists 5,000 monthly queries shared with the 3.x family, then $14 per 1,000 queries. One request can trigger multiple queries. Include the actual billable input, thinking, grounding, and attempts in your estimate rather than multiplying only the image row.

The more useful business denominator is an accepted asset. Suppose, hypothetically, 100 generated 1K images yield 80 accepted 2.1 assets or 95 accepted Pro assets. Image-output-only cost per accepted asset is $3.36 / 80 = $0.042 for 2.1 and $13.44 / 95 ≈ $0.1415 for Pro. Those acceptance counts are illustrative, not measured. Pro would need to save enough repair time or avoid enough delivery risk to justify the difference. Use your own acceptance results and full bill to make that decision.

Run a same-prompt migration test before changing traffic

Use retained Imagen outputs as the old baseline, where you have permission to use them. A retired endpoint cannot produce a fresh Imagen A/B comparison. Reuse the production prompts and lawful reference inputs, then generate candidates on supported replacement routes.

Illustrated workflow for inventorying prompts, checking image acceptance, and staging a migration

Choose representative jobs by consequence: simple generation, required text, product or character continuity, and final delivery size. A thumbnail and a packaging proof should not share an acceptance threshold. Define what makes each deliverable usable before judging the samples.

CheckRecordDecision it supports
Delivered fileDecodable image, MIME type, dimensions, and required variant countWhether the request produced a usable artifact at all
Task acceptanceCorrect labels, required objects, reference identity, layout, and prohibited changesWhether the model can serve that workload
Human repairMinutes spent fixing or rejecting an outputWhether Pro's extra cost buys useful savings
OperationsActual latency, error categories, quota behavior, and billed costWhether the integration can carry your traffic

Keep the exact model ID, protocol, size, prompt revision, and input references with each result. Separate text-only responses, safety refusals, malformed payloads, and quality rejections; they require different fixes. If Pro is the candidate for a difficult workload, the Pro API guide covers its more detailed request and output handling.

Promote the candidate that meets the job's acceptance rule within its budget. Do not turn an attractive sample into a claim about average quality or speed, and do not make every workload pay for Pro when only one needs it.

A production migration checklist

  1. Record the old model ID, API/provider, request fields, output assumptions, and lawful stored baseline.
  2. Choose a supported replacement for the required size and features. Resolve Firebase support separately. If a 3.1 bridge stays in place, give it a written exit plan even though the Developer API lists no shutdown date.
  3. Change the request and parser together. Confirm that the application saves decodable images with the right format and dimensions rather than accepting any HTTP success.
  4. Compare representative outputs using the acceptance rules above, including repair work and total cost.
  5. Put the new route behind a feature flag or routing setting. Move a bounded share of jobs first, with enough logging to identify which model produced each delivered asset.
  6. Expand traffic when output acceptance and operational results meet your limits. Keep the previous application configuration recoverable, with an explicitly viable image route.

A realistic rollback can send jobs to a previously accepted, currently supported Gemini candidate, use already approved assets, queue work for later, or require manual review. Reverting application code is useful only if the restored code points to a usable service. Retired Imagen 4 is not the rollback plan. An alternate model that has never passed your workload checks is a candidate, not a proven fallback.

Handle failures according to their category. A retired-model or not_found 404 calls for checking the model ID, issuer, and route; endless retries will not repair it. A 400 configuration error, 403 permission failure, or 402 payment problem needs its own correction. Treat 429/quota failures separately from transient 503/504 errors and use bounded retries. After a timeout, the generation outcome may be unknown, so check any recorded result before producing duplicate jobs and possible duplicate charges. Google's error guidance and project-scoped rate limits are the relevant references; issuing extra keys does not enlarge the project's quota.

FAQ

What should replace Imagen 4 now?

For the direct Gemini Developer API, start with gemini-nano-banana-2.1, Google's current recommended replacement. Compare Lite for simpler 1K jobs and Pro where acceptance or repair cost warrants it. Firebase needs a separate SDK support decision because its current table does not list 2.1.

Is Nano Banana 2 still the default migration target?

No. The older gemini-3.1-flash-image is deprecated on the Developer API with no shutdown date announced, and Vertex AI supports it until May 28, 2027 or later. Google recommends gemini-nano-banana-2.1 for all new projects, at half the Nano Banana 2 image-output price at 1K and 2K. Use exact IDs rather than assuming that a nickname or a provider alias means the same model. See the current retirement table.

Do I have to switch from generateContent to Interactions?

No. Google says generateContent remains fully supported in the Interactions overview. Keep an existing Gemini protocol if it fits the replacement model. An old Imagen generation endpoint, however, requires a request and response migration; changing only its model string is insufficient.

Is Pro necessary for 4K images?

No. Both 2.1 and Pro document 4K output in the image-generation guide. Choose Pro when your workload results justify its higher cost, not simply because the final file must be 4K.

Can I keep Imagen 4 as a fallback?

Do not design a fallback around it. The published Imagen deadlines have passed. Prepare another supported model that meets your requirements, approved stored assets, a queue, or a manual delivery path. Changing back to old application code does not restore a retired backend.

Is there a free replacement API?

The current 2.1 and Pro rows on Google's API pricing page have no free tier. Firebase image generation requires the billing-enabled Blaze plan. Do not assume an older 2.5 route or a UI trial supplies a free production API fallback.

Sources12

External pages this guide links to, in the order they appear. Last updated Oct 8, 2026.

  1. 1.Developer API retirement tableai.google.dev/gemini-api/docs/deprecations
  2. 2.Firebase Imagen migrationfirebase.google.com/docs/ai-logic/imagen-models-migration
  3. 3.Firebase supported modelsfirebase.google.com/docs/ai-logic/models
  4. 4.Cloud image generationdocs.cloud.google.com/gemini-enterprise-agent-platform/models/capabilities/image-generation
  5. 5.Vertex SDK migrationdocs.cloud.google.com/vertex-ai/generative-ai/docs/deprecations/genai-vertexai-sdk
  6. 6.image-generation guideai.google.dev/gemini-api/docs/image-generation
  7. 7.2.1 model cardai.google.dev/gemini-api/docs/models/gemini-nano-banana-2.1
  8. 8.Vertex AI Nano Banana 2.1 model pagedocs.cloud.google.com/vertex-ai/generative-ai/docs/models/gemini/nano-banana-2-1
  9. 9.Interactions overviewai.google.dev/gemini-api/docs/interactions-overview
  10. 10.Gemini API pricing pageai.google.dev/gemini-api/docs/pricing
  11. 11.error guidanceai.google.dev/gemini-api/docs/api-errors
  12. 12.project-scoped rate limitsai.google.dev/gemini-api/docs/rate-limits