fix(proxy): restore wildcard expansion in /v1/model/info - #31444
Conversation
PR #30025 aligned /model/info with llm_router.model_list, which dropped wildcard expansion. Add expand_wildcard_deployments_for_model_info() in model_checks.py and call it in model_info_v1 so that wildcard deployments (e.g. openai/*) are fanned out into individual model rows, matching /v1/models behaviour. /v2/model/info is unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
CI runs ruff format --check on changed files, not black. Co-authored-by: Cursor <cursoragent@cursor.com>
Greptile SummaryRestores wildcard fan-out on
Confidence Score: 5/5The change is additive and fully defensive — empty expansions and bad params both fall through unchanged — with no modifications to existing auth or routing logic. The core expansion logic is correctly ordered and guarded; the only open items are a minor documentation gap in one test and a note about downstream dict-vs-object reads for expanded rows, neither of which affects runtime behaviour today. No files require special attention; the integration test in test_routes_model_info.py only exercises unrestricted users, so restricted-user coverage would be a worthwhile follow-up.
|
| Filename | Overview |
|---|---|
| litellm/proxy/auth/model_checks.py | Adds expand_wildcard_deployments_for_model_info with well-ordered branching logic, defensive try/except around LiteLLM_Params construction, and correct deepcopy of expanded rows. |
| litellm/proxy/proxy_server.py | Single-line insertion of expand_wildcard_deployments_for_model_info call correctly placed before allowed_model_names filtering, so expansion is visible to the permission check. |
| tests/test_litellm/proxy/auth/test_model_checks.py | Four new unit tests cover passthrough, openai/* expansion, alias preservation, and invalid-params passthrough; the invalid-params test has an implicit dependency on internal Pydantic coercion that should be documented. |
| tests/test_litellm/proxy/proxy_server/test_routes_model_info.py | Integration test validates star-wildcard expansion survives the deployment filter for unrestricted users; restricted-user (team/key scoped) interaction is not tested. |
Reviews (5): Last reviewed commit: "fix(proxy): fix reportUnknownArgumentTyp..." | Re-trigger Greptile
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…ms errors - Branch 2 of expand_wildcard_deployments_for_model_info now requires model_name to also be a wildcard before expanding via litellm_params.model, preventing concrete model_name values from being silently overwritten. - Wrap LiteLLM_Params construction in try/except so invalid params fall through unchanged instead of raising a 500 on /v1/model/info. - Add two tests covering the concrete-name + wildcard-params passthrough and the invalid-params passthrough paths. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
f791600 to
c00185b
Compare
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Star wildcard rows dropped after filter
- Expanded allowlists now use the provider wildcard from litellm_params when the public route is '*', so scoped model-info filters retain the concrete rows.
You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit c00185b. Configure here.
|
|
…nts_for_model_info - Use model_validate() instead of **kwargs spread to avoid flooding basedpyright with one reportUnknownArgumentType per LiteLLM_Params field - Use isinstance guard to narrow litellm_params_dict from Any to dict[str, Any] - Use str() cast on model_name to eliminate partially-unknown argument violations Co-authored-by: Cursor <cursoragent@cursor.com>

Summary
expand_wildcard_deployments_for_model_info()tomodel_checks.pythat fans out wildcard deployments (e.g.openai/*,*) into one row per known provider model, restoring the behaviour users expected./v1/model/infoendpoint (model_info_v1)./v2/model/infois unchanged.Note
Medium Risk
Touches model listing and permission filtering for a widely used admin/API endpoint; logic is defensive but expansion can increase response size for broad wildcards.
Overview
Restores wildcard fan-out on
/v1/model/infoafter deployments started coming fromllm_router.model_list(which fixed team-scoped rows but dropped per-model expansion).Adds
expand_wildcard_deployments_for_model_info(), which duplicates wildcard deployment dicts into one row per known provider model (viaget_known_models_from_wildcard), aligned with/v1/models./v2/model/infois unchanged.Expansion picks the wildcard from
model_namevslitellm_params.modelso a concrete alias is not replaced when only the backend model is wildcarded; invalidLiteLLM_Paramsor empty expansions pass through unchanged to avoid errors.Unit tests cover passthrough,
openai/*expansion, alias preservation, and bad params.Reviewed by Cursor Bugbot for commit c00185b. Bugbot is set up for automated code reviews on this repo. Configure here.