mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3500] [Engine] add GET /v1/models/{id} so Visual Studio can use Strata #4659
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#4659
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/3500
Author: @MajMcCloud
Created: 10/20/2026
Status: 🔄 Open
Base:
main← Head:main📝 Commits (10+)
95686caAdd single-model metadata endpoint00bb095Limit model detail endpoint to /v1/models/{id}2f773afMerge branch 'Niko1221:main' into mainc7f08efMerge branch 'Niko1221:main' into main0ecb98eMerge branch 'Niko1221:main' into mainbe98f1fMerge branch 'Niko1221:main' into maind30f50bMerge branch 'Niko1221:main' into maind20263cMerge branch 'main' into main6d897eaMerge branch 'Niko1221:main' into maine08e3d5Merge branch 'Niko1221:main' into main📊 Changes
3 files changed (+137 additions, -19 deletions)
View changed files
📝
docs/DETAILS.md(+42 -1)📝
serve/server.py(+52 -18)📝
serve/test_lifecycle.py(+43 -0)📄 Description
Problem and result
Some OpenAI clients check that one model exists before they use it. They do this by calling
GET /v1/models/{model id}. Visual Studio's model picker does this. Strata only had the list (GET /v1/models,GET /models), so that call got a 404, and the client treated the model as missing.GET /v1/models/<served id>→ 404.GET /v1/models/<served id>→ 200. The response is the same entry/v1/modelslists under that id, plus OpenAI'screated(when the server started) andowned_by("strata"). Strict SDKs check these two fields.code: "model_not_found".GET /v1/modelsandGET /modelsgive the same list as before.GET /models/{id}still answers 404, because llama.cpp's bare/modelshas never taken an id.Related discussion
This reopens Niko1221/Strata#2494, which was closed in the tracker reset for 0.2.0-beta. There is no separate issue. The change is a small addition to the API and does not change a default.
Approach
/v1/modelslist moved from the request handler intoService.model_view()without changes. The list and the new detail endpoint share it, so they cannot drift apart.Service.model_detail(id)picks one entry from that list and addscreatedandowned_by. If the list is empty (the engine is gone and nothing loads it on use), the id answers 404, the same as an unknown id./v1/models/{id}takes an id. The id is URL-decoded./v1/models/with a trailing slash is still the list.docs/DETAILS.md(endpoint table and the metadata paragraph) and the module docstring ofserve/server.py.Validation
Revision: the two commits of this PR applied on top of
upstream/maincbfd5b92(2026-10-20). They applied without conflicts. Environment: Windows, Python 3.14.7, jinja2 3.1.6, no GPU (the tests use the fake engine).Passed:
python -m unittest -v serve.test_lifecycle→Ran 13 tests … OK. This includes the 4 new tests:test_model_detail_endpoint_answers_for_every_id_it_serves: model id and alias give 200 with the same fields as the list, an unknown id gives 404,/v1/models/is still the list, and the engine is never started.test_bare_models_path_still_only_lists:/models/{id}gives 404 and/modelsstill lists.test_model_detail_endpoint_is_empty_while_the_engine_is_gone: 404 while nothing is served, 200 withloadedonce it is.test_model_detail_endpoint_needs_the_api_key_like_the_list: 401 without the key, 200 with it.python -m unittest serve.test_server→Ran 344 tests … OK (skipped=3)python -m unittest serve.test_security→Ran 28 tests … OKpython -m unittest serve.test_images→Ran 19 tests … OK(the image model in the list)Failed:
None observed.
Not run:
serve/server.py, its tests anddocs/DETAILS.md).tests/terminalandapps/hosttests: they do not touchserve/.Limits
createdis the server's start time, not the date of the model files. Strata has no better value for this.owned_byis always"strata"./models/{id}path. Nothing that is known to us asks for one there.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.