Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

fix(studio): accept trailing slash for model discovery (#9876)

Lee Jackson0a472c7c7595
diff --git a/studio/backend/routes/inference.py b/studio/backend/routes/inference.py
index 124b875e7e2..15c13cbc157 100644
--- a/studio/backend/routes/inference.py
+++ b/studio/backend/routes/inference.py
@@ -22396,6 +22396,12 @@ async def _openai_catalog_objects() -> list[dict]:
return list(by_id.values())
+# Some OpenAI-compatible clients (notably DEVONthink) probe ``/v1/models/``
+# literally and do not follow FastAPI's automatic slash redirect. Register the
+# slash form directly so model discovery reaches authentication and returns the
+# catalog in one response. Keep it out of the schema because it is only a wire
+# compatibility alias for the canonical OpenAI path.
[email protected]("/models/", include_in_schema = False)
@router.get("/models")
async def openai_list_models(current_subject: str = Depends(get_current_subject)):
"""
diff --git a/studio/backend/tests/test_openai_auto_switch.py b/studio/backend/tests/test_openai_auto_switch.py
index 5cbd06ae99a..aee220ffb40 100644
--- a/studio/backend/tests/test_openai_auto_switch.py
+++ b/studio/backend/tests/test_openai_auto_switch.py
@@ -460,6 +460,7 @@ def test_openai_compat_routes_bound_to_handlers_with_auth():
("POST", "/messages/count_tokens"): "anthropic_count_tokens",
("POST", "/audio/generate"): "generate_audio",
("GET", "/models"): "openai_list_models",
+ ("GET", "/models/"): "openai_list_models",
("GET", "/models/{model_id:path}"): "openai_retrieve_model",
}
seen = {}