Repository navigation
fix(openai): relay param and plain message from OpenAI-compatible backend errors - #53217
Merged
Merged
Conversation
Collaborator
Author
Collaborator
Author
|
bugbot run |
Contributor
PR overviewNo security issues were found in this pull request. Reviews
|
Contributor
[Medium impact] The PR appears safe to merge, with no new actionable issues found.
|
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 c0e050c. Configure here.
Collaborator
Author
kerry-berri
approved these changes
Nov 20, 2026
kenneth-berri
deleted the
litellm_relay_openai_compatible_error_param
branch
November 20, 2026 23:53
6 tasks done
4 of 6 tasks
Contributor
2 of 10 tasks
yuneng-berri
added a commit
that referenced
this pull request
Nov 23, 2026
…ges (#53940) Brings nine tests in line with behavior that intentionally changed: - SSO client removal: /sso/key/generate without SSO now redirects to /ui/login (#53205) - budget partial update: /budget/info returns the app relation keys (#52477, #52787, #53232) - performance alerts opt-out: /alerts/monitoring returns thresholds (#52139) - cost margin rejection: the error names 'customer' as a valid key (#52406) - regional two-image generation: Gemini gets n single-image requests (#52103) - customer app budget key rotation: the rotated key's cleanup tolerates /key/regenerate - DeepSeek 401: the upstream error type is relayed (#53217) - vLLM rejected predicate: the plain upstream message is relayed (#53217). The case still fails on the non-OpenAI error type that #51809 fixes - /callbacks/list e2e: the Rust spend logger is listed as spend_log (#52182)
1 of 10 tasks
1 task done
mateo-berri
pushed a commit
to edvinsq/litellm
that referenced
this pull request
Nov 24, 2026
…kend errors (BerriAI#53217) LTS adaptation: BadRequestError, ImageFetchError and ContentPolicyViolationError take body as Mapping[str, object], as they do on main, so the decoded body type checks (cherry picked from commit d1454b2)
mateo-berri
added a commit
to edvinsq/litellm
that referenced
this pull request
Nov 24, 2026
…nAI-compatible backends Picks BerriAI#51809's change onto lts/1.108.x on top of the BerriAI#53217 pick LTS adaptations: - Carries the part of BerriAI#49073 this builds on: relayed_provider_specific_fields, client-field redaction, the relay in handle_llm_api_exception, its recursion ignore entry and the two chained-proxy tests - core_helpers gains http_error_status, which main has as a private helper behind its error_status_code. This line keeps its own error_status_code - /v1/completions answers type and param through openai_error_type and openai_error_param, as main does through route_failure_proxy_exception, so a decoded vLLM BadRequestError type falls back to invalid_request_error - No verbosity -> text.verbosity rename, since this line's chat bridge never forwards text.verbosity (main does since BerriAI#49049) - No LiteLLM Proxy get_error_class move or S3 golden update, since neither exists on this line
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.
Handwritten 1-3 sentence description
Errors from OpenAI-compatible backends like vLLM now come back with the backend's
paramand its plain error message, so clients can tell which request field was rejected.Details
Link to Devin session: https://app.devin.ai/sessions/e05d96a34f9a4bc0952518c13b908fa9
Open in Devin Desktop: https://app.devin.ai/desktop/session/e05d96a34f9a4bc0952518c13b908fa9?variant=devin
Requested by: @kenneth-berri
TLDR
Problem this solves:
error.paramwas dropped, clients always gotnullerror.messageheld the whole backend body as a string/v1/completionsshowed a Python dict repr of itHow it solves it:
User Flow
Before: a developer calling a vLLM model through the proxy cannot tell which field the backend rejected
"max_tokens": -5to ahosted_vllm/modelerror.paramisnullerror.messagecontains the backend's whole JSON error as an escaped string, or a Python dict repr on /v1/completionsAfter: the same request names the rejected field
"max_tokens": -5error.paramismax_tokenserror.messageislitellm.BadRequestError: Hosted_vllmException - max_tokens must be at least 1, got -5. ...followed by the fallback note, the same on /v1/completions and /v1/responsesRelevant issues
Fixes #47949
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<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 moreDelays 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 ran a live proxy against real providers.
glm-5.3is the reporter's model, zai-org/GLM-5.3, served by Together's OpenAI-compatible API through thehosted_vllm/route.vllm-routeis the samehosted_vllm/route pointed at OpenAI's API, andopenai-routeis the plainopenai/route for comparison. The proxy ran with one worker and no Redis, since the error mapping reads no shared state.Shared setup, run the same way for both legs. It needs
OPENAI_API_KEYandTOGETHER_API_KEYreal.yaml
real_requests.sh
Before (6bcc7ff)
Output, every hosted_vllm error has param null and the backend body as a string inside message
After (c0e050c)
Output, param and the plain message come through on every route, and the happy paths still work
Together's
/v1/completionssends"param": nullitself for this error, so that route shows the message fix only. No vLLM server or GPU was available, so the exact vLLM body from #47949 was also replayed from a small local server (backend.py) through the reporter's config and three requests, which coversparamon/v1/completions.Replay of the reporter's vLLM error body, setup and output for both legs
config.yaml
backend.py
Before (6bcc7ff)
After (c0e050c)
The two new regression tests fail on the merge base and pass on this commit.
Type
🐛 Bug Fix
Caveats (if any)
Medium
error.typenow relays the backend's value tooBadRequestError, before it wasinvalid_request_erroropenai/chat models already didLow
error.messageFinal Attestation