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.

Studio: keep Decision API models out of the chat model picker (#14580)

Nilay0ae76cc9f72b
diff --git a/studio/backend/hub/services/models/cache_inventory.py b/studio/backend/hub/services/models/cache_inventory.py
index ef6b71e00c8..455b3868534 100644
--- a/studio/backend/hub/services/models/cache_inventory.py
+++ b/studio/backend/hub/services/models/cache_inventory.py
@@ -51,6 +51,7 @@ from utils.hidden_models import (
is_audio_cpp_repo_id,
is_curated_stt_repo_id,
is_curated_tts_repo_id,
+ is_decision_api_model,
is_hidden_model,
)
@@ -502,7 +503,7 @@ def invalidate_hf_cache_scans() -> None:
def _is_hidden_infra_repo(*values: str | None) -> bool:
- """True for infra-only repos (the RAG embedder and the llama.cpp install validation probe) that are cached as a side effect of Unsloth itself and are not usable chat models."""
+ """True for infra-only repos (the RAG embedder, the llama.cpp install validation probe, Decision API models) that are cached as a side effect of Unsloth itself and are not usable chat models."""
return is_hidden_model(*values)
@@ -637,8 +638,13 @@ def _scan_cached_gguf(
str(snapshot_path) if snapshot_path is not None else None,
)
is_curated_stt = is_curated_stt_repo_id(repo_id) or is_audio_cpp_repo_id(repo_id)
- # Hide infra repos unless the user downloaded a variant: variant state only exists for user downloads, and curated STT repos are still emitted as management rows.
- if is_hidden_infra and not is_curated_stt and not has_variant_state:
+ # Hide infra repos unless the user downloaded a variant: variant state only exists for user downloads, and curated STT and Decision API repos are still emitted as management rows.
+ if (
+ is_hidden_infra
+ and not is_curated_stt
+ and not has_variant_state
+ and not is_decision_api_model(repo_id)
+ ):
continue
if total_size == 0 and not has_variant_state:
continue
@@ -1210,7 +1216,12 @@ def _scan_cached_models(
is_curated_stt = is_curated_stt_repo_id(repo_id) or is_audio_cpp_repo_id(repo_id)
snapshot_metadata = _cached_model_local_metadata(repo_path, snapshot_path)
is_whisper_stt = bool(snapshot_metadata.get("_hidden_stt"))
- if is_hidden_infra and not is_curated_stt and not is_whisper_stt:
+ if (
+ is_hidden_infra
+ and not is_curated_stt
+ and not is_whisper_stt
+ and not is_decision_api_model(repo_id)
+ ):
continue
has_main_gguf = _repo_has_gguf_files(repo_info)
payload = _repo_non_gguf_model_payload(repo_info)
diff --git a/studio/backend/routes/inference.py b/studio/backend/routes/inference.py
index 1ed7c02e4f7..944e0e8c055 100644
--- a/studio/backend/routes/inference.py
+++ b/studio/backend/routes/inference.py
@@ -94,6 +94,7 @@ from utils.first_token_timeout import (
start_first_token_wait,
timeout_seconds as configured_first_token_timeout_s,
)
+from utils.hidden_models import is_decision_api_model
from utils.upload_limits import STT_AUDIO_B64_MAX_CHARS, STT_AUDIO_RAW_MAX_BYTES
from hub.dependencies import get_hf_token, get_request_hf_token
from hub.utils.hf_errors import modelscope_missing
@@ -10650,12 +10651,19 @@ async def _maybe_auto_download_model(
unknown id like "gpt-4" still falls through to the resident model.
"""
from utils.openai_auto_switch_settings import get_openai_auto_download_enabled
- from core.inference.openai_auto_download import is_downloadable_ref, maybe_auto_download
+ from core.inference.openai_auto_download import (
+ is_downloadable_ref,
+ maybe_auto_download,
+ split_model_ref,
+ )
if not requested_model or not get_openai_auto_download_enabled():
return
if not is_downloadable_ref(requested_model):
return
+ # The resolver never serves a Decision API repo, so fetching one would only fill the disk.
+ if is_decision_api_model(split_model_ref(requested_model)[0]):
+ return
# An Ollama-style tag (":latest") names no quant, so the resolver misses a servable model.
if await asyncio.to_thread(_loaded_satisfies, requested_model):
return
@@ -18894,6 +18902,14 @@ async def load_model_gated(
return mid-load and hide a late failure in an unread body. This blocks until the
model is resident and raises the real exception.
"""
+ if is_decision_api_model(request.model_path):
+ raise HTTPException(
+ status_code = 400,
+ detail = (
+ "This is a Decision API model, not a chat model. "
+ "Use it from Settings > API > Decision API (POST /v1/systemone)."
+ ),
+ )
# A sidecar install that has reserved the swap must not lose to a load that
# then gets unloaded by the pre-swap teardown. Rechecked under the gate: an
# install can reserve while this request queues on the gate, so the pre-gate
diff --git a/studio/backend/routes/models.py b/studio/backend/routes/models.py
index bc0f5d45916..4738460068f 100644
--- a/studio/backend/routes/models.py
+++ b/studio/backend/routes/models.py
@@ -144,13 +144,14 @@ from utils.hidden_models import (
_HF_REPO_ID_RE,
_existing_resolved_path,
_safe_resolve,
+ decision_api_repo_ids,
is_hidden_model as _is_hidden_model,
)
def hidden_model_matchers() -> tuple[list[str], list[str], list[str]]:
- """Substring needles, exact repo ids, and exact resolved paths identifying infra models (the RAG embedder
- and the llama.cpp install validation probe) that pickers hide. A configured HF-repo embedder is
+ """Substring needles, exact repo ids, and exact resolved paths identifying infra models (the RAG embedder,
+ the llama.cpp install validation probe, and Decision API models) that pickers hide. A configured HF-repo embedder is
published as its exact lowercased repo id and a local-path embedder as its exact resolved path only: a
generic basename like "model" must not substring-hide unrelated chat models."""
from core.rag import config as rag_config
@@ -160,7 +161,7 @@ def hidden_model_matchers() -> tuple[list[str], list[str], list[str]]:
"ggml-org/models",
"stories260k.gguf",
]
- exact_ids: list[str] = []
+ exact_ids = sorted(decision_api_repo_ids())
exact_paths: list[str] = []
for model in (
rag_config.effective_embedding_model(),
diff --git a/studio/backend/tests/test_decision_models_not_chattable.py b/studio/backend/tests/test_decision_models_not_chattable.py
new file mode 100644
index 00000000000..878b61c8437
--- /dev/null
+++ b/studio/backend/tests/test_decision_models_not_chattable.py
@@ -0,0 +1,181 @@
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+from __future__ import annotations
+
+import asyncio
+import sys
+import types
+from types import SimpleNamespace
+
+import pytest
+from fastapi import HTTPException
+
+if "structlog" not in sys.modules:
+
+ class _DummyLogger:
+ def __getattr__(self, _name):
+ return lambda *args, **kwargs: None
+
+ sys.modules["structlog"] = types.SimpleNamespace(
+ BoundLogger = _DummyLogger,
+ get_logger = lambda *args, **kwargs: _DummyLogger(),
+ )
+
+import routes.inference as inference_route
+import routes.models as models_route
+from utils.hidden_models import is_hidden_model
+
+CLEF_GGUF = "ggml-org/Clef-Flash-GGUF"
+CLEF_SNAPSHOT_FILE = "/root/.cache/huggingface/hub/models--ggml-org--Clef-Flash-GGUF/snapshots/4a19/Clef-Flash-Q8_0.gguf"
+
+
+def _repo(repo_id, files, repo_path):
+ return SimpleNamespace(
+ repo_id = repo_id,
+ repo_type = "model",
+ repo_path = repo_path,
+ revisions = [SimpleNamespace(files = files)],
+ )
+
+
+def _file(name, size_on_disk):
+ return SimpleNamespace(file_name = name, size_on_disk = size_on_disk, blob_path = None)
+
+
+ "value",
+ [
+ CLEF_GGUF,
+ "ggml-org/clef-flash-gguf",
+ "ggml-org/Kev-0.8B-GGUF",
+ "Cloudflare/clef-flash",
+ "convaiinnovations/laya",
+ "jaredpalmer/kev-0.8b",
+ "openjev/openjev-MLX",
+ CLEF_SNAPSHOT_FILE,
+ ],
+)
+def test_decision_api_models_are_hidden_from_chat(value):
+ assert is_hidden_model(value) is True
+
+
+def test_chat_models_with_similar_names_stay_visible():
+ assert is_hidden_model("unsloth/Qwen3-0.6B-GGUF") is False
+ assert is_hidden_model("user/Clef-Flash-GGUF") is False
+ assert is_hidden_model("ggml-org/Clef-Flash-GGUF-finetune") is False
+ assert is_hidden_model("Qwen/Qwen3.5-0.8B-Base") is False
+
+
+def test_cached_gguf_list_drops_a_decision_api_download(monkeypatch, tmp_path):
+ clef = _repo(
+ CLEF_GGUF,
+ [_file("Clef-Flash-Q8_0.gguf", 9_000), _file("mmproj-Clef-Flash-Q8_0.gguf", 600)],
+ tmp_path / "models--ggml-org--Clef-Flash-GGUF",
+ )
+ chat = _repo(
+ "unsloth/Qwen3-0.6B-GGUF",
+ [_file("Qwen3-0.6B-Q4_K_M.gguf", 400)],
+ tmp_path / "models--unsloth--Qwen3-0.6B-GGUF",
+ )
+ monkeypatch.setattr(
+ models_route, "_all_hf_cache_scans", lambda: [SimpleNamespace(repos = [clef, chat])]
+ )
+
+ result = asyncio.run(models_route.list_cached_gguf(current_subject = "test-user"))
+
+ assert [row["repo_id"] for row in result["cached"]] == ["unsloth/Qwen3-0.6B-GGUF"]
+
+
+def test_the_chat_picker_hides_decision_api_repos_by_exact_id():
+ _needles, exact_ids, _paths = models_route.hidden_model_matchers()
+
+ assert "ggml-org/clef-flash-gguf" in exact_ids
+ assert "cloudflare/clef-flash" in exact_ids
+ assert "unsloth/qwen3-0.6b-gguf" not in exact_ids
+
+
+def _cache_repo(hub, repo_id, files):
+ repo = hub / f"models--{repo_id.replace('/', '--')}"
+ snapshot = repo / "snapshots" / "4a19"
+ snapshot.mkdir(parents = True)
+ (repo / "blobs").mkdir()
+ (repo / "refs").mkdir()
+ (repo / "refs" / "main").write_text("4a19")
+ for index, (name, data) in enumerate(files.items()):
+ blob = repo / "blobs" / f"blob{index}"
+ blob.write_bytes(data)
+ (snapshot / name).symlink_to(f"../../blobs/blob{index}")
+
+
+def test_model_hub_and_train_keep_decision_api_downloads_as_non_chat_rows(tmp_path):
+ from huggingface_hub import scan_cache_dir
+
+ from hub.services.models import cache_inventory
+
+ gguf = b"GGUF\x03\x00\x00\x00" + b"\x00" * 4096
+ config = b'{"model_type": "qwen3", "architectures": ["Qwen3ForCausalLM"]}'
+ weights = {"config.json": config, "model.safetensors": b"\x00" * 4096}
+ _cache_repo(tmp_path, CLEF_GGUF, {"Clef-Flash-Q8_0.gguf": gguf})
+ _cache_repo(tmp_path, "unsloth/Qwen3-0.6B-GGUF", {"Qwen3-0.6B-Q4_K_M.gguf": gguf})
+ _cache_repo(tmp_path, "Cloudflare/clef-flash", weights)
+ _cache_repo(tmp_path, "unsloth/Qwen3-0.6B", weights)
+ scans = [scan_cache_dir(tmp_path)]
+
+ rows = {
+ row["repo_id"]: row["capabilities"]
+ for scan in (cache_inventory._scan_cached_gguf, cache_inventory._scan_cached_models)
+ for row in scan(cache_scans = scans, active_hub_cache = tmp_path)
+ }
+
+ assert rows[CLEF_GGUF]["can_chat"] is False
+ assert rows["Cloudflare/clef-flash"]["can_chat"] is False
+ assert rows["Cloudflare/clef-flash"]["can_train"] is True
+ assert rows["unsloth/Qwen3-0.6B-GGUF"]["can_chat"] is True
+ assert rows["unsloth/Qwen3-0.6B"]["can_chat"] is True
+
+
+def _patch_load(monkeypatch):
+ from contextlib import asynccontextmanager
+
+ from core.inference import llama_keepwarm
+
+ @asynccontextmanager
+ async def _gate():
+ yield
+
+ loaded = []
+
+ async def _impl(request, *_args, **_kwargs):
+ loaded.append(request.model_path)
+ return {"status": "loaded"}
+
+ monkeypatch.setattr(inference_route, "_raise_if_sidecar_swap_in_progress", lambda: None)
+ monkeypatch.setattr(inference_route, "_pending_load_attempts", {})
+ monkeypatch.setattr(llama_keepwarm, "inference_lifecycle_gate", _gate)
+ monkeypatch.setattr(inference_route, "_run_tracked_load_model_impl", _impl)
+ return loaded
+
+
[email protected]("model_path", [CLEF_GGUF, "Cloudflare/clef-flash", CLEF_SNAPSHOT_FILE])
+def test_loading_a_decision_api_model_as_chat_is_refused(monkeypatch, model_path):
+ loaded = _patch_load(monkeypatch)
+ request = inference_route.LoadRequest(model_path = model_path, gguf_variant = "Q8_0")
+
+ with pytest.raises(HTTPException) as exc:
+ asyncio.run(inference_route.load_model_gated(request, object(), "test"))
+
+ assert exc.value.status_code == 400
+ assert "Decision API" in exc.value.detail
+ assert "/v1/systemone" in exc.value.detail
+ assert loaded == []
+
+
[email protected]("model_path", ["unsloth/Qwen3-0.6B-GGUF", f"{CLEF_GGUF}-finetune"])
+def test_a_chat_model_still_loads(monkeypatch, model_path):
+ loaded = _patch_load(monkeypatch)
+ request = inference_route.LoadRequest(model_path = model_path)
+
+ asyncio.run(inference_route.load_model_gated(request, object(), "test"))
+
+ assert loaded == [model_path]
diff --git a/studio/backend/tests/test_openai_auto_download.py b/studio/backend/tests/test_openai_auto_download.py
index 7a2e38ff257..62608fa98d8 100644
--- a/studio/backend/tests/test_openai_auto_download.py
+++ b/studio/backend/tests/test_openai_auto_download.py
@@ -784,6 +784,11 @@ def test_setting_off_does_nothing_at_all(hub):
assert hub["started"] == []
+def test_a_decision_api_repo_is_never_fetched_for_chat(hub):
+ assert _hook("ggml-org/OpenJev-GGUF:Q8_0", _Req(), enabled = True) is None
+ assert hub["started"] == []
+
+
def test_hook_raises_the_openai_envelope_with_retry_after(hub):
with pytest.raises(HTTPException) as excinfo:
_hook("unsloth/x-GGUF:UD-Q5_K_XL", _Req(), enabled = True)
diff --git a/studio/backend/utils/hidden_models.py b/studio/backend/utils/hidden_models.py
index 3869f2227f1..df68e4f7f39 100644
--- a/studio/backend/utils/hidden_models.py
+++ b/studio/backend/utils/hidden_models.py
@@ -76,6 +76,29 @@ def is_audio_cpp_repo_id(value: str | None) -> bool:
return bool(value and value.strip().lower() in _HIDDEN_AUDIO_CPP_REPO_IDS_LOWER)
+def decision_api_repo_ids() -> set[str]:
+ """Exact repos the Decision API serves. MLX adapter bases (Qwen3.5) are ordinary chat models and stay visible."""
+ from core.systemone.catalog import CHECKPOINTS, GGUF_COMPANIONS, MLX_COMPANIONS
+ return (
+ {c.source.lower() for c in CHECKPOINTS.values()}
+ | {c.repo.lower() for c in GGUF_COMPANIONS.values()}
+ | {c.repo.lower() for c in MLX_COMPANIONS.values()}
+ )
+
+
+def is_decision_api_model(*values: str | None) -> bool:
+ repo_ids = decision_api_repo_ids()
+ for value in values:
+ if not value:
+ continue
+ if _HF_REPO_ID_RE.match(value):
+ if value.lower() in repo_ids:
+ return True
+ elif _path_contains_repo_id(value, repo_ids):
+ return True
+ return False
+
+
def is_curated_stt_repo_id(value: str | None) -> bool:
"""True only for Unsloth's exact curated STT Hub repositories. Still hidden from chat, but task-scoped inventory consumers need the real cache rows so the Audio page need not reimplement size, format, variants and lifecycle."""
return bool(value and value.strip().lower() in _HIDDEN_STT_REPO_IDS_LOWER)
@@ -162,7 +185,7 @@ def _path_basename_is_default_embedder(value: str) -> bool:
def is_hidden_model(*values: str | None) -> bool:
- """True if any id/path is the RAG embedding model (the effective embedder or its GGUF companion repo), the llama.cpp install validation probe (ggml-org/models / stories260K), or a curated/custom Whisper dictation model, so pickers hide them (GGUF and non-GGUF). None are usable chat models, and the probe can be cached as a side effect of installing the prebuilt llama-server and otherwise sorts smallest, so it would be auto-selected.
+ """True if any id/path is the RAG embedding model (the effective embedder or its GGUF companion repo), the llama.cpp install validation probe (ggml-org/models / stories260K), a curated/custom Whisper dictation model, or a Decision API model, so pickers hide them (GGUF and non-GGUF). None are usable chat models, and the probe can be cached as a side effect of installing the prebuilt llama-server and otherwise sorts smallest, so it would be auto-selected.
Hub repo ids are matched EXACTLY (case-insensitive full "owner/name"), so a custom embedder with a generic basename like "org/model" cannot substring hide unrelated cached repos such as "user/model-chat" or "org/model-GGUF". Existing paths take precedence over the identical ``owner/name`` repo shape, cache and LM Studio paths use exact repo-derived segments, and local copies of the static default embedder also use a boundary-aware basename fallback, which configured custom repos never do.
"""
@@ -173,6 +196,7 @@ def is_hidden_model(*values: str | None) -> bool:
*(repo_id.lower() for repo_id in _DEFAULT_EMBEDDING_REPO_IDS),
*_HIDDEN_STT_REPO_IDS_LOWER,
*_HIDDEN_AUDIO_CPP_REPO_IDS_LOWER,
+ *decision_api_repo_ids(),
}
exact_paths: list[str] = []
for model in {
diff --git a/studio/frontend/src/features/hub/lib/hidden-models.ts b/studio/frontend/src/features/hub/lib/hidden-models.ts
index 3b7069f18b0..76311e60cbf 100644
--- a/studio/frontend/src/features/hub/lib/hidden-models.ts
+++ b/studio/frontend/src/features/hub/lib/hidden-models.ts
@@ -9,8 +9,8 @@ import { getInventoryVersion } from "../stores/inventory-events";
// dictation models, and the llama.cpp validation probe are not usable chat models. Server-confirmed
// cache rows are trusted because the backend applies variant-aware filtering. Optimistic cache rows
// still use these needles until the server confirms them. The dynamic matchers fetched from
-// `/api/hub/hidden-models` add the user's configured embedder as exact repo ids and exact resolved
-// paths, never substring needles. Per-repo views are not filtered, so reinstall flows still show
+// `/api/hub/hidden-models` add the user's configured embedder and the Decision API models as exact
+// repo ids and exact resolved paths, never substring needles. Per-repo views are not filtered, so reinstall flows still show
// downloaded files.
const HIDDEN_NEEDLES = [
"bge-small-en-v1.5", // RAG embedder: unsloth/bge-small-en-v1.5[-GGUF]