Skip to content

v0.2.1 — Imagen 4 deprecation

Latest

Choose a tag to compare

@azmym azmym released this 22 Jun 16:28
201a1e1

What's new

gemini_generate_image_imagen deprecated ahead of Imagen 4 sunset

Google discontinues all Imagen 4 endpoints on 2026-08-17 (imagen-4.0-generate-001, imagen-4.0-ultra-generate-001, imagen-4.0-fast-generate-001). After that date those model IDs return 404 Not Found.

gemini_generate_image_imagen now redirects every call to gemini-3.1-flash-image-preview (the same path used by gemini_generate_image) so no call can hit the 404:

  • A call with no model= or with any imagen-4.0-* ID is served by gemini-3.1-flash-image-preview.
  • An explicit non-Imagen model ID is still honored; GEMINI_DEFAULT_MODEL still applies.
  • aspect_ratio is translated into a prompt instruction (the flash-image path has no aspect-ratio config field).
  • count maps to candidate_count, matching gemini_generate_image behavior.
  • Every response now carries "deprecated": true and a "deprecation" message.

For new code, use gemini_generate_image directly — it is the same flash-image path without the deprecated wrapper.

Migration guide

docs/migration-v0.2.1.md covers the redirect rules, capability translation, and the phase-2 removal timeline.

Other changes

  • 74 unit tests (up from 69 in v0.2.0)
  • aspect_ratio values are now validated against the allowed set before prompt interpolation
  • GEMINI_DEFAULT_MODEL=imagen-4.0-* is redirected correctly (post-resolve guard)