Repository navigation
fix(decisions): support the litellm_proxy provider - #51611
Merged
kenneth-berri merged 5 commits intoNov 19, 2026
Merged
Conversation
Decision calls failed with "Unknown Decisions provider 'litellm_proxy'" when litellm.use_litellm_proxy was on, or with a litellm_proxy/ model, because the decisions lookup had no config for that provider. Chat, responses and images already have one. The new config posts the OpenAI decisions format to the proxy's /v1/decisions, with LITELLM_PROXY_API_BASE and LITELLM_PROXY_API_KEY as fallbacks and no fallback to OpenAI's base URL or key.
bofenghuang
marked this pull request as ready for review
November 13, 2026 11:33
Contributor
…ellm_proxy # Conflicts: # litellm/utils.py
Pass the per-call use_litellm_proxy flag into provider resolution so a router deployment flagged for the proxy sends Decisions to the proxy with its own key, and pin that litellm_proxy never falls back to OpenAI's base or key.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Collaborator
Collaborator
|
bugbot run |
Contributor
[Medium impact] This PR appears safe to merge.
|
…and allow a keyless proxy Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Collaborator
Collaborator
|
bugbot run |
Collaborator
Collaborator
|
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 20f7864. Configure here.
kenneth-berri
approved these changes
Nov 19, 2026
This was referenced Nov 20, 2026
fix(decisions): keep systemone confidence, extra fields and proxy cost on litellm_proxy calls
#53195
Merged
mateo-berri
pushed a commit
to chaznm/litellm
that referenced
this pull request
Nov 21, 2026
Backport of BerriAI#51611 to lts/1.108.x. Cherry-picked from 8f651ba (litellm_decisions_litellm_proxy). Adapted to the line: lts/1.108.x registers lazy imports in its tuple-and-map registry and resolves decisions configs with per-provider ifs, and the test file gains main's single-answer predicate fixture.
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
Decision calls failed whenever an SDK app sent its traffic through a LiteLLM proxy, with the global proxy setting or a proxy model name, while chat and responses calls worked the same way. This adds the proxy as a decisions provider, so those calls now reach the proxy's decisions endpoint with the proxy's own URL and key.
Details
Link to Devin session: https://app.devin.ai/sessions/cbf54201bf3f4a4bade38409b9bd020d
Open in Devin Desktop: https://app.devin.ai/desktop/session/cbf54201bf3f4a4bade38409b9bd020d?variant=devin
Requested by: @kenneth-berri
TLDR
Problem this solves:
litellm.use_litellm_proxyis onlitellm_proxy/...model fail the same wayHow it solves it:
litellm_proxyprovider/v1/decisionsUser Flow
Before: an SDK app that sends all its calls through a LiteLLM proxy cannot make decision calls
litellm.use_litellm_proxy = True,LITELLM_PROXY_API_BASEandLITELLM_PROXY_API_KEYlitellm.acompletion(model="openai/gpt-6-luna", ...)reaches the proxy and answerslitellm.adecisions(model="openai/gpt-6-luna", ...)raisesBadRequestError: Unknown Decisions provider 'litellm_proxy'before sending anything, and the same happens withmodel="litellm_proxy/openai/gpt-6-luna"and the flag offAfter: the same decision call goes through the proxy
litellm.use_litellm_proxy = True,LITELLM_PROXY_API_BASEandLITELLM_PROXY_API_KEYlitellm.acompletion(model="openai/gpt-6-luna", ...)reaches the proxy and answerslitellm.adecisions(model="openai/gpt-6-luna", ...)sends POST<LITELLM_PROXY_API_BASE>/v1/decisionswith"model": "openai/gpt-6-luna"and the proxy key, and returns the proxy's answers, andmodel="litellm_proxy/openai/gpt-6-luna"with the flag off does the sameLinear ticket
Resolves LIT-10917
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
The fix is in the SDK, so the proxies stay the same throughout and only the client's litellm checkout changes between Before and After. Both proxies run current main with one worker and no Redis, since nothing here touches proxy state. The upstream is the real OpenAI
openai/gpt-6-lunadecisions model.Shared setup, with env var names only
LITELLM_MASTER_KEY=... OPENAI_API_KEY=... python litellm/proxy/proxy_cli.py --config config.yaml --port 4011LITELLM_DANGEROUSLY_PERMIT_WEAK_OR_UNSET_MASTER_KEY=true OPENAI_API_KEY=... python litellm/proxy/proxy_cli.py --config config_keyless.yaml --port 4012LITELLM_PROXY_API_BASE=http://127.0.0.1:<port>and, for the keyed proxy,LITELLM_PROXY_API_KEYset to the master keyPYTHONPATH=<checkout> python client.py <case>for each case belowconfig.yaml, config_keyless.yaml, client.py
Before (f041b70, the merge base with main)
Neither proxy logged a
POST /v1/decisions. Theper-callandroutercases answered because theuse_litellm_proxyflag was ignored and the SDK called OpenAI directly with the localOPENAI_API_KEY, skipping the proxy.After (abcbd7a, the latest product commit)
The keyed proxy logged nine
POST /v1/decisionsfor these nine calls, five with 200, three with 400 (unknown-model,box,audio) and one with 401 (wrong-key). The keyless proxy logged one with 200. So every call now reaches the proxy, and theboxandaudioerrors are the proxy's own answer for a model that takes neither.Focused checks at abcbd7a are
pytest tests/unit/decisions(553 passed) andmake check(PASS).Type
🐛 Bug Fix
Caveats (if any)
Low
api_keyorLITELLM_PROXY_API_KEYonlyOPENAI_API_KEYandlitellm.api_keyare never sent to the proxy, unlike the plainopenaidecisions configFinal Attestation
Note
Low Risk
Narrow routing fix for the Decisions API with regression tests; main risk is misrouted requests or credentials, which the new config and tests explicitly guard against.
Overview
Adds
LiteLLMProxyDecisionsConfigsoadecisions/decisionscan reach the proxy’s/v1/decisionsendpoint the same way chat and responses already do whenuse_litellm_proxyis on or the model is prefixed withlitellm_proxy/.prepare_callnow passesuse_litellm_proxyintoget_llm_provider, so per-call and Router deployments route to the proxy instead of OpenAI. The new config usesLITELLM_PROXY_API_BASEandLITELLM_PROXY_API_KEY(optional key), refuses OpenAI credential fallbacks, and forwards box questions, audio, and video unless deploymentmodel_infoturns them off—leaving capability checks to the proxy.Provider registration is wired through lazy imports,
ProviderConfigManager, and tests cover routing, missing proxy base, auth headers, media payloads, and Routeruse_litellm_proxy.Reviewed by Cursor Bugbot for commit 20f7864. Bugbot is set up for automated code reviews on this repo. Configure here.