◉GEMINI LABJP
●ARGON — gemini-4-argon is generally available as of 10/13, aimed at complex coding, agents, math and science●DEEP RES — deep-research-pro-preview-12-2025 shuts down 10/23, 6 days left. Move to deep-research-preview-04-2026●NANO — gemini-nano-banana-2.1 is GA (10/06). gemini-3.1-flash-image is deprecated with no shutdown date yet●MCP — One write-up cut an 85,000-token tool result to 310 tokens by wrapping it in an ADK FunctionTool●FLASH — gemini-3.7-flash and 3.5-flash now route automatically to newer Flash models (10/08)●NEW — Stop Re-Reading Every Crash Report: Gre…●ARGON — gemini-4-argon is generally available as of 10/13, aimed at complex coding, agents, math and science●DEEP RES — deep-research-pro-preview-12-2025 shuts down 10/23, 6 days left. Move to deep-research-preview-04-2026●NANO — gemini-nano-banana-2.1 is GA (10/06). gemini-3.1-flash-image is deprecated with no shutdown date yet●MCP — One write-up cut an 85,000-token tool result to 310 tokens by wrapping it in an ADK FunctionTool●FLASH — gemini-3.7-flash and 3.5-flash now route automatically to newer Flash models (10/08)●NEW — Stop Re-Reading Every Crash Report: Gre…
Articles/API / SDK
◈ API / SDK/2026-05-18Advanced

Rebuilding My Wallpaper App's Color Variations on Nano Banana 2 — Life After the Imagen 4 Shutdown, and Why Resolution Decides the Margin

How I moved my wallpaper app's color-variation pipeline onto gemini-3.1-flash-image (Nano Banana 2): where Imagen 4 users have to go now, the current Interactions API call shape, a two-stage design derived from published per-resolution pricing, and a script that finds retired model IDs still sitting in your code.

gemini-api286nano-banana-2gemini-3-1-flash-imageimage-generation9wallpaper-app5indie-dev48cost-design

✦ Premium Article

One night in September I was reading the deprecations page top to bottom, and I stopped at the Imagen section. The row for imagen-4.0-generate-001 was greyed out. Shutdown date: August 17, 2026 — more than a month before the day I was looking at it.

The pipeline itself hadn't aged. Handing a model a base image and asking for a color variation is the same idea it always was. What had aged was the answer to a single question: who do you hand it to?

This is the record of moving that pipeline onto the current models. I checked every model ID, call shape and price against the official pages on September 20, 2026. What I'd say first is that the real work wasn't swapping the call — it was that the unit economics underneath it had changed.

Three models can return an image today

Reading the deprecations page (last updated 2026-09-17 UTC) alongside the pricing page, the current image models come down to three. Every Imagen model is shut down, and the listed replacement is gemini-3.1-flash-image.

Model IDKnown asWhere it fitsStandard image outputShutdown
gemini-3.1-flash-imageNano Banana 2The workhorse. Up to 4K, reliable text rendering1K $0.067 / 2K $0.101 / 4K $0.151None announced
gemini-3.1-flash-lite-imageNano Banana 2 LiteFastest and cheapest, 1K-oriented, built for volume1K $0.0336None announced
gemini-3-pro-imageNano Banana ProHard compositions and strict instruction following1K/2K $0.134 / 4K $0.24None announced
gemini-2.5-flash-imageNano Banana (legacy)The original. Migrate off it$0.039 per image2026-10-02
imagen-4.0-generate-001 and siblingsImagen 4Retired—2026-08-17 (already down)

One thing in that table will bite you if you copy it straight across. The gemini-2.5-flash-image row lists its recommended replacement as gemini-3.1-flash-image-preview — and that preview is itself marked shut down on June 25, 2026, a few sections higher on the same page. The warning on the pricing page says something different and correct: move to Gemini 3.1 Flash Image or Gemini 3.1 Flash Lite Image. I now cross-check the "recommended replacement" column against the shutdown dates on the same page before I copy anything out of it. Follow the table literally and you migrate toward an endpoint that is already off.

The Imagen 4 shutdown was announced in the June 15, 2026 release notes and carried out on August 17. I used to run two tracks — Imagen 4 for seed images, a Gemini image model for user-facing derivatives. Both tracks live on Nano Banana now. What I lost by collapsing them wasn't quality; it was a branch in my prompt builder that existed only to phrase the same request two ways.

