fix(vertex_ai): pass through native Gemini imageConfig params for image generation - #21585
Merged
Chesars merged 1 commit intoFeb 27, 2026
Conversation
…ge generation aspectRatio and imageSize were silently dropped because they weren't listed in get_supported_openai_params(), so the validation layer filtered them out before they could reach transform_image_generation_request(). Fixes BerriAI#21070
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile SummaryFixed silently dropped Key changes:
The fix ensures these native Gemini parameters flow correctly through the validation and transformation pipeline to reach the Gemini API inside Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| litellm/llms/vertex_ai/image_generation/vertex_gemini_transformation.py | Added support for aspectRatio and imageSize parameters in both camelCase and snake_case variants, properly mapping them through validation and transformation |
| tests/test_litellm/llms/vertex_ai/image_generation/test_vertex_ai_image_generation_transformation.py | Added 5 comprehensive unit tests covering both camelCase and snake_case variants of new parameters, all tests are mock-only with no network calls |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User calls litellm.image_generation with aspectRatio/imageSize] --> B[get_optional_params_image_gen]
B --> C[Provider config detected: VertexAIGeminiImageGenerationConfig]
C --> D[get_supported_openai_params validates parameters]
D --> E{Parameter variant?}
E -->|snake_case| F[map_openai_params normalizes to camelCase]
E -->|camelCase| F
F --> G[transform_image_generation_request]
G --> H[Builds imageConfig in generationConfig]
H --> I[Parameters sent to Vertex AI Gemini API]
Last reviewed commit: 155bed5
Chesars
merged commit Feb 27, 2026
955bf90
into
BerriAI:litellm_oss_staging_02_27_2026
6 of 21 checks passed
3 tasks
fzowl
pushed a commit
to fzowl/litellm
that referenced
this pull request
Jun 24, 2026
…-config-params fix(vertex_ai): pass through native Gemini imageConfig params for image generation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relevant issues
Fixes #21070
Pre-Submission checklist
tests/litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewType
🐛 Bug Fix
Changes
aspectRatioandimageSizeparameters were dropped when calling Vertex AI Gemini image generation models (gemini-3-pro-image-preview,gemini-2.5-flash-image).Fix:
aspectRatio,aspect_ratio,imageSize,image_sizetoget_supported_openai_params()so they pass validationmap_openai_params()to normalize snake_case variants to camelCase*Example
After this fix, both params are correctly forwarded to the Gemini API