Skip to content

gemini imageConfig forwarding in /images/generations and /images/edits - #28192

Closed
DmitriyAlergant wants to merge 3 commits into
BerriAI:litellm_internal_stagingfrom
DmitriyAlergant:codex/gemini-image-config-forwarding
Closed

gemini imageConfig forwarding in /images/generations and /images/edits#28192
DmitriyAlergant wants to merge 3 commits into
BerriAI:litellm_internal_stagingfrom
DmitriyAlergant:codex/gemini-image-config-forwarding

Conversation

@DmitriyAlergant

@DmitriyAlergant DmitriyAlergant commented May 18, 2026

Copy link
Copy Markdown
Contributor

Relevant issues

Fixes #24621

Prior PRs were incomplete:

@Chesars FYI

Pre-Submission checklist

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

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I am requesting Greptile review by commenting @greptileai and will receiv a Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

Live local repro against a locally built LiteLLM container/proxy on localhost.

Tested option coverage:

  • /v1/images/generations with OpenAI size mapped to Gemini imageConfig.
  • /v1/images/generations with native Gemini imageConfig forwarded as-is.
  • /v1/images/generations with imagen-4.0-generate-001, verifying Imagen still routes through the :predict response shape.
  • /v1/images/edits with multipart image upload plus multipart imageConfig, verifying the uploaded image is included and edit usage records input image tokens.

Gemini /v1/images/generations with OpenAI size

curl -sS -X POST "http://localhost:4000/v1/images/generations" \
  -H "Authorization: Bearer $LITELLM_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.1-flash-image-preview",
    "prompt": "A simple icon centered on a white background",
    "n": 1,
    "size": "768x1376"
  }'
PASS: got 768x1376 for requested 9:16, 1K

Gemini /v1/images/generations with native imageConfig

curl -sS -X POST "http://localhost:4000/v1/images/generations" \
  -H "Authorization: Bearer $LITELLM_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.1-flash-image-preview",
    "prompt": "A wide simple icon centered on a white background",
    "imageConfig": {
      "aspectRatio": "16:9",
      "imageSize": "2K"
    }
  }'
PASS: got 2752x1536 for requested 16:9, 2K

Imagen /v1/images/generations

curl -sS -X POST "http://localhost:4000/v1/images/generations" \
  -H "Authorization: Bearer $LITELLM_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "imagen-4.0-generate-001",
    "prompt": "A simple blue circle icon centered on a white background",
    "n": 1,
    "size": "1024x1024"
  }'
PASS: returned 1 base64 image from Imagen `predictions[0].bytesBase64Encoded` response path

Gemini /v1/images/edits with multipart image upload and imageConfig

curl -sS -X POST "http://localhost:4000/v1/images/edits" \
  -H "Authorization: Bearer $LITELLM_MASTER_KEY" \
  -F "model=gemini-3.1-flash-image-preview" \
  -F "prompt=Edit the uploaded image: keep the main subject recognizable and add a thick blue border around the outside. Do not create an unrelated scene." \
  -F "image=@/tmp/gemini-edit-input.png;type=image/png" \
  -F 'imageConfig={"aspectRatio":"16:9","imageSize":"1K"}'
PASS: got 1376x768 for requested 16:9, 1K
PASS: spend log usage included prompt image tokens and generated image tokens

Type

🐛 Bug Fix

Changes

For for /v1/images/generations and /v1/images/edits endpoints:

  • Respect OpenAI size for Gemini image generation by mapping it to Gemini generationConfig.imageConfig. Use the documented Gemini image aspect ratio and resolution table for exact matches, then snap unsupported dimensions to the closest known aspect ratio/resolution.
  • Allow and preserve explicit Gemini-style camelCase imageConfig as-is, if provided in the body
  • Omit imageConfig entirely for size=auto or unparseable sizes so Gemini defaults remain in control.
  • For Gemini 2.5 Flash image models, forward only aspectRatio and omit imageSize.

