Skip to content

fix(image-gen): make the Gemini image model configurable and replace the retired default - #4718

Merged
vybe merged 2 commits into
Abilityai:devfrom
pcbeingused333:fix/image-model-env
Nov 23, 2026
Merged

vybe merged 2 commits into
Abilityai:devfrom
pcbeingused333:fix/image-model-env

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Fixes #4717

Cause. The image model was hard-coded to gemini-3.1-flash-image-preview, which Google lists as shut down (2026-06-25) with gemini-nano-banana-2.1 as its replacement (https://ai.google.dev/gemini-api/docs/deprecations). Platform image generation therefore fails by default, and there was no config escape hatch (unlike GEMINI_TEXT_MODEL, #1130).

Fix. Add GEMINI_IMAGE_MODEL to src/backend/config.py (os.getenv(...) or "gemini-nano-banana-2.1", same empty-string coalesce as the text model) and import it in image_generation_service.py, so the request URL, model_used and the /image-generation status response follow it. The new env var is wired into docker-compose.yml, docker-compose.prod.yml, docker-compose.hosted.yml and .env.example, as CONTRIBUTING requires; the two feature-flow docs that quote the old id are updated.

Test. tests/unit/test_image_generation_service.py::TestCallGeminiImage::test_image_model_comes_from_config (names the issue's behavior: URL and GEMINI_IMAGE_MODEL must follow config). It fails on dev and passes with the change; the rest of the file still passes (44 passed).


Disclosure: this change was prepared with the assistance of an AI coding agent (Claude) and submitted by a human contributor.

pcbeingused333 and others added 2 commits November 21, 2026 18:04
…the retired default

The image model was hard-coded to gemini-3.1-flash-image-preview, which Google
shut down. Move it to config.py as GEMINI_IMAGE_MODEL (env-overridable, same
pattern as GEMINI_TEXT_MODEL) and default to gemini-nano-banana-2.1. Wired into
all compose files and .env.example.

Signed-off-by: Alex <[email protected]>
) — mechanical, per the merge-train note on the PR

- feature-flows/image-generation.md, agent-avatars.md: name the configurable image model
  instead of the retired Gemini 3.1 Flash Image Preview; list GEMINI_IMAGE_MODEL in Configuration
- .env.example: the override comment covers the third var and its different default
- test_image_generation_service.py: the comment cites Abilityai#4717 (was the nonexistent #4949)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Eugene Vyborov <[email protected]>
@vybe

vybe commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

merge-train (2026-11-22): on this train. Validated at 1abeb4074. gemini-nano-banana-2.1 is confirmed on Google's deprecations page and via models.get; /review and /cso --diff are clean, and the new test drives the request URL. Thank you!

One mechanical commit pushed to your branch as 07a645337 (docs and comments only, no code):

  • docs/memory/feature-flows/image-generation.md and agent-avatars.md still named "Gemini 3.1 Flash Image Preview". They now name the GEMINI_IMAGE_MODEL model, and GEMINI_IMAGE_MODEL is listed in the Configuration section.
  • .env.example: the override comment said "both default to gemini-3.5-flash"; it now covers the third variable and its different default.
  • tests/unit/test_image_generation_service.py:65: the comment cites Image generation hard-codes gemini-3.1-flash-image-preview, which Google has shut down #4717 (it said #4949, which doesn't exist).

I approved this fork's CI runs. Note for the release: the default image model changes for installs that don't set the variable.

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge-train: batch validated on train/20261122-1848 (#4722)

@vybe
vybe merged commit 62230ca into Abilityai:dev Nov 23, 2026
26 checks passed
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.

2 participants