Repository navigation
fix(images): backport the image[] and mask[] form key drop to rc/1.102.0 (#39512) - #41697
Merged
Merged
Conversation
Contributor
|
Contributor
Author
Contributor
Author
|
bugbot run |
Contributor
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 24d4453. Configure here.
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.
TLDR
Backport of #39512 onto
rc/1.102.0, so Saturday's stablev1.102.0carries the fix (cherry-pick of merge commit 289c52b, applied clean, no rc-only changes)Problem this solves:
/v1/images/editsforwarded the rawimage[]key to providersmask[]400s the same way: "This parameter already has a different value"v1.102.0-rc.2, the current rc tip, still carries the regressionHow it solves it:
image[]andmask[]from what gets forwardedimageandmaskUser Flow
Before: a developer following LiteLLM's own documented
image[]form gets a 400 and no edited imagePOST https://litellm-domain/v1/images/editswithmodel=gpt-image-1,image[]=@tree.png, andprompt=add a small red hat on top, exactly the form the endpoint's own docs showInvalid type for 'image[0]': expected a file, but got a string instead.image=@tree.png, which returns HTTP 200 with an edited imageimage=@tree.pngplusmask[]=@mask.png, and get back HTTP 400:Invalid parameter: 'mask'. This parameter already has a different value in your parameters.mask=@mask.png, which returns HTTP 200, so the documented bracketed form is unusable through the gateway on either fieldAfter: the same documented
image[]andmask[]requests come back with an edited imagePOST https://litellm-domain/v1/images/editswithmodel=gpt-image-1,image[]=@tree.png, andprompt=add a small red hat on top, exactly the form the endpoint's own docs showb64_jsonimage and ausageblockimage=@tree.png, which returns HTTP 200 with an edited imageimage=@tree.pngplusmask[]=@mask.png, and get back HTTP 200 with an edited imagemask=@mask.pnginstead and get HTTP 200 as well, so both spellings work on both fieldsimageandimage[]together still returns HTTP 422Cannot specify both 'image' and 'image[]', so the existing guard against ambiguous requests is unchangedRelevant issues
Backport of #39512, which fixes #41421
Affected release
regression in v1.100.0 (PR #38104), still present in v1.102.0-rc.2. #39512 carries the
backport-stablelabel and this PR is that cherry-pick ontorc/1.102.0, so the fix lands before the stable is taggedLinear ticket
Resolves LIT-6816
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Both legs run on the rc line: Before is the
rc/1.102.0tip3f965660a1(whatv1.102.0-rc.2ships), After is this PR's tip0e03b62ab8. Same proxy config against the real OpenAI API withgpt-image-2.5-sunburst, two uvicorn workers (--num_workers 2) on each proxy, and the same 256x256tree.png/tree2.png/tree3.png/mask.pngset as #39512's run on main. The customer's own call shape is the OpenAI Python SDK'sclient.images.edit(image=[...]), which the SDK sends as repeatedimage[]parts, so the SDK cases come first and the curl cases cover the documented bracketed forms directly. Real spend on every 200. Same nine cases in the same order on both sidesconfig.yaml:sdk_edit.py:Each case is the command followed by its output. A 200 is summarized to
created,usage.total_tokens, theb64_jsonlength, and the number of images returned; an error shows the proxy's response bodyBefore (3f96566)
SDK: three images in a list (the customer flow)
SDK: a list of one image
SDK: a single image, not a list
curl: two image[] parts
curl: one image[] part
curl: canonical image part
curl: image plus mask[]
curl: image plus canonical mask
curl: image and image[] in one request (rejected on both sides)
After (0e03b62)
The tip has since moved to 24d4453, which only adds a
pytest.MonkeyPatchannotation on the three backported tests, so it cannot change proxy behavior and the run above still standsSDK: three images in a list (the customer flow)
SDK: a list of one image
SDK: a single image, not a list
curl: two image[] parts
curl: one image[] part
curl: canonical image part
curl: image plus mask[]
curl: image plus canonical mask
curl: image and image[] in one request (rejected on both sides)
Type
🐛 Bug Fix
Caveats (if any)
Low
image[0]parts still 500 on both sidesopenai/gpt-oss-20b, a serverless model Together retiredFinal Attestation