@DmitriyAlergant

Copy link
Copy Markdown
Contributor Author

@greptileai please review

@codecov

codecov Bot commented May 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.41667% with 38 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...llm/llms/gemini/image_generation/transformation.py 6.66% 28 Missing ⚠️
litellm/llms/gemini/common_utils.py 76.19% 10 Missing ⚠️

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes Gemini imageConfig forwarding for /images/generations and /images/edits endpoints by replacing the old 5-entry aspect-ratio map with a full Gemini-documented lookup table plus log-distance snapping for unsupported sizes.

  • Adds map_openai_size_to_gemini_image_config in common_utils.py with the complete Gemini size→aspectRatio/imageSize table, backward-compat entries for 1280x896/896x1280, and the corrected 792x336 for 21:9; also includes supports_gemini_image_size to gate imageSize for Gemini 2.5 Flash models.
  • Updates both GoogleImageGenConfig and GeminiImageEditConfig to produce a nested imageConfig dict (forwarded into generationConfig), with explicit imageConfig-over-size precedence and multipart JSON string parsing (with UnsupportedParamsError on malformed input) for the edit path.
  • Adds imageSize to GeminiImageGenerationParameters so Imagen (non-Gemini) model requests also receive the correct imageSize field alongside aspectRatio.

Confidence Score: 5/5

The change is safe to merge; it is well-scoped to Gemini image generation/editing paths and does not touch the authentication or routing layers.

All previously identified issues have been addressed: the 21:9 mapping typo is corrected to 792x336, backward-compat entries for 1280x896/896x1280 are preserved, the malformed-imageConfig JSON path now returns a 400 instead of a 500, and explicit imageConfig takes precedence over size in both transformation classes. The Imagen path now correctly forwards aspectRatio and imageSize as top-level parameters via the updated GeminiImageGenerationParameters model. Test coverage is thorough and strengthened, not weakened.

No files require special attention.

Important Files Changed

Filename Overview
litellm/llms/gemini/common_utils.py Adds GEMINI_IMAGE_SIZE_TO_ASPECT_RATIO lookup table and helper functions for mapping OpenAI size strings to Gemini imageConfig dicts; includes backward-compat entries for 1280x896 and 896x1280, and the corrected 792x336 for 21:9.
litellm/llms/gemini/image_generation/transformation.py Replaces the old 5-entry aspect-ratio map with the new imageConfig helpers; correctly branches on 'gemini' vs Imagen for how the config is applied, with explicit imageConfig-over-size precedence logic.
litellm/llms/gemini/image_edit/transformation.py Replaces _map_size_to_aspect_ratio with map_openai_size_to_gemini_image_config, adds multipart JSON string parsing for imageConfig with proper UnsupportedParamsError on malformed input, and handles imageSize exclusion for 2.5-flash models.
litellm/types/llms/gemini.py Adds imageSize field to GeminiImageGenerationParameters so the Pydantic model accepts the new field for Imagen (non-Gemini) model requests.
litellm/utils.py Registers imageConfig as an optional parameter with None default in get_optional_params_image_gen so it reaches the provider layer without triggering UnsupportedParamsError for non-Gemini providers.
tests/llm_translation/test_gemini.py Adds comprehensive parametrized tests for the full size-to-imageConfig mapping table, snapping logic, auto/invalid size pass-through, and end-to-end integration with mock HTTP handler.

Reviews (4): Last reviewed commit: "Format Gemini image generation transform" | Re-trigger Greptile

Comment on lines +110 to +111
def supports_gemini_image_size(model: str) -> bool:
return "2.5-flash" not in model

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 Hardcoded model-specific flag violates project rule

supports_gemini_image_size hard-codes "2.5-flash" as a string guard. Per the project's custom rule, model-specific capability flags must live in model_prices_and_context_window.json and be queried through get_model_info, so that support for future models can be enabled without a code change. As written, any new model that also lacks imageSize support (or any future Gemini 2.5-flash variant with a slightly different name) will silently receive imageConfig objects that include imageSize, potentially causing API errors.

Rule Used: What: Do not hardcode model-specific flags in the ... (source)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I’m going to keep the 2.5-flash guard local here rather than adding a new model_prices_and_context_window.json capability flag for this PR. This matches existing Gemini transformation patterns in this area: VertexGeminiConfig._is_gemini_3_or_newer() uses model-name detection for Gemini 3 behavior, _supports_penalty_parameters() has a model-name exception list, and the Gemini thinking mapping branches on gemini-2.5-flash-lite / gemini-2.5-pro / gemini-2.5-flash substrings.

For image generation, this is also an older-model exception: Gemini 2.5 Flash image supports aspectRatio but not imageSize, while newer Gemini image models are expected to support imageSize. Adding a new global model metadata flag for that narrow exception would add more surface area than this PR needs. I’ll add an inline code comment to make this intentional.

Comment on lines +65 to +66
elif k == "imageConfig":
mapped_params["imageConfig"] = v

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 Add an isinstance guard to match the pattern used in GeminiImageEditConfig.map_openai_params, which validates imageConfig is a dict before forwarding it. Without this check a non-dict value (e.g. a string passed by mistake) would be silently forwarded and then dropped in transform_image_generation_request without any error, while the image-edit path would just skip it cleanly.

Suggested change
elif k == "imageConfig":
mapped_params["imageConfig"] = v
elif k == "imageConfig":
if isinstance(v, dict):
mapped_params["imageConfig"] = v

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in force-pushed commit 2dfdd6f. GoogleImageGenConfig.map_openai_params now uses explicit size then imageConfig precedence, and only forwards explicit imageConfig when it is a dict.

@greptile-apps

greptile-apps Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds proper imageConfig forwarding for Gemini's /images/generations and /images/edits endpoints, mapping OpenAI size parameters to Gemini's aspectRatio/imageSize using the full documented Gemini resolution table, and allowing explicit imageConfig pass-through.

  • common_utils.py adds a large dimension-to-aspect-ratio lookup table plus a log-distance fallback for unrecognized sizes, with separate helpers to detect imageSize support per model.
  • Both transformation files are updated to emit generationConfig.imageConfig; the image-edit path is correct, but the image-generation path silently drops aspect ratio for non-Gemini Imagen models.
  • http_parsing_utils.py gains Gemini-specific imageConfig JSON decoding in the shared form-data path.

Confidence Score: 3/5

Not safe to merge as-is: the image-generation transformation no longer passes any aspect ratio to non-Gemini Imagen models when a size is specified.

The image-generation transformation now writes imageConfig into optional_params for every model, but GeminiImageGenerationParameters only has an aspectRatio field. Pydantic silently ignores imageConfig, so any user passing size to an Imagen model gets a request with no aspect ratio — a silent regression. The image-edit path is clean and the new lookup table is well-tested.

litellm/llms/gemini/image_generation/transformation.py — map_openai_params and transform_image_generation_request need to route Imagen models to aspectRatio while routing Gemini models to imageConfig.

Important Files Changed

Filename Overview
litellm/llms/gemini/image_generation/transformation.py Switches from writing aspectRatio to writing imageConfig in optional_params; breaks Imagen (non-Gemini) models because GeminiImageGenerationParameters has no imageConfig field
litellm/llms/gemini/common_utils.py Adds size-to-imageConfig mapping with a large lookup table and log-distance fallback; hardcodes 2.5-flash model name for imageSize support, and silently changes aspect-ratio for sizes 1280x896/896x1280
litellm/llms/gemini/image_edit/transformation.py Correctly refactors image-edit mapping to use imageConfig; imageConfig from request overrides size-derived config deterministically
litellm/proxy/common_utils/http_parsing_utils.py Adds Gemini-specific imageConfig to the list of JSON-decoded form fields in a shared proxy utility
litellm/utils.py Adds imageConfig as a recognized optional param in get_optional_params_image_gen; minimal and correct
litellm/types/images/main.py Adds imageConfig to ImageEditOptionalRequestParams TypedDict; straightforward type addition
tests/test_litellm/llms/gemini/image_edit/test_gemini_image_edit_transformation.py New unit tests cover imageConfig forwarding for image edit; pure mock-based
tests/llm_translation/test_gemini.py Comprehensive parametrized tests for size-to-imageConfig mapping; mocked HTTP calls

