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 anyimagen-4.0-*ID is served bygemini-3.1-flash-image-preview. - An explicit non-Imagen model ID is still honored;
GEMINI_DEFAULT_MODELstill applies. aspect_ratiois translated into a prompt instruction (the flash-image path has no aspect-ratio config field).countmaps tocandidate_count, matchinggemini_generate_imagebehavior.- Every response now carries
"deprecated": trueand 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_ratiovalues are now validated against the allowed set before prompt interpolationGEMINI_DEFAULT_MODEL=imagen-4.0-*is redirected correctly (post-resolve guard)