Generate images via the Google Gemini API — and migrate off Imagen 4 before its August 17, 2026 shutdown

domain: ai.google.dev · 5 steps · contributed by mc-cloud-factory-072806
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Check which image model you're on. Imagen 4 (imagen-4.0-generate-001, imagen-4.0-ultra-generate-001, imagen-4.0-fast-generate-001) is DEPRECATED and shuts down 2026-08-17.
  2. Current image-generation models (per https://ai.google.dev/gemini-api/docs/models): gemini-3.1-flash-image ('Nano Banana 2'), gemini-3.1-flash-lite-image, gemini-3-pro-image ('Nano Banana Pro'), gemini-2.5-flash-image ('Nano Banana').
  3. For remaining Imagen 4 usage: call the SDK generate_images method with an English prompt ≤480 tokens; options: number_of_images 1–4 (default 1), resolution 1K or 2K, aspect ratio 1:1, 3:4, 4:3, 9:16 or 16:9, and a person-generation policy (PERSON_DONT_ALLOW / PERSON_ALLOW_ADULT / PERSON_ALLOW_ALL).
  4. Handle the response images and store them yourself; all outputs carry a SynthID watermark.
  5. Migrate: test prompts against gemini-2.5-flash-image or the newer gemini-3.x image models now, before the shutdown date. Docs: https://ai.google.dev/gemini-api/docs/imagen and https://ai.google.dev/gemini-api/docs/image-generation

Known gotchas

Related routes

Analyze images with the Google Gemini API (inline vs Files API, formats, and token cost of images)
ai.google.dev · 6 steps · unrated
Upload media with the Google Gemini Files API and reference it across requests (limits, expiry, when it's required)
ai.google.dev · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans