Repository navigation
fix(proxy): list key and team model aliases in GET /v1/models #42908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
a3a2a1a
d6ec911
c39356e
f187b8a
8a205fb
470725b
2eb9a1d
579abf4
4a06c64
459bbd3
8e970ce
884653a
2557744
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -422,6 +422,9 @@ def generate_feedback_box(): | |
| from litellm.proxy.common_utils.model_listing_utils import ( | ||
| ClaudeCodeRoutingNames, | ||
| TeamModelNameTranslator, | ||
| alias_listing_entries, | ||
| alias_target, | ||
| caller_alias_maps, | ||
| claude_code_view_ids, | ||
| configured_display_names, | ||
| is_claude_code_client, | ||
|
|
@@ -11172,14 +11175,13 @@ async def model_list( | |
| view_aliases: Final = ( | ||
| view_router_settings.get("model_group_alias") if isinstance(view_router_settings, Mapping) else None | ||
| ) | ||
| caller_aliases: Final = caller_alias_maps( | ||
| user_api_key_dict.aliases, user_api_key_dict.team_model_aliases, user_api_key_dict.team_id, team_id | ||
| ) | ||
| routing_names: Final = ClaudeCodeRoutingNames( | ||
| llm_router, | ||
| team_id or user_api_key_dict.team_id, | ||
| ( | ||
| user_api_key_dict.aliases, | ||
| user_api_key_dict.team_model_aliases, | ||
| view_aliases, | ||
| ), | ||
| (*caller_aliases, view_aliases), | ||
| ) | ||
|
|
||
| # Validate scope parameter if provided | ||
|
|
@@ -11307,7 +11309,9 @@ async def model_list( | |
| # The internal routing key drives the metadata/fallback lookup, while the | ||
| # public name is what the client sees as the model id. | ||
| model_data = [] | ||
| entries: Final = TeamModelNameTranslator.listing_entries(all_models, llm_router, settings) | ||
| entries: Final = alias_listing_entries( | ||
| TeamModelNameTranslator.listing_entries(all_models, llm_router, settings), caller_aliases | ||
| ) | ||
| for response_id, lookup_id in entries: | ||
| model_info = create_model_info_response( | ||
| model_id=lookup_id, | ||
|
|
@@ -11404,7 +11408,13 @@ async def model_info( | |
|
|
||
| internal_to_public: Final = TeamModelNameTranslator.build_internal_to_public_map(llm_router, settings) | ||
| resolved_model_id: Final = TeamModelNameTranslator.resolve_public_name( | ||
| model_id=model_id, | ||
| model_id=alias_target( | ||
| model_id, | ||
| caller_alias_maps( | ||
| user_api_key_dict.aliases, user_api_key_dict.team_model_aliases, user_api_key_dict.team_id, team_id | ||
| ), | ||
| ) | ||
| or model_id, | ||
|
greptile-apps[bot] marked this conversation as resolved.
Resolved
greptile-apps[bot] marked this conversation as resolved.
Resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alias retrieve overwrites response idMedium Severity
Additional Locations (1)Reviewed by Cursor Bugbot for commit d6ec911. Configure here.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in f187b8a: when the request is an alias the response id is the alias, regression test added for a team scoped target |
||
| available_models=all_models, | ||
|
Comment on lines
11426
to
11428
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If an undiscoverable team model and a discoverable model share a public ID,
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pre-existing and out of scope:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right — the existing |
||
| llm_router=llm_router, | ||
| general_settings=settings, | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.