Comments Outside Diff (1)

  1. litellm/llms/gemini/image_generation/transformation.py, line 55-66 (link)

    P1 Aspect-ratio mapping silently dropped for Imagen (non-Gemini) models

    The old code set mapped_params["aspectRatio"], which is a recognized field on GeminiImageGenerationParameters. The new code sets mapped_params["imageConfig"] for every model — but GeminiImageGenerationParameters has no imageConfig field, so when transform_image_generation_request reaches the non-Gemini branch and calls GeminiImageGenerationParameters(**optional_params), Pydantic silently drops the key. Any user currently passing size to an Imagen model (e.g. imagen-3.0-generate-002) will get a request with no aspect ratio at all, whereas before they received the correct aspectRatio value.

Reviews (2): Last reviewed commit: "Fix Gemini image config mapping" | Re-trigger Greptile

Comment on lines +110 to +111
def supports_gemini_image_size(model: str) -> bool:
return "2.5-flash" not in model

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 Hardcoded model-specific flag for imageSize support

supports_gemini_image_size hard-codes the string "2.5-flash" to gate feature availability. Per the team's rule, model-specific capabilities should live in model_prices_and_context_window.json and be queried via get_model_info, so that a new model that also lacks imageSize support doesn't require a code change and a LiteLLM release to be handled correctly.

Suggested change
def supports_gemini_image_size(model: str) -> bool:
return "2.5-flash" not in model
def supports_gemini_image_size(model: str) -> bool:
# TODO: move this capability flag to model_prices_and_context_window.json
# and query via get_model_info so new models work without a code change.
return "2.5-flash" not in model

Rule Used: What: Do not hardcode model-specific flags in the ... (source)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I’m going to keep the 2.5-flash guard local here rather than adding a new model_prices_and_context_window.json capability flag for this PR. This matches existing Gemini transformation patterns in this area: VertexGeminiConfig._is_gemini_3_or_newer() uses model-name detection for Gemini 3 behavior, _supports_penalty_parameters() has a model-name exception list, and the Gemini thinking mapping branches on gemini-2.5-flash-lite / gemini-2.5-pro / gemini-2.5-flash substrings.

For image generation, this is also an older-model exception: Gemini 2.5 Flash image supports aspectRatio but not imageSize, while newer Gemini image models are expected to support imageSize. Adding a new global model metadata flag for that narrow exception would add more surface area than this PR needs. I’ll add an inline code comment to make this intentional.

Comment on lines +42 to +46
for json_field in ("metadata", "imageConfig"):
if json_field in parsed_body and isinstance(
parsed_body[json_field], str
):
parsed_body[json_field] = json.loads(parsed_body[json_field])

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 Gemini-specific field name hardcoded in generic proxy utility

imageConfig is a Gemini API concept; adding it to this shared proxy parsing file couples the provider-agnostic request layer to a single provider's naming convention. Provider-specific deserialization logic should live in the provider's own transformation layer, not here.

Rule Used: What: Avoid writing provider-specific code outside... (source)

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!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in force-pushed commit 2dfdd6f. I removed imageConfig JSON parsing from the shared proxy parsing utility and moved multipart string parsing into the Gemini image edit transformation path.

Comment on lines +134 to +144
def _map_dimensions_to_gemini_aspect_ratio(width: int, height: int) -> str:
if (width, height) in GEMINI_IMAGE_SIZE_TO_ASPECT_RATIO:
return GEMINI_IMAGE_SIZE_TO_ASPECT_RATIO[(width, height)]

