Skip to content

feat(google): add gemini-3.1-flash-lite-image and fix Gemini image catalog errors#294

Merged
Kamilbenkirane merged 2 commits into
mainfrom
feat/gemini-3-1-flash-lite-image
Jul 1, 2026
Merged

feat(google): add gemini-3.1-flash-lite-image and fix Gemini image catalog errors#294
Kamilbenkirane merged 2 commits into
mainfrom
feat/gemini-3-1-flash-lite-image

Conversation

@Kamilbenkirane

Copy link
Copy Markdown
Member

Summary

  • Adds gemini-3.1-flash-lite-image (Nano Banana 2 Lite) to the Google image catalog: 1K-only resolution, 14 object reference images, generate+edit, minimal/high thinking levels.
  • Auditing the sibling entries while verifying this one turned up real, pre-existing errors, fixed here:
    • gemini-3-pro-image-preview and gemini-3.1-flash-image-preview are deprecated and shut down June 25, 2026 — renamed to their GA replacement IDs gemini-3-pro-image and gemini-3.1-flash-image.
    • THINKING_LEVEL was ["minimal", "High"] everywhere in the Gemini 3.x image family; the API expects lowercase "high" (confirmed against an actual code sample in Google's docs). Fixed on all three Gemini 3.x entries.
    • gemini-3.1-flash-image (GA) gained a 512px quality tier over the preview version — added.
    • imagen-4.0-fast-generate-001 had a QUALITY: ["1K"] constraint, but Google's docs state the imageSize parameter is only supported on the Standard and Ultra Imagen 4 variants, not Fast — removed.
  • Grepped the repo for the old preview IDs — no other code/tests referenced them, so the rename is safe.
  • gemini-2.5-flash-image's aspect ratio list and reference-image count could not be independently confirmed against official docs and were left unchanged.

Test plan

  • make ci passes (lint, format, mypy, bandit, tests with coverage)
  • Manually loaded each changed/new Model entry and confirmed it validates
  • Verified every changed value against Google's official Gemini API docs (model pages, image-generation guide, changelog/deprecations)

Adds Nano Banana 2 Lite, the low-latency/low-cost variant of the Gemini
3.1 image family: 1K-only resolution (2K/4K unsupported), 14 object
reference images, and the same minimal/high thinking levels as its
siblings.
- gemini-3-pro-image-preview and gemini-3.1-flash-image-preview are
  deprecated (shut down June 25, 2026); rename to their GA replacement
  IDs gemini-3-pro-image and gemini-3.1-flash-image.
- Fix THINKING_LEVEL casing across the Gemini 3.x image family: the API
  expects lowercase "high", not "High".
- Add the 512px quality tier to gemini-3.1-flash-image (GA gained it
  over the preview).
- Remove QUALITY from imagen-4.0-fast-generate-001: the imageSize
  parameter is only supported on the Standard and Ultra Imagen 4
  variants, not Fast.
@Kamilbenkirane Kamilbenkirane merged commit f9da928 into main Jul 1, 2026
11 checks passed
@claude

claude Bot commented Jul 1, 2026

Copy link
Copy Markdown

Code review

1 issue found.

Bug: Potential invalid imageSize value "512px" on gemini-3.1-flash-image

"21:9",
]
),
ImageParameter.QUALITY: Choice(options=["512px", "1K", "2K", "4K"]),
ImageParameter.REFERENCE_IMAGES: ImagesConstraint(max_count=14),
ImageParameter.THINKING_LEVEL: Choice(options=["minimal", "high"]),
},

The QUALITY value is passed verbatim to the Gemini API as generationConfig.imageConfig.imageSize with no normalization (traced through GeminiQualityMapperImageSizeMapperChoice.__call__). Every other model in this file uses the {n}K format ("1K", "2K", "4K"). "512px" is inconsistent with this format and may not be a valid imageSize enum token — if so, any request selecting this quality tier will be rejected by the Gemini API.

Please verify the exact string the Gemini API expects for this tier against the official Google documentation. If the correct value differs (e.g. "512" or another format), it should be updated here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant