mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5477] [Engine] Add GET /v1/models/{model_id} single model retrieve endpoint #5456
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5456
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/5477
Author: @DamirLukina88
Created: 11/7/2026
Status: 🔄 Open
Base:
main← Head:pr/issue-5460-model-retrieve📝 Commits (1)
dd2a60cserve: implement GET /v1/models/{model_id} single model retrieve endpoint (#5460)📊 Changes
2 files changed (+40 additions, -3 deletions)
View changed files
📝
serve/server.py(+14 -3)📝
serve/test_server.py(+26 -0)📄 Description
Problem and result
Visual Studio 2026's BYOK custom-OpenAI provider (18.10 preview) validates custom models by probing
GET {base}/v1/models/{model_id}before accepting a connection. Previously,serve/server.pyhandledGET /v1/modelsandGET /models, but any path below them fell through to the generic 404 handler ({"error":{"message":"not found"}}), preventing Visual Studio 2026 and other OpenAI spec-following clients from connecting.After this change,
serve/server.pyimplements the OpenAI-compatible model retrieve endpoint (GET /v1/models/{model_id}andGET /models/{model_id}). Querying an active model ID or alias returns its individual model object with HTTP 200, while nonexistent models return a standard OpenAI 404 with codemodel_not_found.Related discussion
Fixes #5460 (and follows #4100).
Approach
serve/server.py, extended the model route condition frompath in ("/v1/models", "/models")to also match paths starting with/v1/models/or/models/.GET /v1/modelsandGET /modelsremain byte-identical.unquote), matches it against loaded models, aliases, and image models, and returns the single model entry.{"error": {"message": "...", "type": "invalid_request_error", "param": "model", "code": "model_not_found"}}).Validation
Passed:
python3 -m unittest serve.test_server.ModelAliases -von revisiondd2a60c5(rebased onupstream/main146df3c4), Linux x86_64, Python 3.14. All 6 tests passed cleanly in 1.08s, including the two new test methodstest_model_retrieve_single_and_aliasandtest_model_retrieve_unknown_returns_404.curl -s http://127.0.0.1:8080/v1/models/qwen-> HTTP 200 with model JSON.curl -s http://127.0.0.1:8080/v1/models/non-existent-xyz-> HTTP 404 withmodel_not_founderror.Failed:
none observed.
Not run:
GPU hardware compilation checks (CUDA, HIP, SYCL) - not run because this change touches only Python HTTP routing in
serve/server.pyand has no C++ engine or kernel modifications.Limits
None. The endpoint reuses the server's existing model list inspection.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.