Skip to content

fix: set supports_reasoning=false for Vertex AI Gemini image models - #31907

Open
bennedictbett wants to merge 4 commits into
BerriAI:litellm_internal_stagingfrom
bennedictbett:fix/vertex-ai-image-models-supports-reasoning
Open

fix: set supports_reasoning=false for Vertex AI Gemini image models#31907
bennedictbett wants to merge 4 commits into
BerriAI:litellm_internal_stagingfrom
bennedictbett:fix/vertex-ai-image-models-supports-reasoning

Conversation

@bennedictbett

Copy link
Copy Markdown

Relevant issues

Fixes #31758

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

Bug is purely a missing field in the cost map JSON — no LLM calls needed.
Verified with pytest before submitting:

pytest tests/test_litellm/llms/vertex_ai/image_generation/test_vertex_ai_image_generation_transformation.py::TestVertexAIImageModelsSupportsReasoning -v
# 2 passed

Type

🐛 Bug Fix
✅ Test

Changes

  • Added "supports_reasoning": false to 5 Vertex AI / Gemini image model
    entries in both model_prices_and_context_window.json and the bundled backup
  • Added TestVertexAIImageModelsSupportsReasoning with 2 tests confirming the
    fix via the local cost map — no network calls

@CLAassistant

CLAassistant commented Jul 1, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@greptile-apps

greptile-apps Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR completes the fix for Vertex AI and Gemini image models incorrectly inheriting supports_reasoning=True from the provider-level fallback. The root cause was missing explicit "supports_reasoning": false fields in the cost-map JSON entries for image generation models.

  • Adds "supports_reasoning": false to all 10 affected image model entries across both model_prices_and_context_window.json (remote source) and litellm/model_prices_and_context_window_backup.json (bundled backup), covering the 5 models from the original fix plus the 4 non-preview siblings (vertex_ai/gemini-3-pro-image, vertex_ai/gemini-3.1-flash-image, gemini/gemini-3-pro-image, gemini/gemini-3.1-flash-image) that the previous review flagged.
  • Adds TestVertexAIImageModelsSupportsReasoning with two unit tests — one verifying the field is present in the local cost map and one verifying litellm.supports_reasoning() returns False — with the MODELS list expanded to all 10 affected models.

Confidence Score: 5/5

Safe to merge — the change is purely additive JSON fields in two cost-map files with no logic changes and comprehensive test coverage.

Both cost-map files (remote source and bundled backup) are fully patched for all 10 affected Gemini image models. The test class covers each model with two independent assertions and makes no network calls. The previous review's gap — missing fixes for the four non-preview sibling models — has been addressed in this revision.

No files require special attention.

Important Files Changed

Filename Overview
model_prices_and_context_window.json All 10 affected Gemini image models now have supports_reasoning: false — verified for both gemini/ and vertex_ai/ prefixed entries, including the 4 non-preview siblings added in this revision.
litellm/model_prices_and_context_window_backup.json Backup JSON kept in sync with the main file; all 10 image model entries carry supports_reasoning: false.
tests/test_litellm/llms/vertex_ai/image_generation/test_vertex_ai_image_generation_transformation.py New TestVertexAIImageModelsSupportsReasoning class covers all 10 models with two complementary assertions (cost-map field and public API); no network calls, consistent with repo test conventions.

Reviews (2): Last reviewed commit: "fix: add supports_reasoning=false to 4 n..." | Re-trigger Greptile

Comment on lines +661 to +667
MODELS = [
"vertex_ai/gemini-2.5-flash-image",
"vertex_ai/gemini-3-pro-image-preview",
"vertex_ai/gemini-3.1-flash-image-preview",
"gemini/gemini-3-pro-image-preview",
"gemini/gemini-3.1-flash-image-preview",
]

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.

P1 The MODELS list only covers the five models that received the JSON fix. The four non-preview siblings — vertex_ai/gemini-3-pro-image, vertex_ai/gemini-3.1-flash-image, gemini/gemini-3-pro-image, and gemini/gemini-3.1-flash-image — are absent, so the test suite currently passes while those models still incorrectly return supports_reasoning=True.

Suggested change
MODELS = [
"vertex_ai/gemini-2.5-flash-image",
"vertex_ai/gemini-3-pro-image-preview",
"vertex_ai/gemini-3.1-flash-image-preview",
"gemini/gemini-3-pro-image-preview",
"gemini/gemini-3.1-flash-image-preview",
]
MODELS = [
"vertex_ai/gemini-2.5-flash-image",
"vertex_ai/gemini-3-pro-image",
"vertex_ai/gemini-3-pro-image-preview",
"vertex_ai/gemini-3.1-flash-image",
"vertex_ai/gemini-3.1-flash-image-preview",
"gemini/gemini-2.5-flash-image",
"gemini/gemini-3-pro-image",
"gemini/gemini-3-pro-image-preview",
"gemini/gemini-3.1-flash-image",
"gemini/gemini-3.1-flash-image-preview",
]

Comment on lines +687 to +689
assert result is False, (
f"{model}: litellm.supports_reasoning() returned {result!r}, expected False"
)

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.

P2 The file is missing a trailing newline. Most linters and editors will flag this.

Suggested change
assert result is False, (
f"{model}: litellm.supports_reasoning() returned {result!r}, expected False"
)
assert result is False, (
f"{model}: litellm.supports_reasoning() returned {result!r}, expected False"
)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@bennedictbett
bennedictbett force-pushed the fix/vertex-ai-image-models-supports-reasoning branch 2 times, most recently from ac12d46 to d7b1715 Compare July 3, 2026 19:53
@bennedictbett

Copy link
Copy Markdown
Author

@greptileai re-review

Addressed the incomplete fix flagged in the previous review - added
supports_reasoning: false to the 4 non-preview sibling models
(vertex_ai/gemini-3-pro-image, vertex_ai/gemini-3.1-flash-image,
gemini/gemini-3-pro-image, gemini/gemini-3.1-flash-image) and
expanded the test MODELS list to cover all 9 affected models.

@bennedictbett
bennedictbett force-pushed the fix/vertex-ai-image-models-supports-reasoning branch from 2ceb5fc to d7b1715 Compare August 20, 2026 14:25
@bennedictbett
bennedictbett force-pushed the fix/vertex-ai-image-models-supports-reasoning branch from d7b1715 to 77fb31c Compare August 20, 2026 19:05
@codspeed-hq

codspeed-hq Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing bennedictbett:fix/vertex-ai-image-models-supports-reasoning (5776980) with litellm_internal_staging (65b4ac0)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (e17988f) during the generation of this report, so eb6296e was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

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.

Bug: Vertex AI Gemini image models incorrectly inherit reasoning support

2 participants