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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: add QwenCloud as an API provider (#14033)
Nilayf172c8d7c4bc
diff --git a/studio/backend/core/inference/external_provider.py b/studio/backend/core/inference/external_provider.pyindex fc87e702568..5de4f935ae5 100644--- a/studio/backend/core/inference/external_provider.py+++ b/studio/backend/core/inference/external_provider.py@@ -46,7 +46,7 @@ _CONTINUATION_FLAG_PROVIDERS = frozenset({"vllm", "llama_cpp"})# custom may reject include_usage; OpenAI Responses returns usage without it; listed streams need it._USAGE_STREAM_OPTION_PROVIDERS = frozenset(- {"vllm", "llama_cpp", "ollama", "openrouter", "kimi", "lemonade", "qwen"}+ {"vllm", "llama_cpp", "ollama", "openrouter", "kimi", "lemonade", "qwen", "qwencloud"})# launch-time windows are absent from catalogues; custom covers unregistered self-hosted servers.@@ -1859,7 +1859,7 @@ class ExternalProviderClient:_apply_mistral_reasoning_controls(body, model, enable_thinking, reasoning_effort)elif self.provider_type == "deepseek":_apply_deepseek_reasoning_controls(body, enable_thinking, reasoning_effort)- elif self.provider_type == "qwen":+ elif self.provider_type in ("qwen", "qwencloud"):_apply_qwen_reasoning_controls(body, enable_thinking)elif self.provider_type == "huggingface":_apply_passthrough_reasoning_effort(body, enable_thinking, reasoning_effort)diff --git a/studio/backend/core/inference/providers.py b/studio/backend/core/inference/providers.pyindex 752cc108f2e..f98fdc38812 100644--- a/studio/backend/core/inference/providers.py+++ b/studio/backend/core/inference/providers.py@@ -297,6 +297,32 @@ PROVIDER_REGISTRY: dict[str, dict[str, Any]] = {"auth_prefix": "Bearer ","notes": "DashScope API key. China mainland: override base URL to https://dashscope.aliyuncs.com/compatible-mode/v1",},+ "qwencloud": {+ "display_name": "QwenCloud",+ "base_url": "https://maas.qwencloudapi.com/compatible-mode/v1",+ "default_models": [+ "qwen3.8-max",+ "qwen3.7-plus",+ "qwen3.8-flash",+ ],+ "model_capabilities": {+ "qwen3.8-max": {"vision": True, "studio_tools": True},+ "qwen3.7-plus": {"vision": True, "studio_tools": True},+ "qwen3.8-flash": {"vision": True, "studio_tools": True},+ },+ "supports_streaming": True,+ "supports_vision": True,+ "supports_tool_calling": True,+ "studio_tools": True,+ "auth_header": "Authorization",+ "auth_prefix": "Bearer ",+ "notes": "QwenCloud pay-as-you-go API key (sk-ws-) from https://home.qwencloud.com/api-keys",+ "model_id_denylist": re.compile(+ r"(?:^|-)(?:realtime|livetranslate|tts|asr|s2s|embedding|rerank|ocr)\b"+ r"|^(?:qwen-audio|qwen-image|wan\d|z-image|cosyvoice|happyhorse|happyoyster|"+ r"tongyi-tingwu|ccai-pro|pre-mock)"+ ),+ },"huggingface": {"display_name": "Hugging Face","base_url": "https://router.huggingface.co/v1",diff --git a/studio/backend/core/research_runs.py b/studio/backend/core/research_runs.pyindex 178cbcb1336..33c93543c73 100644--- a/studio/backend/core/research_runs.py+++ b/studio/backend/core/research_runs.py@@ -1766,7 +1766,13 @@ class ResearchSupervisor:)if not omit_sampling and inference.get("topP") is not None:payload["top_p"] = inference["topP"]- if inference.get("providerType") in ("deepseek", "huggingface", "qwen", "mistral"):+ if inference.get("providerType") in (+ "deepseek",+ "huggingface",+ "qwen",+ "qwencloud",+ "mistral",+ ):# These providers forward reasoning fields verbatim, and a strict upstream rejects one the model lacks.# Mistral documents reasoning_effort for mistral-small-latest and mistral-medium-3-5 only, so the# planner opt-out must not reach mistral-large and the other non-reasoning models.diff --git a/studio/backend/routes/inference.py b/studio/backend/routes/inference.pyindex 8ed88aabfbd..f2cd2d1d53e 100644--- a/studio/backend/routes/inference.py+++ b/studio/backend/routes/inference.py@@ -10096,7 +10096,11 @@ _TEXT_ONLY_PROVIDER_TYPES = frozenset({"cohere", "deepseek", "mistral"})# because its allowlist permits only multimodal kimi-k3/k2.5/k2.6.# Single-endpoint types (custom, vllm, ollama, llamacpp, lmstudio) retain the# registry default: no model catalog exists to check the configured endpoint.-_MIXED_CATALOG_PROVIDER_TYPES = frozenset({"huggingface", "openrouter", "qwen"})+_MIXED_CATALOG_PROVIDER_TYPES = frozenset({"huggingface", "openrouter", "qwen", "qwencloud"})++# Mixed catalogs whose models.dev namespace answers vision per model.+# Mirrors CATALOG_VISION_PROVIDER_TYPES in external-providers.ts.+_CATALOG_VISION_NAMESPACES = {"qwencloud": "qwen"}def _external_takes_mcp_images(@@ -10120,6 +10124,12 @@ def _external_takes_mcp_images(if model and model in capabilities:return bool(capabilities[model].get("vision"))if provider_type in _MIXED_CATALOG_PROVIDER_TYPES:+ namespace = _CATALOG_VISION_NAMESPACES.get(provider_type)+ if namespace and model:+ from routes.providers import cached_catalog_model_inputs+ inputs = cached_catalog_model_inputs(namespace, model)+ if inputs is not None:+ return "image" in inputs# Vision for the family, unknown for this model: an image would be sent to# something that may not take one, and the failure lands mid-run.return Falsediff --git a/studio/backend/routes/providers.py b/studio/backend/routes/providers.pyindex 768406818a0..6d920fd53c1 100644--- a/studio/backend/routes/providers.py+++ b/studio/backend/routes/providers.py@@ -949,6 +949,16 @@ def _write_model_catalog_file(data: dict) -> None:logger.warning("providers.model_catalog_cache_write_failed", error = str(exc))+def cached_catalog_model_inputs(namespace: str, model: str) -> list[str] | None:+ global _model_catalog_cache+ if _model_catalog_cache is None:+ _model_catalog_cache = _read_model_catalog_file()+ bucket = ((_model_catalog_cache or {}).get("providers") or {}).get(namespace) or {}+ entry = bucket.get(model.strip().lower())+ inputs = entry.get("input") if isinstance(entry, dict) else None+ return inputs if isinstance(inputs, list) else None++async def _fetch_models_dev_catalog() -> dict:from core.inference.external_provider import _clientdiff --git a/studio/backend/tests/test_qwencloud_provider.py b/studio/backend/tests/test_qwencloud_provider.pynew file mode 100644index 00000000000..9e39e8599db--- /dev/null+++ b/studio/backend/tests/test_qwencloud_provider.py@@ -0,0 +1,160 @@+# 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 json+import sys+from pathlib import Path++import pytest++from core.inference.external_provider import ExternalProviderClient+from core.inference.providers import get_provider_info, list_available_providers+from models.providers import ProviderModelsRequest+from routes import providers as providers_route+from routes.inference import _external_takes_mcp_images++sys.path.insert(0, str(Path(__file__).resolve().parent))+from test_external_provider_sampling_over_the_wire import _Handler, _run, _Server # noqa: E402+from test_external_provider_stream_usage_opt_in import _USAGE, _proxy, _usage_chunks # noqa: E402+++class _AuthHandler(_Handler):+ def do_POST(self) -> None: # noqa: N802+ self.server.auth = self.headers.get("Authorization") # type: ignore[attr-defined]+ super().do_POST()+++_CHAT_IDS = [+ "qwen3.8-max",+ "qwen3.7-plus",+ "qwen3.8-flash",+ "qwen3.8-2.4t-a95b",+ "qwen3.8-omni-flash",+ "qwen3.5-omni-plus",+ "qwen3-vl-plus",+ "qwen3-coder-flash",+ "qwen-mt-plus",+ "qwen-plus-character",+ "qwq-plus-2025-03-05",+ "glm-5.3",+ "ZHIPU/GLM-5.3",+ "kimi-k3",+ "deepseek-v4-pro",+]+_NON_CHAT_IDS = [+ "pre-mock_new_gateway_session_affinity",+ "qwen3.8-omni-flash-realtime",+ "qwen3.5-livetranslate-flash-realtime",+ "qwen3-livetranslate-flash",+ "qwen-audio-3.1-realtime-plus",+ "qwen-audio-3.0-asr-flash",+ "qwen3-asr-flash-realtime",+ "qwen3-tts-flash",+ "qwen3-s2s-flash-realtime",+ "qwen-image-3.0-pro",+ "wan2.7-image-pro",+ "z-image-turbo",+ "qwen3.7-text-embedding",+ "text-embedding-v4",+ "qwen-vl-ocr-2025-11-20",+ "tongyi-tingwu-slp",+ "ccai-pro",+]+++class _ModelsHandler(_Handler):+ def do_GET(self) -> None: # noqa: N802+ ids = self.server.ids # type: ignore[attr-defined]+ body = json.dumps({"object": "list", "data": [{"id": i} for i in ids]}).encode()+ self.send_response(200)+ self.send_header("Content-Type", "application/json")+ self.send_header("Content-Length", str(len(body)))+ self.end_headers()+ self.wfile.write(body)+++def test_the_qwencloud_model_list_keeps_only_chat_models(monkeypatch):+ monkeypatch.setattr(+ providers_route, "resolve_provider_api_key_or_400", lambda *a, **k: "sk-ws-test"+ )+ listed: list[str] = []+ with _Server(handler = _ModelsHandler) as server:+ server._httpd.ids = _NON_CHAT_IDS + _CHAT_IDS++ async def go() -> None:+ payload = ProviderModelsRequest(provider_type = "qwencloud", base_url = server.base_url)+ result = await providers_route.list_provider_models(payload, "tester", False)+ listed.extend(m.id for m in result)++ _run(go)+ assert listed == _CHAT_IDS+++def test_qwencloud_is_offered_with_its_own_endpoint():+ rows = {row["provider_type"]: row for row in list_available_providers()}+ qwencloud = rows["qwencloud"]+ assert qwencloud["display_name"] == "QwenCloud"+ assert qwencloud["base_url"] == "https://maas.qwencloudapi.com/compatible-mode/v1"+ assert qwencloud["hidden"] is False+ assert qwencloud["supports_studio_tools"] is True+ assert {"qwen3.8-max", "qwen3.7-plus", "qwen3.8-flash"} <= set(qwencloud["default_models"])+ assert rows["qwen"]["base_url"] == "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"+++def test_a_qwencloud_connection_receives_the_usage_chunk():+ chunks, body = _proxy("qwencloud", stream_options = {"include_usage": True})+ assert body["stream_options"] == {"include_usage": True}+ assert _usage_chunks(chunks) == [_USAGE]++[email protected]("enabled", [True, False])+def test_the_qwencloud_thinking_toggle_reaches_the_wire(enabled):+ with _Server(handler = _AuthHandler) as server:+ client = ExternalProviderClient(+ provider_type = "qwencloud", base_url = server.base_url, api_key = "sk-ws-test"+ )++ async def go() -> None:+ async for _ in client.stream_chat_completion(+ messages = [{"role": "user", "content": "hi"}],+ model = "qwen3.7-plus",+ enable_thinking = enabled,+ ):+ pass++ _run(go)+ body = server.bodies[-1]+ assert server._httpd.auth == "Bearer sk-ws-test"+ assert body["enable_thinking"] is enabled+ assert "chat_template_kwargs" not in body+ assert "thinking" not in body+++def test_qwencloud_vision_models_keep_mcp_pictures():+ info = get_provider_info("qwencloud")+ for model in info["default_models"]:+ assert _external_takes_mcp_images("qwencloud", True, model, info) is True, model+ assert _external_takes_mcp_images("qwencloud", True, "glm-5.3", info) is False+++def test_qwencloud_reads_vision_from_the_model_catalog(monkeypatch):+ info = get_provider_info("qwencloud")+ catalog = {+ "fetched_at": 0,+ "providers": {+ "qwen": {+ "qwen3-vl-plus": {"input": ["text", "image"]},+ "qwen3.7-max": {"input": ["text"]},+ }+ },+ }+ monkeypatch.setattr(providers_route, "_model_catalog_cache", catalog)+ assert _external_takes_mcp_images("qwencloud", True, "qwen3-vl-plus", info) is True+ assert _external_takes_mcp_images("qwencloud", True, "qwen3.7-max", info) is False+ assert _external_takes_mcp_images("qwencloud", True, "glm-5.3", info) is False+ assert (+ _external_takes_mcp_images("qwen", True, "qwen3-vl-plus", get_provider_info("qwen"))+ is False+ )diff --git a/studio/frontend/scripts/check-bundle-budget.ts b/studio/frontend/scripts/check-bundle-budget.tsindex fc168f7d40f..7bc4734b1f2 100644--- a/studio/frontend/scripts/check-bundle-budget.ts+++ b/studio/frontend/scripts/check-bundle-budget.ts@@ -200,8 +200,12 @@ export const BUDGET = {// (6,800,980 -> 6,805,412 B raw, 2,045,645 -> 2,047,341 B transfer against 15e4bc8fde, one machine and build,// Node 24, chunk count unchanged at 95): the shared slide module and SegmentedPill, imported by toggles that// already live in startup chunks, so there is no separate module to lazy-load. Raised by that growth.- transferBytes: 2_047_477,- rawBytes: 6_805_847,+ // QwenCloud as a connection (#14033) adds 167 B raw / 43 B transfer (6,804,234 -> 6,804,401 B raw, 2,047,526 ->+ // 2,047,569 B transfer against ca3d1d0ce4, one machine and build, Node 24, chunk count unchanged at 95): its+ // connection row, logo mapping and capability entries live in tables the startup chunks already load. Raised+ // by that growth.+ transferBytes: 2_047_520,+ rawBytes: 6_806_014,};// The chunk count is reported but not budgeted. Splitting a page out of the entry raises it while lowering thediff --git a/studio/frontend/src/features/chat/external-providers.ts b/studio/frontend/src/features/chat/external-providers.tsindex 2018a3ca773..c30a937bb68 100644--- a/studio/frontend/src/features/chat/external-providers.ts+++ b/studio/frontend/src/features/chat/external-providers.ts@@ -282,7 +282,9 @@ export function providerModelSupportsVision(// Mirrors _MIXED_CATALOG_PROVIDER_TYPES in studio/backend/routes/inference.py: vision for// the family, unknown for a given model, so an MCP picture is not sent to one the// registry says nothing about.-const MIXED_CATALOG_PROVIDER_TYPES = new Set(["huggingface", "openrouter", "qwen"]);+const MIXED_CATALOG_PROVIDER_TYPES = new Set(["huggingface", "openrouter", "qwen", "qwencloud"]);+// Mirrors _CATALOG_VISION_NAMESPACES: mixed catalogs whose model catalog answers vision per model.+const CATALOG_VISION_PROVIDER_TYPES = new Set(["qwencloud"]);/** Whether the backend's external tool loop will hand this model an MCP picture -- the* same rule as its _external_takes_mcp_images, so envelopes the backend would strip@@ -298,7 +300,10 @@ export function providerModelTakesMcpImages(const capability = REGISTRY_MODEL_CAPABILITIES.get(providerType)?.[modelId];if (typeof capability?.vision === "boolean") return capability.vision;}- if (providerType && MIXED_CATALOG_PROVIDER_TYPES.has(providerType)) return false;+ if (providerType && MIXED_CATALOG_PROVIDER_TYPES.has(providerType)) {+ if (!CATALOG_VISION_PROVIDER_TYPES.has(providerType)) return false;+ return modelCatalogSupportsVision(providerType, modelId) === true;+ }return true;}diff --git a/studio/frontend/src/features/chat/model-catalog.ts b/studio/frontend/src/features/chat/model-catalog.tsindex 53468936027..d692ddfe582 100644--- a/studio/frontend/src/features/chat/model-catalog.ts+++ b/studio/frontend/src/features/chat/model-catalog.ts@@ -177,6 +177,7 @@ let mergedNamespaces: Map<string, Readonly<Record<string, ModelCatalogSnapshotEn* way; without this every Codex lookup resolved to null and read as "not published". */const CATALOG_NAMESPACE_ALIASES: Record<string, string> = {openai_codex: "openai",+ qwencloud: "qwen",};function catalogNamespace(providerType: string): string {diff --git a/studio/frontend/src/features/chat/provider-capabilities.ts b/studio/frontend/src/features/chat/provider-capabilities.tsindex 42ebcb30601..c3c6f3e07d3 100644--- a/studio/frontend/src/features/chat/provider-capabilities.ts+++ b/studio/frontend/src/features/chat/provider-capabilities.ts@@ -1258,6 +1258,7 @@ const CATALOG_REASONING_WIRE: Record<string, ReasoningWire> = {kimi: { levels: [], off: "unified" },deepseek: { levels: ["low", "high", "max"], aliases: { minimal: "low", medium: "high", xhigh: "high" }, off: "unified" },qwen: { levels: [], off: "unified" },+ qwencloud: { levels: [], off: "unified" },huggingface: { levels: null, off: "unified" },ollama: { levels: null, off: "unified" },// A vLLM older than 0.21 400s on the wider levels; the backend then leaves them to the template default.@@ -1432,6 +1433,7 @@ export function getExternalReasoningCapabilities(case "ollama":case "deepseek":case "qwen":+ case "qwencloud":case "huggingface":return catalogCapabilities(normalizedProvider, normalizedModel) ?? withEnableThinkingStyle();case "vllm":diff --git a/studio/frontend/src/features/chat/provider-logo-path.ts b/studio/frontend/src/features/chat/provider-logo-path.tsindex 7bc5c575956..f8a9a3b4fc6 100644--- a/studio/frontend/src/features/chat/provider-logo-path.ts+++ b/studio/frontend/src/features/chat/provider-logo-path.ts@@ -12,6 +12,7 @@ const HUB_PROVIDER_IDS = new Map([["huggingface", "huggingface"],["kimi", "moonshotai"],["qwen", "qwen"],+ ["qwencloud", "qwen"],]);const HUB_LOGO_PATHS = new Map(diff --git a/studio/frontend/tests/mcp-images.test.ts b/studio/frontend/tests/mcp-images.test.tsindex e9290d67d11..8bf5381a321 100644--- a/studio/frontend/tests/mcp-images.test.ts+++ b/studio/frontend/tests/mcp-images.test.ts@@ -437,6 +437,10 @@ test("the upload gate is the backend's external MCP gate, not provider-level visassert.equal(providerModelTakesMcpImages("openrouter", "some/unknown-model"), false);assert.equal(providerModelTakesMcpImages("huggingface", "org/unknown"), false);assert.equal(providerModelTakesMcpImages("qwen", "qwen2.5-72b-instruct"), false);+ assert.equal(providerModelTakesMcpImages("qwen", "qwen3-vl-plus"), false);+ assert.equal(providerModelTakesMcpImages("qwencloud", "qwen3-vl-plus"), true);+ assert.equal(providerModelTakesMcpImages("qwencloud", "qwen3.7-max"), false);+ assert.equal(providerModelTakesMcpImages("qwencloud", "glm-5.3"), false);// Known text-only endpoints stay a no; a vision family with a plain catalog is a yes.assert.equal(providerModelTakesMcpImages("mistral", "mistral-large"), false);assert.equal(providerModelTakesMcpImages("anthropic", "claude-x"), true);diff --git a/studio/frontend/tests/model-catalog.test.ts b/studio/frontend/tests/model-catalog.test.tsindex ff359beb3ec..1bbe8f21146 100644--- a/studio/frontend/tests/model-catalog.test.ts+++ b/studio/frontend/tests/model-catalog.test.ts@@ -177,6 +177,16 @@ test("Qwen only has a wire toggle, so a ladder collapses to on/off", () => {assert.equal(getExternalReasoningCapabilities("kimi", "kimi-k2.6").supportsReasoning, true);});+test("QwenCloud reads the Qwen catalog for its thinking toggle and vision", () => {+ for (const model of ["qwen3.8-max", "qwen3.7-plus", "qwen3.8-flash"]) {+ const caps = getExternalReasoningCapabilities("qwencloud", model);+ assert.equal(caps.reasoningStyle, "enable_thinking", model);+ assert.equal(caps.supportsReasoning, true, model);+ assert.equal(caps.supportsReasoningOff, true, model);+ assert.equal(providerModelSupportsVision("qwencloud", model), true, model);+ }+});+test("Kimi K3's documented always-on effort ladder outranks the catalog's toggle", () => {// models.dev lists a toggle, but the Kimi API has no thinking switch for kimi-k3.const caps = getExternalReasoningCapabilities("kimi", "kimi-k3");diff --git a/studio/frontend/tests/provider-logo-path.test.ts b/studio/frontend/tests/provider-logo-path.test.tsindex c889bf11eb9..397b2be4af5 100644--- a/studio/frontend/tests/provider-logo-path.test.ts+++ b/studio/frontend/tests/provider-logo-path.test.ts@@ -19,6 +19,7 @@ test("connections use the model hub's canonical provider images", () => {["huggingface", "huggingface"],["kimi", "moonshotai"],["qwen", "qwen"],+ ["qwencloud", "qwen"],]) {const hubLogo = PROVIDER_LOGOS.find(({ id }) => id === hubId);assert.ok(hubLogo, hubId);@@ -37,7 +38,7 @@ test("Gemini keeps its own logo, separate from Google's hub image", () => {test("every supported connection resolves to an existing public asset", () => {for (const type of ["openai", "openai_codex", "deepseek", "mistral", "huggingface", "kimi",- "qwen", "gemini", "anthropic", "openrouter", "vllm", "ollama", "llama_cpp",+ "qwen", "qwencloud", "gemini", "anthropic", "openrouter", "vllm", "ollama", "llama_cpp","liquid", "typesafe",]) {const path = providerLogoPath(type);