requested_ratio = width / height
return min(
GEMINI_IMAGE_ASPECT_RATIOS,
key=lambda aspect_ratio: abs(
math.log(GEMINI_IMAGE_ASPECT_RATIOS[aspect_ratio] / requested_ratio)
),
)

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 Silent aspect-ratio change for previously-supported sizes 1280x896 and 896x1280

The old _map_size_to_aspect_ratio mapped "1280x896""4:3" and "896x1280""3:4". These dimensions are absent from GEMINI_IMAGE_SIZE_TO_ASPECT_RATIO, so they fall through to the log-distance snapper, which now picks "3:2" and "2:3" respectively. Users who relied on these specific sizes will get a different aspect ratio after the upgrade without any warning.

Rule Used: What: avoid backwards-incompatible changes without... (source)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in force-pushed commit 2dfdd6f. The mapping table now preserves the prior behavior for 1280x896 -> 4:3 and 896x1280 -> 3:4, with regression coverage added.

@DmitriyAlergant
DmitriyAlergant force-pushed the codex/gemini-image-config-forwarding branch from 9a4ec8e to 2dfdd6f Compare May 18, 2026 21:50
@DmitriyAlergant

Copy link
Copy Markdown
Contributor Author

@greptileai please re-review

Comment thread litellm/llms/gemini/common_utils.py Outdated
(1376, 768): "16:9",
(2752, 1536): "16:9",
(5504, 3072): "16:9",
(792, 168): "21:9",

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 21:9 entry (792, 168) is mathematically incorrect: 792 / 168 = 4.714, which is nowhere near 21 / 9 = 2.333. Every other 21:9 group divides the larger resolution by 2 to get the next row — (3168, 1344)(1584, 672) → half again should be (792, 336), not (792, 168). As a result, any request with size="792x168" will hit the exact-match path and return aspectRatio: "21:9" for a 4.7:1 image. The companion test has the same value so it would need to be corrected too.

Suggested change
(792, 168): "21:9",
(792, 336): "21:9",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 82a9bba880 by correcting the 21:9 512-row lookup to 792x336.

Comment on lines +58 to +62
image_config_param = filtered_params.get("imageConfig")
if isinstance(image_config_param, str):
image_config_param = json.loads(image_config_param)
if isinstance(image_config_param, dict):
mapped_params["imageConfig"] = image_config_param

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 json.loads here is uncaught. When a multipart form request supplies a malformed string for imageConfig (e.g. "{bad") this raises json.JSONDecodeError, which propagates all the way up as an unhandled exception and surfaces to the caller as a 500 error instead of a 400 validation error.

Suggested change
image_config_param = filtered_params.get("imageConfig")
if isinstance(image_config_param, str):
image_config_param = json.loads(image_config_param)
if isinstance(image_config_param, dict):
mapped_params["imageConfig"] = image_config_param
image_config_param = filtered_params.get("imageConfig")
if isinstance(image_config_param, str):
try:
image_config_param = json.loads(image_config_param)
except json.JSONDecodeError:
image_config_param = None
if isinstance(image_config_param, dict):
mapped_params["imageConfig"] = image_config_param

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 82a9bba880 by converting malformed string imageConfig into an UnsupportedParamsError/400 instead of allowing a raw JSONDecodeError/500, with regression coverage.

Comment thread tests/llm_translation/test_gemini.py Outdated
("1376x768", "16:9", "1K"),
("2752x1536", "16:9", "2K"),
("5504x3072", "16:9", "4K"),
("792x168", "21:9", "512"),

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 This test row mirrors the wrong value from the lookup table. It should use "792x336" (ratio ≈ 2.36, matching 21:9) so the test actually validates the correct mapping rather than confirming the bug.

Suggested change
("792x168", "21:9", "512"),
("792x336", "21:9", "512"),