The call shape moved to the Interactions API

The current image generation guide shows Interactions API samples rather than generate_content. You no longer walk candidates[0].content.parts looking for inline data — there is one place to read, interaction.output_image. Base64 in, base64 out.

import base64
import os
from google import genai
 
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
 
MODEL_PREVIEW = "gemini-3.1-flash-lite-image"   # candidates: cheap and fast
MODEL_FINAL = "gemini-3.1-flash-image"          # the adopted one, at delivery resolution
 
 
def encode(path: str) -> str:
    with open(path, "rb") as f:
        return base64.b64encode(f.read()).decode("utf-8")
 
 
def generate_preview(base_image_path: str, instruction: str):
    """Send the base image plus one instruction, get one candidate back."""
    interaction = client.interactions.create(
        model=MODEL_PREVIEW,
        input=[
            {"type": "text", "text": instruction},
            {
                "type": "image",
                "data": encode(base_image_path),
                "mime_type": "image/png",
            },
        ],
        response_format={
            "type": "image",
            "mime_type": "image/png",
            "aspect_ratio": "9:16",   # wallpapers are tall
            "image_size": "1K",       # 1K is plenty for a candidate
        },
    )
    image = interaction.output_image
    if image is None:
        return None, interaction.id
    return base64.b64decode(image.data), interaction.id

For the one candidate the user actually picks, previous_interaction_id continues the same exchange. Being able to say "same picture, higher resolution" without rebuilding the prompt is what makes the two-stage design practical.

def upscale_adopted(previous_id: str, image_size: str = "2K"):
    """Redraw the chosen candidate at delivery resolution."""
    interaction = client.interactions.create(
        model=MODEL_FINAL,
        input=(
            "Redraw this at delivery resolution, keeping the composition and "
            "color exactly as they are. Do not change the subject, hue or brightness."
        ),
        previous_interaction_id=previous_id,
        response_format={
            "type": "image",
            "mime_type": "image/png",
            "aspect_ratio": "9:16",
            "image_size": image_size,
        },
    )
    image = interaction.output_image
    return base64.b64decode(image.data) if image else None

Something else left my implementation along the way. temperature, top_p and top_k were deprecated on July 21, 2026. No shutdown date has been announced, but I can no longer design around dialing variance with a parameter.

Diversity now comes from the prompt side, written out as explicit branches. Three candidates means three instructions.

VARIATION_PROMPTS = {
    "color": [
        "Keep the subject and composition; shift to a warm, reddish sunset palette.",
        "Keep the subject and composition; shift to a cool, blue-toned dusk palette.",
        "Keep the subject and composition; shift to a pink magic-hour palette.",
    ],
    "time": [
        "Keep the subject; move the scene to moonlit night.",
        "Keep the subject; move the scene to the half-light before dawn.",
        "Keep the subject; move the scene to hard midday sun.",
    ],
}

When I was leaning on sampling, I sent one instruction three times and hoped the results would differ. Looking back, I had turned a hope into a spec. Writing three instructions also tells me exactly which line to fix when one of them comes back wrong.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦A single table that reconciles Nano Banana 2, 2 Lite, Pro and the now-retired Imagen 4 models against the official deprecation and pricing pages
✦A working variation pipeline written in the current Interactions API shape, including previous_interaction_id for the high-resolution pass
✦A two-stage design derived from published per-resolution prices that cuts the monthly API bill by 33% without changing what the user sees
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

◈ API / SDK2026-08-23
Moving app AI work from runtime calls to a pre-ship batch pass
Where you put a Gemini call decides whether your request count scales with users or with assets. Here is the decision rule I used to move classification into a pre-ship batch pass, plus a resumable implementation.
◈ API / SDK2026-05-18
Building Automatic Wallpaper Category Classification with Gemini Vision
An indie developer shares how they implemented automatic wallpaper image classification with the Gemini Vision API — including accuracy results, real pitfalls, structured-output tips, and a cost comparison with GPT-4o Vision.
◈ API / SDK2026-05-13
Maximizing Revenue in Indie iOS Wallpaper Apps with AdMob + Gemini API
A decade of indie app development reveals how to balance AdMob revenue against Gemini API costs. Learn architecture patterns, cost control strategies, and Freemium gate implementation for AI-powered wallpaper apps.