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: hide the ChatGPT subscription provider from pre-OAuth desktop bundles (#8747)

Noah Jenkins7bb3bc32911b
diff --git a/studio/backend/core/inference/providers.py b/studio/backend/core/inference/providers.py
index 73a2bfa9355..04cf769cf34 100644
--- a/studio/backend/core/inference/providers.py
+++ b/studio/backend/core/inference/providers.py
@@ -1103,7 +1103,9 @@ def validate_provider_base_url(base_url: str) -> str:
return raw.rstrip("/")
-def list_available_providers(include_hidden: bool = False) -> list[dict[str, Any]]:
+def list_available_providers(
+ include_hidden: bool = False, include_oauth: bool = False
+) -> list[dict[str, Any]]:
"""Return registered providers (for the /registry endpoint).
Hidden entries exist only for backend lookups and are surfaced by the UI via
@@ -1115,11 +1117,17 @@ def list_available_providers(include_hidden: bool = False) -> list[dict[str, Any
``include_hidden`` is how a client that does know says so. The self-hosted presets are exactly
the ones that run Unsloth's tools, so their capability has to reach a frontend that asks for it,
and asking is opt-in.
+
+ OAuth rows are opt-in too: a pre-OAuth bundle (v0.1.701-beta, bare request) renders them as an
+ API-key form the backend then rejects (#8722). Every bundle sending ``include_hidden`` already
+ renders OAuth, so either flag opts in.
"""
result = []
for provider_type, info in PROVIDER_REGISTRY.items():
if (info.get("hidden") and not include_hidden) or info.get("managed"):
continue
+ if info.get("auth_kind") == "chatgpt_oauth" and not (include_hidden or include_oauth):
+ continue
result.append(
{
"provider_type": provider_type,
diff --git a/studio/backend/routes/providers.py b/studio/backend/routes/providers.py
index ccef15ad3d1..4c150c311b3 100644
--- a/studio/backend/routes/providers.py
+++ b/studio/backend/routes/providers.py
@@ -187,7 +187,9 @@ async def get_public_key(current_subject: str = Depends(get_current_subject)):
@router.get("/registry", response_model = list[ProviderRegistryEntry])
async def list_registry(
- include_hidden: bool = False, current_subject: str = Depends(get_current_subject)
+ include_hidden: bool = False,
+ include_oauth: bool = False,
+ current_subject: str = Depends(get_current_subject),
):
"""List all supported provider types with their default configurations.
@@ -196,8 +198,9 @@ async def list_registry(
needs. It is opt-in so that a browser still running a pre-capability bundle,
which does not know to filter on ``hidden``, keeps seeing exactly the list
it saw before and cannot render them as duplicate dropdown options.
+ OAuth rows need ``include_hidden`` or ``include_oauth``.
"""
- return list_available_providers(include_hidden = include_hidden)
+ return list_available_providers(include_hidden = include_hidden, include_oauth = include_oauth)
@router.get("/pricing")
diff --git a/studio/backend/tests/test_external_tools_compat.py b/studio/backend/tests/test_external_tools_compat.py
index e49d9fe3962..c0ab4879702 100644
--- a/studio/backend/tests/test_external_tools_compat.py
+++ b/studio/backend/tests/test_external_tools_compat.py
@@ -135,6 +135,74 @@ def test_visible_rows_are_identical_with_and_without_include_hidden():
assert row == widened[row["provider_type"]]
+def test_registry_default_hides_oauth_providers_from_legacy_clients():
+ """v0.1.701-beta sends a bare request and renders every row as an API-key form (#8722)."""
+ types = {entry["provider_type"] for entry in list_available_providers()}
+ assert "openai_codex" not in types
+
+
+ "include_hidden, include_oauth", [(True, False), (False, True), (True, True)]
+)
+def test_oauth_aware_clients_get_oauth_providers(include_hidden, include_oauth):
+ """Released bundles v0.1.702-beta+ render OAuth but only send include_hidden."""
+ entries = {
+ entry["provider_type"]: entry
+ for entry in list_available_providers(
+ include_hidden = include_hidden, include_oauth = include_oauth
+ )
+ }
+ assert entries["openai_codex"]["auth_kind"] == "chatgpt_oauth"
+
+
[email protected]("include_hidden", [False, True])
[email protected]("include_oauth", [False, True])
+def test_registry_capabilities_preserve_api_key_rows_and_exclude_managed_providers(
+ include_hidden, include_oauth
+):
+ rows = list_available_providers(include_hidden = include_hidden, include_oauth = include_oauth)
+ api_key_rows = [row for row in rows if row["auth_kind"] == "api_key"]
+ assert api_key_rows == [
+ row
+ for row in list_available_providers(include_hidden = include_hidden)
+ if row["auth_kind"] == "api_key"
+ ]
+ assert all(not PROVIDER_REGISTRY[row["provider_type"]].get("managed") for row in rows)
+
+
+ "query, expects_oauth, expects_hidden",
+ [
+ ("", False, False),
+ ("?include_hidden=true", True, True),
+ ("?include_oauth=false", False, False),
+ ("?include_oauth=true", True, False),
+ ("?include_hidden=true&include_oauth=true", True, True),
+ ],
+)
+def test_registry_endpoint_requires_oauth_client_capability(query, expects_oauth, expects_hidden):
+ from fastapi import FastAPI
+ from fastapi.testclient import TestClient
+
+ from auth.authentication import get_current_subject
+ from routes.providers import router
+
+ app = FastAPI()
+ app.dependency_overrides[get_current_subject] = lambda: "test-user"
+ app.include_router(router, prefix = "/api/providers")
+ with TestClient(app) as client:
+ response = client.get(f"/api/providers/registry{query}")
+
+ assert response.status_code == 200
+ entries = {row["provider_type"]: row for row in response.json()}
+ assert ("openai_codex" in entries) is expects_oauth
+ if expects_oauth:
+ assert entries["openai_codex"]["auth_kind"] == "chatgpt_oauth"
+ for preset in SELF_HOSTED_PRESETS:
+ assert (preset in entries) is expects_hidden
+ assert all(not PROVIDER_REGISTRY[provider_type].get("managed") for provider_type in entries)
+
+
def test_registry_rows_keep_every_pre_change_key():
"""Additive only. A cached bundle reads these keys off every row."""
for entry in list_available_providers(include_hidden = True):
diff --git a/studio/backend/tests/test_openai_codex_subscription.py b/studio/backend/tests/test_openai_codex_subscription.py
index 303f1093939..31772fbce08 100644
--- a/studio/backend/tests/test_openai_codex_subscription.py
+++ b/studio/backend/tests/test_openai_codex_subscription.py
@@ -95,7 +95,9 @@ def test_protocol_constants_and_curated_provider_contract():
assert info["model_capabilities"][model] == {"vision": True, "studio_tools": True}
assert OPENAI_CODEX_DEVICE_REDIRECT_URI == ("https://auth.openai.com/deviceauth/callback")
row = next(
- item for item in list_available_providers() if item["provider_type"] == "openai_codex"
+ item
+ for item in list_available_providers(include_oauth = True)
+ if item["provider_type"] == "openai_codex"
)
assert row["auth_kind"] == "chatgpt_oauth"
diff --git a/studio/frontend/src/features/chat/api/providers-api.ts b/studio/frontend/src/features/chat/api/providers-api.ts
index 3efa6261c06..2fd72655bd7 100644
--- a/studio/frontend/src/features/chat/api/providers-api.ts
+++ b/studio/frontend/src/features/chat/api/providers-api.ts
@@ -195,7 +195,9 @@ export async function listProviderRegistry(): Promise<ProviderRegistryEntry[]> {
// include_hidden asks for the backend-only entries (the self-hosted presets), which carry the
// studio-tools capability the composer gates on. An older backend ignores the parameter and
// returns the visible entries, so the capability reads as unknown and the pills stay closed.
- const response = await authFetch("/api/providers/registry?include_hidden=true");
+ const response = await authFetch(
+ "/api/providers/registry?include_hidden=true&include_oauth=true",
+ );
return parseJsonOrThrow<ProviderRegistryEntry[]>(response);
}
diff --git a/studio/frontend/tests/provider-registry-oauth-capability.test.ts b/studio/frontend/tests/provider-registry-oauth-capability.test.ts
new file mode 100644
index 00000000000..929730bb73d
--- /dev/null
+++ b/studio/frontend/tests/provider-registry-oauth-capability.test.ts
@@ -0,0 +1,31 @@
+// 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 { register } from "node:module";
+import test from "node:test";
+
+register("./helpers/settings-api-resolver.mjs", import.meta.url);
+
+const requests: string[] = [];
+globalThis.fetch = (async (input: RequestInfo | URL) => {
+ requests.push(String(input));
+ return new Response("[]", {
+ status: 200,
+ headers: { "Content-Type": "application/json" },
+ });
+}) as typeof fetch;
+
+const { listProviderRegistry } = await import(
+ "../src/features/chat/api/providers-api.ts"
+);
+
+test("provider registry declares OAuth UI support", async () => {
+ requests.length = 0;
+
+ await listProviderRegistry();
+
+ assert.deepEqual(requests, [
+ "/api/providers/registry?include_hidden=true&include_oauth=true",
+ ]);
+});