Repository navigation
Studio: Open WebUI llama.cpp residency and explicit load/unload (#10610) - #10693
Conversation
…othai#10610) Publish status.value alongside loaded so Open WebUI's llama.cpp provider does not treat nonresident catalog rows as loaded, and serve authenticated GET /models plus POST /models/load|/unload outside /v1. Co-authored-by: Cursor <[email protected]>
|
Confirmed main still denies /models, /models/load and /models/unload in studio/backend/routes/llama_compat.py, and that the catalog publishes no status field, so this is a real gap for Open WebUI's llama.cpp provider. Will get this reviewed. |
Thanks! @danielhanchen |
danielhanchen
left a comment
There was a problem hiding this comment.
Thanks @debojyoti-dev. I merged main (which had since added the llama-server passthrough routes and per-account isolation) and pushed e0f8292 on top of your commits:
/models/loadand/models/unloadnow call Studio's own/api/inference/loadand/api/inference/unloadhandlers, so they get the same GPU-busy 409s, managed-account checks and tunnel padding instead of a separate error path.- The model id must be in the caller's own
/v1/modelscatalog (an exact id or<id>:<quant>). For a load, the on-disk GGUF that auto-switch would pick is still preferred. - The served methods go through the existing served-route set that the passthrough routes use, so the separate denial table and the
is_engine_probe_pathspecial case are gone.POST/DELETE /models,GET /models/sseand the wrong methods on load/unload still return a JSON 404. - One
status.valuestamp is applied to every catalog row and to the single-model lookup. - The 506-line test module is now about 120 lines of tests in
test_llama_compat_routes.py. Against main'sllama_compat.pythey fail (9 failed), and on this branch they pass: 198 passed across the compat, catalog, path-leak and keyless suites.
I also checked this against the real Studio app with Open WebUI's actual get_provider_model_loaded_state. A nonresident row now reads as unloaded (it read as loaded without status), and GET /models is 401 without a credential. Download, delete and SSE are separate Open WebUI actions, so a 404 there only fails that one action.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…target, not the quant
…ins by the resolved quant
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Open WebUI's
llama.cppprovider needs two things from Studio. This PR serves both.GET /v1/modelsrow, including the quant-pin rows andGET /v1/models/{id}, now carriesstatus.value(loaded/unloaded) next toloaded. Open WebUI calls a row withoutstatusloaded, so a downloaded but nonresident model no longer shows as loaded./v1. Open WebUI strips/v1for these calls.GET /modelslists the chat rows of the caller's own/v1/models. Image, video and speech rows are left out because they load through their own engines.POST /models/loadwith{"model": "<id>"}loads a listed row. It uses the on-disk copy and saved launch settings that auto-switch would use, and the row keeps its listed id as the advertised id.POST /models/unloadwith{"model": "<id>"}stops the resident or in-flight load that the row names: by path, advertised alias, Ollama tag or quant. An idle row, an unrelated load, or another account's hidden resident is a no-op.load_model_gated/_unload_model_implwith Studio's GPU-busy 409 and tunnel padding. They answer{"success": true, "model": "<listed id>"}, never a host path.<id>:<quant>pin must be quant-shaped and on disk, otherwise the route returns 404. Unknown ids return 404 and no credential returns 401.GET /modelsis in the keyless inference grant likeGET /v1/models; load and unload stay credentialed.GET /models/ssestay JSON 404, as do the wrong methods on the new paths.Fixes #10610
Testing
studio/backend/tests/test_llama_compat_routes.py,test_openai_catalog.py,test_openai_models_path_leak.py,test_keyless_api_access_adversarial.py,test_warm_window_review_fixes.py: 316 passed. The management tests fail against main and against each earlier head they guard.MyLocalQwen) each load and unload through/models/loadand/models/unload;/v1/modelsflipsloadedandstatus.valuewith no duplicate rows;get_provider_model_loaded_state(pinned at0a7c158) reads a nonresident row as unloaded withstatus, and as loaded without it.