Repository navigation
[feat]: sort /v1/models response alphabetically by model ID #3888
levi-zheng
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Feature Request
Summary
The
/v1/modelsendpoint currently returns models in provider declaration order(the order they appear in
config.yaml). This makes the model list hard tonavigate in downstream tools like Cursor, Cline, and Windsurf, especially when
multiple providers are configured.
Expected Behavior
Models in the
/v1/modelsresponse should be sorted alphabetically byid,so the list is predictable and easy to scan regardless of provider declaration order.
Current Behavior
Models are returned in the order they are registered across providers. When
multiple providers expose the same alias (e.g.
gemini-3.1-profrom bothantigravityandanyrouter), the merged list order is effectively arbitrary.Motivation
models sorted alphabetically — this is the de facto standard
whenever providers are added or reordered in config
sort.Sliceon the final model list beforeserialization, with zero impact on routing or alias resolution logic
Suggested Implementation
Sort the model list by
idbefore returning in the/v1/modelshandler:Optionally, this could be made configurable (e.g.
model-list-sort: alphabetical)if the maintainers prefer to keep the current behavior as default.
Environment
All reactions