Rule Used: What: Flag any modifications to existing tests and... (source)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 82a9bba880 by updating the test expectation to 792x336.

@oss-pr-review-agent-shin

Copy link
Copy Markdown
Contributor

🤖 litellm-agent: This PR is currently BLOCKED from merge.

Score: 2/5

Why blocked:

  • 1 PR-related CI failure (Greptile gate: score 3/5 below required 4/5 — request a Greptile review (@greptileai) and resolve its comments before maintainer review.) (pr_related_failures, -2 pts)
  • Greptile 3/5 (greptile_low, -1 pts)

Details: Score docked for: 1 PR-related CI failure (Greptile gate: score 3/5 below required 4/5 — request a Greptile review (@greptileai) and resolve its comments before maintainer review.); Greptile 3/5.

Fix the issues above and push an update — the bot will re-review automatically.

Note: This bot is still in beta and might not always work as expected. Please share any feedback via Slack.

@DmitriyAlergant

Copy link
Copy Markdown
Contributor Author

@greptileai fixes pushed (82a9bba + lint fix: c066090), please re-review.

BTW the mapping table for supported and asserted gemini resolutions aspect sizes was put together based on https://ai.google.dev/gemini-api/docs/image-generation#aspect_ratios_and_image_size and now re-validated.

The issue here is that google's published documentation contains what appears to be a typo

CleanShot 2026-05-18 at 18 35 36@2x

Our inaccuracy is forgivable since it's based on Google's.Agreed that our code still needs to be valid, 792x168 is likely not a thing. If size "792x168" is legitimately passed by the client, let it snap to whatever closest supported aspect ratio is (4:1) via the fallback math.

@DmitriyAlergant

Copy link
Copy Markdown
Contributor Author

@oss-pr-review-agent-shin please re-review. Gemini's feedback taken into account, now 5/5

@DmitriyAlergant

Copy link
Copy Markdown
Contributor Author

@greptileai you left two separate comments one with 5/5 and another with 3/5; The finalizing PR review agent (Shin) is now confused. If you believe the 3/5 comment was already addressed, can you please edit it as well.

@greptile-apps

greptile-apps Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Clarification re: conflicting scores

The 3/5 comment was posted against an earlier commit (9a4ec8ee73) and flagged a real regression: imageConfig was being written into optional_params for all models, but GeminiImageGenerationParameters had no imageConfig field, so Pydantic silently dropped it and Imagen (non-Gemini) models lost their aspectRatio entirely.

That issue has been fully resolved in the subsequent commits (82a9bba88 + c066090e5): imageSize was added to GeminiImageGenerationParameters, and the transformation now correctly branches — Gemini models receive imageConfig nested under generationConfig, while Imagen models receive aspectRatio/imageSize as top-level parameters via the updated Pydantic model.

The 5/5 comment reflects the current state of the PR after those fixes. The 3/5 score is stale and should be disregarded — the current score is 5/5 and this PR is safe to merge.

Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.

@oss-pr-review-agent-shin

Copy link
Copy Markdown
Contributor

🤖 litellm-agent: This PR is currently BLOCKED from merge.

Score: 2/5

Why blocked:

  • 1 PR-related CI failure (Greptile gate: score 3/5 below required 4/5 — request a Greptile review (@greptileai) and resolve its comments before maintainer review.) (pr_related_failures, -2 pts)
  • Greptile 3/5 (greptile_low, -1 pts)

Details: Score docked for: 1 PR-related CI failure (Greptile gate: score 3/5 below required 4/5 — request a Greptile review (@greptileai) and resolve its comments before maintainer review.); Greptile 3/5.

Fix the issues above and push an update — the bot will re-review automatically.

Note: This bot is still in beta and might not always work as expected. Please share any feedback via Slack.

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]: Cannot generate 2K images with Gemini 3.1 Flash Image Preview (stuck at 1K) - extra_body is stripped

1 participant