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: surface every live provider model in the picker (#5684)

Daniel Han5c8c238e63ea
diff --git a/studio/backend/core/inference/external_provider.py b/studio/backend/core/inference/external_provider.py
index 22343fe5946..ce696a83d6b 100644
--- a/studio/backend/core/inference/external_provider.py
+++ b/studio/backend/core/inference/external_provider.py
@@ -398,6 +398,14 @@ def _split_pending_citation_tail(text: str) -> tuple[str, str]:
return text[:last_open], text[last_open:]
+# Families that accept `prompt_cache_retention: "24h"`. Everything else 400s
+# with "prompt_cache_retention is not supported on this model" and the turn
+# dies (openai/codex#39397), while an unmatched model just falls back to
+# in-memory caching -- so guess narrow.
+# https://developers.openai.com/api/docs/guides/prompt-caching
+_OPENAI_EXTENDED_CACHE_FAMILY = re.compile(r"^(?:gpt-5(?:\.\d+)?(?:[-.]|$)|gpt-4\.1$)")
+
+
class _AnthropicThinkingSpec(NamedTuple):
prefixes: tuple[str, ...]
kind: Literal["adaptive", "manual"]
@@ -5165,9 +5173,10 @@ class ExternalProviderClient:
break
input_items[insert_at:insert_at] = openai_replay_items
- # gpt-5.x / o3 / gpt-4.5 reject temperature/top_p (400 "Unsupported
- # parameter"); the openai allowlist scopes the picker to these families,
- # so never forward sampling knobs.
+ # Reasoning families reject temperature/top_p, and the UI hides both
+ # sliders for the rest (provider-capabilities.ts), so the only values
+ # arriving here are ChatCompletionRequest's 0.6/0.95 defaults, which
+ # would override OpenAI's own with a number the user never chose.
del temperature, top_p # accepted for API symmetry, not forwarded.
body: dict[str, Any] = {
@@ -5226,9 +5235,14 @@ class ExternalProviderClient:
}
# Opt into 24h prompt-cache retention (free, vs the default ~5-10 min).
- # Gated on the OpenAI cloud host because ollama / llama.cpp / "custom"
- # presets reach this path too and would 400 on the unknown field.
- if is_openai_cloud and enable_prompt_caching is not False:
+ # Gated on the cloud host because ollama / llama.cpp / "custom" presets
+ # reach this path and 400 on the unknown field, and on the model
+ # because most cloud families reject the value itself.
+ if (
+ is_openai_cloud
+ and enable_prompt_caching is not False
+ and _OPENAI_EXTENDED_CACHE_FAMILY.match(model.strip().lower())
+ ):
body["prompt_cache_retention"] = "24h"
# Server-side context compaction (OpenAI cloud only).
diff --git a/studio/backend/core/inference/providers.py b/studio/backend/core/inference/providers.py
index e8b514c025c..fac96539108 100644
--- a/studio/backend/core/inference/providers.py
+++ b/studio/backend/core/inference/providers.py
@@ -68,11 +68,43 @@ PROVIDER_REGISTRY: dict[str, dict[str, Any]] = {
"hosted_tools": ("web_search", "code_execution", "image_generation"),
"auth_header": "Authorization",
"auth_prefix": "Bearer ",
- # Scope the picker to the current generation. /v1/models returns many
- # historical snapshots, fine-tunes, and non-chat models we don't want.
- "model_id_allowlist": re.compile(r"^(gpt-5\.[3456]|gpt-4\.5|o3)(?:[-.]|$)"),
- # Hide dated snapshots and the retired plain gpt-5.3 id.
- "model_id_denylist": re.compile(r"^(gpt-5\.3)$|-\d{4}-\d{2}-\d{2}$"),
+ # Deny non-chat rather than allowlist chat families: the allowlist
+ # silently dropped every new family until someone widened it.
+ # The bar is not "chat model" but "servable on /v1/responses with
+ # stream: true", Studio's only OpenAI transport (`_stream_openai_
+ # responses`), so a family whose model page marks `v1/responses` Not
+ # supported is denied even though it chats fine over chat/completions.
+ # Feature words match mid-id because OpenAI qualifies every variant
+ # with them (`tts-1`, `gpt-4o-mini-tts`) and never uses them inside a
+ # chat id; bases stay ^-anchored so `gpt-7-davinci-edition` survives.
+ "model_id_denylist": re.compile(
+ r"(?:^|-)(?:embedding|tts|whisper|moderation|image|"
+ r"transcribe|translate|instruct|sora)\b"
+ # Chat Completions only, per developers.openai.com/api/docs/models/
+ # {gpt-audio, gpt-4o-search-preview, o1-mini, o1-preview}.
+ # `-search-api` is the standalone search endpoint.
+ r"|(?:^|-)(?:audio|realtime)\b"
+ r"|(?:^|-)search-(?:preview|api)\b"
+ # Needs a data source and a Studio turn sends no tools.
+ # https://developers.openai.com/api/docs/guides/deep-research
+ r"|(?:^|-)deep-research\b"
+ r"|^o1-(?:mini|preview)\b"
+ # Retired canonical id retained by /v1/models.
+ r"|^gpt-5\.3$"
+ # Legacy bases and the first-generation embedding / search line.
+ # `^(?:text|code)-` needs the hyphen, so `codex-mini-latest` stays.
+ r"|^(?:babbage|davinci|ada|curie)\b"
+ r"|^(?:text|code)-(?:embedding|moderation|search|similarity"
+ r"|davinci|curie|babbage|ada|cushman)\b"
+ r"|^dall-e\b"
+ r"|^computer-use\b"
+ # Fine-tunes carry the user's tenant in the id.
+ r"|^ft:"
+ # Snapshots hide behind the canonical id the listing also returns:
+ # modern `-YYYY-MM-DD` and legacy `-MMDD` (`gpt-4-1106-preview`).
+ r"|-\d{4}-\d{2}-\d{2}$"
+ r"|-\d{4}(?:-preview)?$"
+ ),
},
"anthropic": {
"display_name": "Anthropic",
@@ -85,12 +117,14 @@ PROVIDER_REGISTRY: dict[str, dict[str, Any]] = {
"claude-opus-4-7",
"claude-opus-4-6",
"claude-sonnet-4-6",
- "claude-opus-4-5",
- "claude-sonnet-4-5",
- "claude-haiku-4-5",
+ "claude-opus-4-5-20251101",
+ "claude-sonnet-4-5-20250929",
+ "claude-haiku-4-5-20251001",
],
- # Hide YYYYMMDD-suffixed snapshot ids (e.g. claude-3-5-sonnet-20241022).
- "model_id_denylist": re.compile(r"-\d{8}$"),
+ # No denylist: a `-YYYYMMDD` id IS the canonical name for the whole
+ # pre-4.6 generation, not a snapshot to hide, so the old `-\d{8}$`
+ # rule hid 6 of the 9 live models. `pruneProviderModelIds` in
+ # sync-external-providers.ts held a copy and had to go with it.
"supports_streaming": True,
"supports_vision": True,
"supports_tool_calling": False,
diff --git a/studio/backend/routes/providers.py b/studio/backend/routes/providers.py
index ce780dc1dda..815bb2abc61 100644
--- a/studio/backend/routes/providers.py
+++ b/studio/backend/routes/providers.py
@@ -822,18 +822,25 @@ async def list_provider_models(
try:
models = await client.list_models()
- # Registry model-id filters only apply to the native Gemini base. A
- # custom OAI-compatible proxy returns prefixed IDs the native allowlist
- # would strip, leaving the picker empty; match the host check here so the
- # model list and chat dispatch agree on what counts as "native".
+ # Registry model-id filters describe one vendor's own catalog, so they
+ # only apply on that vendor's host. A Gemini OAI-compat proxy returns
+ # prefixed ids the allowlist strips, and an Azure or self-hosted OpenAI
+ # base returns operator-chosen deployment names that can carry any word
+ # the denylist reads as non-chat (`gpt-5.5-image-analysis`). Either way
+ # the picker empties out for a connection that works.
+ _NATIVE_HOSTS = {
+ "gemini": ("generativelanguage.googleapis.com",),
+ "openai": ("api.openai.com",),
+ }
apply_registry_model_filters = True
- if payload.provider_type == "gemini":
+ native_hosts = _NATIVE_HOSTS.get(payload.provider_type)
+ if native_hosts is not None:
try:
from urllib.parse import urlparse as _urlparse
_host = (_urlparse(base_url).hostname or "").lower()
except Exception:
_host = ""
- apply_registry_model_filters = _host == "generativelanguage.googleapis.com"
+ apply_registry_model_filters = _host in native_hosts
if apply_registry_model_filters:
allow_prefixes = info.get("model_id_allow_prefixes")
diff --git a/studio/backend/tests/test_openai_responses_translation.py b/studio/backend/tests/test_openai_responses_translation.py
index dc45e0c0deb..f18257c2e90 100644
--- a/studio/backend/tests/test_openai_responses_translation.py
+++ b/studio/backend/tests/test_openai_responses_translation.py
@@ -62,6 +62,39 @@ def _responses_sse(events: list[dict]) -> bytes:
return ("\n".join(chunks) + "\n").encode("utf-8")
+def _capture_responses_body(monkeypatch, model: str) -> dict:
+ """The outbound /v1/responses body for one model, with the sampling
+ defaults ChatCompletionRequest fills in when the caller sets nothing."""
+ captured: dict = {}
+
+ def handler(request: httpx.Request) -> httpx.Response:
+ captured["body"] = json.loads(request.content.decode("utf-8"))
+ return httpx.Response(
+ 200,
+ content = _responses_sse([{"type": "response.completed", "response": {}}]),
+ headers = {"content-type": "text/event-stream"},
+ )
+
+ _mock_http_client(monkeypatch, handler)
+
+ async def run():
+ client = _make_client()
+ async for _ in client._stream_openai_responses(
+ messages = [{"role": "user", "content": "Hi"}],
+ model = model,
+ temperature = 0.6,
+ top_p = 0.95,
+ max_tokens = 32,
+ enable_thinking = None,
+ reasoning_effort = None,
+ ):
+ pass
+ await client.close()
+
+ _drive(run())
+ return captured["body"]
+
+
def test_responses_request_body_uses_input_and_instructions(monkeypatch):
captured: dict = {}
@@ -102,8 +135,7 @@ def test_responses_request_body_uses_input_and_instructions(monkeypatch):
assert body["input"] == [{"role": "user", "content": "Hi"}]
assert body["max_output_tokens"] == 512
assert body["stream"] is True
- # Responses API on reasoning-class models (gpt-5.x / o3 / gpt-4.5 — the only
- # OpenAI ids the registry allowlist exposes) rejects these as `Unsupported
+ # Responses API on reasoning-class models rejects these as `Unsupported
# parameter`. Never silently forward them.
assert "temperature" not in body
assert "top_p" not in body
@@ -113,6 +145,54 @@ def test_responses_request_body_uses_input_and_instructions(monkeypatch):
assert "messages" not in body
+def test_responses_never_forwards_sampling_for_any_openai_family(monkeypatch):
+ # ChatCompletionRequest defaults these to 0.6 / 0.95 and the UI hides both
+ # sliders for OpenAI, so anything forwarded is a value the user never
+ # chose -- and reasoning ids no prefix catches, like codex-mini-latest,
+ # reject them outright.
+ for model in (
+ "gpt-5.6-sol",
+ "gpt-5.5",
+ "gpt-5",
+ "gpt-4.5-preview",
+ "gpt-4o",
+ "gpt-4.1",
+ "gpt-3.5-turbo",
+ "o1",
+ "o3-mini",
+ "o4-mini",
+ "codex-mini-latest",
+ "chatgpt-4o-latest",
+ ):
+ body = _capture_responses_body(monkeypatch, model)
+ assert "temperature" not in body, (model, body)
+ assert "top_p" not in body, (model, body)
+
+
+def test_responses_sends_extended_cache_retention_only_where_supported(monkeypatch):
+ # Documented for the gpt-5 line and gpt-4.1 only; every other model 400s
+ # the turn with "prompt_cache_retention is not supported on this model".
+ for model in ("gpt-5", "gpt-5.1", "gpt-5.4-mini", "gpt-5.6-sol", "gpt-4.1"):
+ body = _capture_responses_body(monkeypatch, model)
+ assert body.get("prompt_cache_retention") == "24h", (model, body)
+
+ for model in (
+ "gpt-4o",
+ "gpt-4o-mini",
+ "gpt-4.1-mini",
+ "gpt-4",
+ "gpt-3.5-turbo",
+ "o1",
+ "o3",
+ "o3-mini",
+ "o4-mini",
+ "chatgpt-4o-latest",
+ "codex-mini-latest",
+ ):
+ body = _capture_responses_body(monkeypatch, model)
+ assert "prompt_cache_retention" not in body, (model, body)
+
+
def test_responses_failed_without_details_has_actionable_fallback(monkeypatch):
def handler(request: httpx.Request) -> httpx.Response:
return httpx.Response(
diff --git a/studio/backend/tests/test_provider_model_allowlist.py b/studio/backend/tests/test_provider_model_allowlist.py
index 03f2f055f5b..309343ef836 100644
--- a/studio/backend/tests/test_provider_model_allowlist.py
+++ b/studio/backend/tests/test_provider_model_allowlist.py
@@ -32,11 +32,12 @@ def test_current_generation_model_ids_reach_the_picker():
}
for provider, model_ids in live.items():
registry = PROVIDER_REGISTRY[provider]
- allow = registry["model_id_allowlist"]
+ allow = registry.get("model_id_allowlist")
deny = registry.get("model_id_denylist")
deny_exact = registry.get("model_id_deny_exact") or ()
for model_id in model_ids:
- assert allow.match(model_id), f"{provider}: {model_id} not allowlisted"
+ if allow is not None:
+ assert allow.match(model_id), f"{provider}: {model_id} not allowlisted"
assert not (deny and deny.search(model_id)), f"{provider}: {model_id} denylisted"
assert model_id not in deny_exact, f"{provider}: {model_id} denied exactly"
diff --git a/studio/backend/tests/test_provider_model_filter_scope.py b/studio/backend/tests/test_provider_model_filter_scope.py
new file mode 100644
index 00000000000..2cf0a514859
--- /dev/null
+++ b/studio/backend/tests/test_provider_model_filter_scope.py
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+"""The registry model-id filters describe one vendor's own catalog.
+
+``PROVIDER_REGISTRY["openai"]["model_id_denylist"]`` encodes facts about
+OpenAI's published models: which ids are embeddings or TTS, which are not on
+``/v1/responses``. None of that holds for an Azure deployment or a self-hosted
+OpenAI-compatible server, whose ids are names the operator chose. Applying the
+denylist there empties the picker for a connection that works. Gemini already
+scopes its allowlist to the native host; these pin the same rule for OpenAI.
+"""
+
+import asyncio
+
+from models.providers import ProviderModelsRequest
+from routes import providers as providers_route
+
+
+def _list_models(monkeypatch, base_url: str, ids: list[str]) -> list[str]:
+ class _FakeClient:
+ def __init__(self, **_kwargs):
+ pass
+
+ async def list_models(self):
+ return [{"id": model_id} for model_id in ids]
+
+ async def close(self):
+ return None
+
+ monkeypatch.setattr(providers_route, "ExternalProviderClient", _FakeClient)
+ monkeypatch.setattr(
+ providers_route, "resolve_provider_api_key_or_400", lambda *a, **k: "sk-test"
+ )
+ payload = ProviderModelsRequest(provider_type = "openai", base_url = base_url)
+ result = asyncio.new_event_loop().run_until_complete(
+ providers_route.list_provider_models(payload, "tester", False)
+ )
+ return [m.id for m in result]
+
+
+LIVE = [
+ "gpt-5.5",
+ # Deployment / local names that read as non-chat to the OpenAI denylist.
+ "gpt-5.5-image-analysis",
+ "gpt-4o-audio-summariser",
+ "internal-search-preview",
+ "qwen3-instruct",
+]
+
+
+def test_the_openai_denylist_only_applies_to_the_openai_host(monkeypatch):
+ assert _list_models(monkeypatch, "https://my-resource.openai.azure.com/openai/v1", LIVE) == LIVE
+ assert _list_models(monkeypatch, "http://127.0.0.1:11434/v1", LIVE) == LIVE
+
+
+def test_the_openai_denylist_still_applies_on_api_openai_com(monkeypatch):
+ kept = _list_models(monkeypatch, "https://api.openai.com/v1", LIVE)
+ assert kept == ["gpt-5.5"], kept
+ dropped = _list_models(
+ monkeypatch,
+ "https://api.openai.com/v1",
+ ["text-embedding-3-small", "gpt-audio", "o3-deep-research", "tts-1"],
+ )
+ assert dropped == [], dropped
diff --git a/studio/backend/tests/test_provider_registry_filters.py b/studio/backend/tests/test_provider_registry_filters.py
new file mode 100644
index 00000000000..a554ddfe1a6
--- /dev/null
+++ b/studio/backend/tests/test_provider_registry_filters.py
@@ -0,0 +1,287 @@
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+"""Provider registry model-id filter regression tests.
+
+The OpenAI ``model_id_allowlist`` previously hardcoded the gpt-5.3/4/5
+families plus gpt-4.5 / o3 -- silently dropping every future family
+OpenAI shipped. Anthropic's ``model_id_denylist`` previously stripped
+every dated id, hiding the canonical names of every pre-4.6 model
+(Opus 4.5, Sonnet 4.5, Haiku 4.5, Opus 4.1, the 4.0 family).
+
+These tests pin the new denylist (OpenAI) and the empty denylist
+(Anthropic) by walking realistic ``/v1/models`` listings through
+``PROVIDER_REGISTRY`` and asserting the surviving set. The OpenAI bar is
+"servable on /v1/responses with stream: true", not merely "chat model" --
+Studio has no other OpenAI transport.
+"""
+
+from core.inference.providers import PROVIDER_REGISTRY
+
+
+def _apply(provider_type: str, candidate_ids: list[str]) -> list[str]:
+ """Mirror the filter logic in ``routes/providers.list_models``."""
+ info = PROVIDER_REGISTRY[provider_type]
+ out = list(candidate_ids)
+ allow = info.get("model_id_allowlist")
+ if allow is not None:
+ out = [m for m in out if allow.match(m)]
+ deny = info.get("model_id_denylist")
+ if deny is not None:
+ out = [m for m in out if not deny.search(m)]
+ return out
+
+
+# ── OpenAI: denylist drops what /v1/responses cannot serve ─────────
+
+
+def test_openai_keeps_every_known_chat_family():
+ live = [
+ # Current generation (must survive).
+ "gpt-5.5",
+ "gpt-5.5-pro",
+ "gpt-5.4",
+ "gpt-5.4-pro",
+ "gpt-5.4-mini",
+ "gpt-5.4-nano",
+ "gpt-5.3-codex",
+ "gpt-5.3-chat-latest",
+ "o3",
+ "o3-pro",
+ "o3-mini",
+ # Hypothetical future families that the old allowlist would have
+ # silently dropped -- they MUST surface under the new denylist.
+ "gpt-5.6",
+ "gpt-5.6-mini",
+ "gpt-6",
+ "gpt-6-pro",
+ "o4",
+ "o4-pro",
+ "o5",
+ ]
+ surviving = _apply("openai", live)
+ assert surviving == live, surviving
+
+
+def test_openai_drops_families_that_are_not_on_the_responses_endpoint():
+ # Studio serves every OpenAI turn from /v1/responses, so a model whose
+ # page marks that endpoint Not supported is unusable however
+ # chat-capable it is over /v1/chat/completions.
+ dropped = _apply(
+ "openai",
+ [
+ "gpt-audio",
+ "gpt-audio-1.5",
+ "gpt-audio-mini",
+ "gpt-4o-audio-preview",
+ "gpt-4o-mini-audio-preview",
+ "gpt-realtime",
+ "gpt-realtime-mini",
+ "gpt-realtime-1.5",
+ "gpt-4o-realtime-preview",
+ "gpt-4o-mini-realtime-preview",
+ "gpt-4o-search-preview",
+ "gpt-4o-mini-search-preview",
+ "o1-mini",
+ "o1-preview",
+ "gpt-4o-transcribe",
+ "gpt-4o-mini-transcribe",
+ ],
+ )
+ assert dropped == [], dropped
+
+
+def test_openai_drops_deep_research_models():
+ # Deep research rejects a request with no data source; a default Studio
+ # turn sends no tools.
+ dropped = _apply(
+ "openai",
+ ["o3-deep-research", "o4-mini-deep-research", "gpt-6-deep-research"],
+ )
+ assert dropped == [], dropped
+
+
+def test_openai_drops_non_chat_ids():
+ noise = [
+ # Embeddings / TTS / image / moderation / whisper / etc.
+ "text-embedding-3-small",
+ "text-embedding-3-large",
+ "text-embedding-ada-002",
+ "text-moderation-latest",
+ "text-moderation-stable",
+ "tts-1",
+ "tts-1-hd",
+ "gpt-4o-tts",
+ "whisper-1",
+ "dall-e-2",
+ "dall-e-3",
+ "gpt-image-1",
+ "gpt-image-2",
+ "gpt-image-1-mini",
+ "chatgpt-image-latest",
+ "gpt-4o-transcribe",
+ "gpt-4o-mini-transcribe",
+ "gpt-4o-mini-tts",
+ "omni-moderation-latest",
+ # Standalone search API endpoint.
+ "gpt-5-search-api",
+ "gpt-5-search-api-2025-10-14",
+ # Video generation.
+ "sora-2",
+ "sora-2-pro",
+ # Computer-use is an agentic harness, not a chat id.
+ "computer-use-preview",
+ # Legacy bases and the first-generation embedding / search /
+ # similarity line.
+ "babbage-002",
+ "davinci-002",
+ "text-davinci-003",
+ "text-curie-001",
+ "text-ada-001",
+ "text-similarity-ada-001",
+ "text-search-ada-doc-001",
+ "text-search-curie-query-001",
+ "code-search-ada-code-001",
+ "code-davinci-002",
+ "code-cushman-001",
+ # Fine-tunes.
+ "ft:gpt-4o-mini:acme:abc:xyz",
+ # Dated snapshots are still hidden.
+ "gpt-4o-2024-08-06",
+ "gpt-4o-mini-2024-07-18",
+ "gpt-5.5-2026-04-23",
+ ]
+ surviving = _apply("openai", noise)
+ assert surviving == [], surviving
+
+
+def test_openai_realtime_translate_variants_are_dropped():
+ dropped = _apply(
+ "openai",
+ [
+ "gpt-realtime-translate",
+ "gpt-realtime-translate-mini",
+ "gpt-audio-translate",
+ "gpt-4o-realtime-translate-preview",
+ ],
+ )
+ assert dropped == [], dropped
+
+
+def test_openai_legacy_instruct_completion_ids_are_dropped():
+ """Legacy `*-instruct` completion-only ids (gpt-3.5-turbo-instruct
+ and friends) speak /v1/completions, not chat/responses. Our OpenAI
+ bridge only knows the chat/responses transport, so admitting them
+ into the picker would 4xx every selection."""
+ dropped = _apply(
+ "openai",
+ [
+ "gpt-3.5-turbo-instruct",
+ "gpt-3.5-turbo-instruct-0914",
+ "davinci-002-instruct",
+ ],
+ )
+ assert dropped == [], dropped
+
+
+def test_openai_legacy_compact_snapshot_suffixes_are_dropped():
+ """Legacy `-MMDD` snapshot suffixes (gpt-3.5-turbo-0125,
+ gpt-4-0613, gpt-4-1106-preview, etc.) hide behind the canonical
+ id which the listing also returns; surface only the canonical so
+ users do not pick a deprecated snapshot by accident. The
+ `-\\d{4}(?:-preview)?$` rule must not catch canonical ids whose
+ minor version happens to be a year-like number (e.g. gpt-4.5,
+ o3) -- those are tested as KEEP below."""
+ dropped = _apply(
+ "openai",
+ [
+ "gpt-3.5-turbo-0125",
+ "gpt-3.5-turbo-0301",
+ "gpt-3.5-turbo-16k-0613",
+ "gpt-4-0613",
+ "gpt-4-0314",
+ "gpt-4-32k-0613",
+ "gpt-4-1106-preview",
+ "gpt-4-0125-preview",
+ ],
+ )
+ assert dropped == [], dropped
+
+ # Canonical chat ids that share a digit-heavy tail must survive.
+ kept = _apply(
+ "openai",
+ [
+ "gpt-3.5-turbo",
+ "gpt-4o",
+ "gpt-4.5",
+ "gpt-5.5",
+ "gpt-5.5-mini",
+ "gpt-5.5-pro",
+ "o3",
+ ],
+ )
+ assert set(kept) >= {
+ "gpt-3.5-turbo",
+ "gpt-4o",
+ "gpt-4.5",
+ "gpt-5.5",
+ "gpt-5.5-mini",
+ "gpt-5.5-pro",
+ "o3",
+ }, kept
+
+
+def test_openai_legacy_completion_names_only_match_at_id_start():
+ # Hypothetical future chat ids that happen to contain a legacy
+ # completion-family name mid-string must NOT be dropped. The
+ # `^(?:babbage|davinci|ada|curie)\b` anchor is what makes this safe.
+ kept = _apply(
+ "openai",
+ [
+ "gpt-7-davinci-edition",
+ "gpt-7-ada-chat",
+ "gpt-7-curie-pro",
+ "gpt-7-babbage-mini",
+ # `^(?:text|code)-` needs the hyphen, so the codex family stays.
+ "codex-mini-latest",
+ ],
+ )
+ assert kept == [
+ "gpt-7-davinci-edition",
+ "gpt-7-ada-chat",
+ "gpt-7-curie-pro",
+ "gpt-7-babbage-mini",
+ "codex-mini-latest",
+ ], kept
+ # ...but the actual legacy-base ids stay dropped.
+ dropped = _apply(
+ "openai",
+ ["babbage-002", "davinci-002", "text-davinci-003"],
+ )
+ assert dropped == [], dropped
+
+
+# ── Anthropic: empty denylist; dated ids ARE canonical ───────────────
+
+
+def test_anthropic_surfaces_every_live_model_including_dated_ids():
+ # The full set of ids /v1/models returns today.
+ live = [
+ "claude-opus-4-7",
+ "claude-sonnet-4-6",
+ "claude-opus-4-6",
+ "claude-opus-4-5-20251101",
+ "claude-sonnet-4-5-20250929",
+ "claude-haiku-4-5-20251001",
+ "claude-opus-4-1-20250805",
+ "claude-opus-4-20250514",
+ "claude-sonnet-4-20250514",
+ ]
+ surviving = _apply("anthropic", live)
+ assert surviving == live, surviving
+
+
+def test_anthropic_default_models_match_filter():
+ info = PROVIDER_REGISTRY["anthropic"]
+ surviving = _apply("anthropic", list(info["default_models"]))
+ assert surviving == list(info["default_models"]), surviving
diff --git a/studio/frontend/src/features/chat/provider-capabilities.ts b/studio/frontend/src/features/chat/provider-capabilities.ts
index 86574b971f3..b49c310857d 100644
--- a/studio/frontend/src/features/chat/provider-capabilities.ts
+++ b/studio/frontend/src/features/chat/provider-capabilities.ts
@@ -90,14 +90,41 @@ const EXTERNAL_MAX_OUTPUT_TOKENS_BY_MODEL: Array<{
prefixes: readonly string[];
cap: number;
}> = [
- // OpenAI
+ // OpenAI. The Responses API rejects an over-limit max_output_tokens rather
+ // than clamping it, so an overstated cap is a failed request and an
+ // understated one only a shorter answer. First match wins: a bare family
+ // prefix (`gpt-5`, `gpt-4`) goes last or it swallows its own minors, and the
+ // `-chat-latest` aliases go first because they cap at 16,384 whatever their
+ // family does.
{
providerType: "openai",
- prefixes: ["gpt-5.6", "gpt-5.5-pro", "gpt-5.5"],
+ prefixes: [
+ "gpt-5.3-chat-latest",
+ "gpt-5.2-chat-latest",
+ "gpt-5.1-chat-latest",
+ "gpt-5-chat-latest",
+ ],
+ cap: 16384,
+ },
+ {
+ providerType: "openai",
+ prefixes: ["gpt-5.6", "gpt-5.5-pro", "gpt-5.5", "gpt-5.2", "gpt-5.1"],
cap: 128000,
},
{ providerType: "openai", prefixes: ["gpt-5.4-pro", "gpt-5.4"], cap: 65536 },
{ providerType: "openai", prefixes: ["gpt-5.3"], cap: 16384 },
+ { providerType: "openai", prefixes: ["gpt-5"], cap: 128000 },
+ { providerType: "openai", prefixes: ["gpt-4.1"], cap: 32768 },
+ { providerType: "openai", prefixes: ["gpt-4.5"], cap: 16384 },
+ // `chatgpt-4o-latest` shares the gpt-4o cap but not its prefix.
+ { providerType: "openai", prefixes: ["gpt-4o", "chatgpt-4o"], cap: 16384 },
+ // Under the 8,192 default, so these two fail on an untouched config.
+ {
+ providerType: "openai",
+ prefixes: ["gpt-3.5-turbo", "gpt-4-turbo"],
+ cap: 4096,
+ },
+ { providerType: "openai", prefixes: ["gpt-4"], cap: 8192 },
// Anthropic
{
providerType: "anthropic",
@@ -119,9 +146,17 @@ const EXTERNAL_MAX_OUTPUT_TOKENS_BY_MODEL: Array<{
"claude-opus-4-5",
"claude-sonnet-4-5",
"claude-haiku-4-5",
+ // Dated 4.0 id, surfaced now the `-YYYYMMDD` filters are gone.
+ "claude-sonnet-4-20250514",
],
cap: 64000,
},
+ // Below the 32,768 fallback, so a raised Max Tokens would overshoot.
+ {
+ providerType: "anthropic",
+ prefixes: ["claude-opus-4-1", "claude-opus-4-20250514"],
+ cap: 32000,
+ },
// Gemini
{
providerType: "gemini",
@@ -778,17 +813,43 @@ const OPENAI_REASONING_MODELS = [
levels: ["none", "low", "medium", "high", "xhigh"],
},
{
- prefixes: ["gpt-5.3-chat-latest"],
- supportsOff: false,
- levels: ["medium"],
+ prefixes: ["gpt-5.3-codex"],
+ supportsOff: true,
+ levels: ["none", "low", "medium", "high", "xhigh"],
},
+ // 5.1 replaced "minimal" with "none" and 400s on the former; 5.2 adds
+ // xhigh. Both sit ahead of bare `gpt-5`, which keeps the old ladder.
{
- prefixes: ["gpt-5.3-codex"],
+ prefixes: ["gpt-5.2"],
supportsOff: true,
levels: ["none", "low", "medium", "high", "xhigh"],
},
+ // 5.1 Codex keeps reasoning mandatory: `none` 400s (openai/codex#6647).
+ // `xhigh` arrived with codex-max, which sorts first or the plain codex
+ // prefix swallows it.
+ {
+ prefixes: ["gpt-5.1-codex-max"],
+ supportsOff: false,
+ levels: ["low", "medium", "high", "xhigh"],
+ },
{
- prefixes: ["gpt-5", "gpt-5.1", "gpt-5.2"],
+ prefixes: ["gpt-5.1-codex"],
+ supportsOff: false,
+ levels: ["low", "medium", "high"],
+ },
+ {
+ prefixes: ["gpt-5.1"],
+ supportsOff: true,
+ levels: ["none", "low", "medium", "high"],
+ },
+ // The Codex tuning drops the lowest tier without gaining "none".
+ {
+ prefixes: ["gpt-5-codex"],
+ supportsOff: false,
+ levels: ["low", "medium", "high"],
+ },
+ {
+ prefixes: ["gpt-5"],
supportsOff: false,
levels: ["minimal", "low", "medium", "high"],
},
@@ -799,8 +860,16 @@ const OPENAI_REASONING_MODELS = [
},
] as const;
+/** The ChatGPT-tuned aliases (`gpt-5.1-chat-latest`, Azure's `gpt-5-chat`).
+ * They are non-reasoning, so `reasoning.effort` fails the whole turn with
+ * "Unsupported parameter: 'reasoning.effort' is not supported with this model".
+ * Matched by suffix rather than enumerated because the prefix table below keys
+ * on family, and a family prefix silently swallows its own `-chat` variant. */
+const OPENAI_NON_REASONING_CHAT_ALIAS = /-chat(?:-latest)?$/;
+
function resolveOpenAIReasoningEffortCapabilities(modelId: string): ReasoningCaps {
const normalized = modelId.trim().toLowerCase();
+ if (OPENAI_NON_REASONING_CHAT_ALIAS.test(normalized)) return NO_REASONING_CAPS;
const matched = OPENAI_REASONING_MODELS.find((entry) =>
matchesModelPrefix(normalized, entry.prefixes),
);
diff --git a/studio/frontend/src/features/chat/sync-external-providers.ts b/studio/frontend/src/features/chat/sync-external-providers.ts
index d14e22e3246..28d17c81ee3 100644
--- a/studio/frontend/src/features/chat/sync-external-providers.ts
+++ b/studio/frontend/src/features/chat/sync-external-providers.ts
@@ -33,7 +33,6 @@ import {
supportsProviderReasoningToggle,
} from "./external-providers";
-const ANTHROPIC_DATED_SNAPSHOT_SUFFIX = /-\d{8}$/;
const OPENAI_DEPRECATED_MODELS = new Set(["gpt-5.3"]);
// Rejected for every ChatGPT account, so drop it from selections saved earlier.
const OPENAI_CODEX_UNSUPPORTED_MODELS = new Set(["gpt-5.3-codex-spark"]);
@@ -117,9 +116,10 @@ export function pruneProviderModelIds(
providerType: string,
modelIds: string[],
): string[] {
- if (providerType === "anthropic") {
- return modelIds.filter((id) => !ANTHROPIC_DATED_SNAPSHOT_SUFFIX.test(id));
- }
+ // Anthropic has no entry: a `-YYYYMMDD` id is the canonical name for the
+ // whole pre-4.6 generation, not a snapshot. This mirrored the backend
+ // denylist and outlived it, stripping those ids from the server catalog,
+ // the seeds and saved selections alike.
if (providerType === "openai") {
return modelIds.filter((id) => !OPENAI_DEPRECATED_MODELS.has(id));
}
diff --git a/studio/frontend/tests/anthropic-dated-model-ids-reach-the-picker.test.ts b/studio/frontend/tests/anthropic-dated-model-ids-reach-the-picker.test.ts
new file mode 100644
index 00000000000..9078873e9c1
--- /dev/null
+++ b/studio/frontend/tests/anthropic-dated-model-ids-reach-the-picker.test.ts
@@ -0,0 +1,57 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import assert from "node:assert/strict";
+import { after, before, test } from "node:test";
+import { createServer, type ViteDevServer } from "vite";
+
+type Prune = (providerType: string, modelIds: string[]) => string[];
+
+let vite: ViteDevServer;
+let pruneProviderModelIds: Prune;
+
+// The dated id is what `/v1/models` returns for the pre-4.6 generation, and
+// the editor matches a saved selection against that catalog. The undated
+// aliases the API also accepts are not in the listing, so a seed using one
+// gets demoted to a manual entry the first time the catalog loads.
+const DATED = [
+ "claude-opus-4-5-20251101",
+ "claude-sonnet-4-5-20250929",
+ "claude-haiku-4-5-20251001",
+ "claude-opus-4-1-20250805",
+ "claude-opus-4-20250514",
+ "claude-sonnet-4-20250514",
+];
+const UNDATED = ["claude-opus-5", "claude-opus-4-8", "claude-sonnet-4-6"];
+
+before(async () => {
+ vite = await createServer({ appType: "custom", server: { middlewareMode: true } });
+ const loaded = await vite.ssrLoadModule("/src/features/chat/sync-external-providers.ts");
+ pruneProviderModelIds = loaded.pruneProviderModelIds as Prune;
+});
+
+after(async () => {
+ await vite.close();
+});
+
+test("the frontend prune keeps every dated Anthropic id", () => {
+ // This mirrored the backend `-\d{8}$` denylist, so dropping only the backend
+ // half left the picker unchanged, and worse: the registry's Anthropic seeds
+ // are dated now, so those were pruned too.
+ const live = [...UNDATED, ...DATED];
+ assert.deepEqual(pruneProviderModelIds("anthropic", live), live);
+});
+
+test("the other providers keep their own prunes", () => {
+ assert.deepEqual(pruneProviderModelIds("openai", ["gpt-5.4", "gpt-5.3"]), [
+ "gpt-5.4",
+ ]);
+ assert.deepEqual(
+ pruneProviderModelIds("openai_codex", ["gpt-5.4", "gpt-5.3-codex-spark"]),
+ ["gpt-5.4"],
+ );
+ assert.deepEqual(
+ pruneProviderModelIds("openrouter", ["openai/gpt-4o", "openai/whisper-1"]),
+ ["openai/gpt-4o"],
+ );
+});
diff --git a/studio/frontend/tests/provider-capabilities-current-models.test.ts b/studio/frontend/tests/provider-capabilities-current-models.test.ts
index 3f03142b496..deccfe09f63 100644
--- a/studio/frontend/tests/provider-capabilities-current-models.test.ts
+++ b/studio/frontend/tests/provider-capabilities-current-models.test.ts
@@ -76,6 +76,73 @@ test("the gpt-5.6 family gets the gpt-5.5 reasoning ladder", () => {
}
});
+test("the gpt-5.1 and gpt-5.2 ladders drop minimal for none", () => {
+ // "minimal" was replaced by "none" from 5.1 on, and offering it fails the
+ // turn with "does not support 'minimal' with this model".
+ const ladders: Array<[string, readonly string[]]> = [
+ ["gpt-5.2", ["none", "low", "medium", "high", "xhigh"]],
+ ["gpt-5.1", ["none", "low", "medium", "high"]],
+ ];
+ for (const [model, levels] of ladders) {
+ const caps = getExternalReasoningCapabilities("openai", model);
+ assert.equal(caps.supportsReasoningOff, true, model);
+ assert.deepEqual([...caps.reasoningEffortLevels], levels, model);
+ }
+ // The Codex tunings keep reasoning mandatory: no minimal, and no none on
+ // the 5.1 line. Only codex-max has xhigh, so it sorts first.
+ const codexLadders: Array<[string, readonly string[]]> = [
+ ["gpt-5-codex", ["low", "medium", "high"]],
+ ["gpt-5.1-codex", ["low", "medium", "high"]],
+ ["gpt-5.1-codex-mini", ["low", "medium", "high"]],
+ ["gpt-5.1-codex-max", ["low", "medium", "high", "xhigh"]],
+ ];
+ for (const [model, levels] of codexLadders) {
+ const caps = getExternalReasoningCapabilities("openai", model);
+ assert.equal(caps.supportsReasoningOff, false, model);
+ assert.deepEqual([...caps.reasoningEffortLevels], levels, model);
+ }
+ // Bare gpt-5 keeps the old ladder, so the splits must not swallow it.
+ const five = getExternalReasoningCapabilities("openai", "gpt-5");
+ assert.equal(five.supportsReasoningOff, false);
+ assert.deepEqual(
+ [...five.reasoningEffortLevels],
+ ["minimal", "low", "medium", "high"],
+ );
+});
+
+test("the chat-latest aliases advertise no reasoning at all", () => {
+ // They are non-reasoning, and the family prefixes would otherwise swallow
+ // them: `gpt-5.1-chat-latest` starts with `gpt-5.1`. Advertising reasoning
+ // makes the adapter send `reasoning_effort` on every turn, which the
+ // Responses API rejects with "Unsupported parameter: 'reasoning.effort' is
+ // not supported with this model" -- so the model never answers at all.
+ for (const model of [
+ "gpt-5-chat-latest",
+ "gpt-5.1-chat-latest",
+ "gpt-5.2-chat-latest",
+ "gpt-5.3-chat-latest",
+ // Azure names its deployment without the `-latest` tail.
+ "gpt-5-chat",
+ ]) {
+ const caps = getExternalReasoningCapabilities("openai", model);
+ assert.equal(caps.supportsReasoning, false, model);
+ }
+ // The reasoning families themselves must keep theirs.
+ for (const model of ["gpt-5.1", "gpt-5.2", "gpt-5", "gpt-5.3-codex"]) {
+ assert.equal(
+ getExternalReasoningCapabilities("openai", model).supportsReasoning,
+ true,
+ model,
+ );
+ }
+ // `chatgpt-4o-latest` is a different shape and was already non-reasoning.
+ assert.equal(
+ getExternalReasoningCapabilities("openai", "chatgpt-4o-latest")
+ .supportsReasoning,
+ false,
+ );
+});
+
test("ChatGPT subscription models expose Unsloth-owned search and code tools", () => {
setProviderModelCapabilities("openai_codex", {
diff --git a/studio/frontend/tests/provider-max-output-tokens-guards.test.ts b/studio/frontend/tests/provider-max-output-tokens-guards.test.ts
index ab832a8a695..23a13236e1c 100644
--- a/studio/frontend/tests/provider-max-output-tokens-guards.test.ts
+++ b/studio/frontend/tests/provider-max-output-tokens-guards.test.ts
@@ -87,11 +87,65 @@ test("a documented per-model cap bounds the connection override", () => {
}
});
+test("every OpenAI family the picker admits carries its documented cap", () => {
+ // A missing or too-generous row turns a raised Max Tokens into a failed
+ // request; the 4,096 pair is under the 8,192 default, so those two fail on
+ // an untouched config. The bare `gpt-5` and `gpt-4` rows are last, so this
+ // also pins that a more specific family keeps its own cap.
+ const caps: Array<[string, number]> = [
+ ["gpt-5.6-sol", 128000],
+ ["gpt-5.5", 128000],
+ ["gpt-5.4", 65536],
+ ["gpt-5.3", 16384],
+ ["gpt-5.2", 128000],
+ ["gpt-5.1", 128000],
+ // The chat aliases cap at 16,384 whatever their family does.
+ ["gpt-5-chat-latest", 16384],
+ ["gpt-5.1-chat-latest", 16384],
+ ["gpt-5.2-chat-latest", 16384],
+ ["gpt-5.3-chat-latest", 16384],
+ ["gpt-5", 128000],
+ ["gpt-5-mini", 128000],
+ ["gpt-4.1", 32768],
+ ["gpt-4.1-mini", 32768],
+ ["gpt-4.5-preview", 16384],
+ ["gpt-4o", 16384],
+ ["gpt-4o-mini", 16384],
+ ["chatgpt-4o-latest", 16384],
+ ["gpt-3.5-turbo", 4096],
+ ["gpt-3.5-turbo-16k", 4096],
+ ["gpt-4-turbo", 4096],
+ ["gpt-4-turbo-preview", 4096],
+ ["gpt-4", 8192],
+ ];
+ for (const [modelId, cap] of caps) {
+ assert.equal(getExternalMaxOutputTokens("openai", modelId), cap);
+ assert.equal(getExternalMaxOutputTokens("openai", modelId, 1000000), cap);
+ }
+});
+
+test("the dated Anthropic ids carry their documented cap", () => {
+ // Opus 4.1 and Opus 4 sit at 32,000, under the 32,768 fallback, so without
+ // a row a raised Max Tokens overshoots them.
+ const caps: Array<[string, number]> = [
+ ["claude-opus-4-5-20251101", 64000],
+ ["claude-sonnet-4-5-20250929", 64000],
+ ["claude-haiku-4-5-20251001", 64000],
+ ["claude-sonnet-4-20250514", 64000],
+ ["claude-opus-4-1-20250805", 32000],
+ ["claude-opus-4-20250514", 32000],
+ ];
+ for (const [modelId, cap] of caps) {
+ assert.equal(getExternalMaxOutputTokens("anthropic", modelId), cap);
+ assert.equal(getExternalMaxOutputTokens("anthropic", modelId, 1000000), cap);
+ }
+});
+
test("a model with no documented cap takes the connection override", () => {
// the reported case: a router id no capability row matches pinned at 32,768
const undocumented: Array<[string, string | null]> = [
["openrouter", "minimax/minimax-m3"],
- ["openai", "gpt-4o"],
+ ["openai", "o3"],
["vllm", "some/local-model"],
["ollama", null],
[LEGACY_CUSTOM_PROVIDER_TYPE, "any-model"],