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: fill the context bar for Qwen connections (#13187)

Nilay83f9ecd3fefc
diff --git a/studio/backend/core/inference/external_provider.py b/studio/backend/core/inference/external_provider.py
index 6321e590389..2769d6f6509 100644
--- a/studio/backend/core/inference/external_provider.py
+++ b/studio/backend/core/inference/external_provider.py
@@ -44,9 +44,9 @@ _TEMPLATE_APPLYING_PROVIDERS = frozenset({"vllm", "llama_cpp", "ollama", "custom
# only vLLM and llama.cpp document both continuation flags on /v1/chat/completions.
_CONTINUATION_FLAG_PROVIDERS = frozenset({"vllm", "llama_cpp"})
-# custom may reject include_usage; OpenAI Responses supplies usage, while listed streams require it.
+# 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"}
+ {"vllm", "llama_cpp", "ollama", "openrouter", "kimi", "lemonade", "qwen"}
)
# launch-time windows are absent from catalogues; custom covers unregistered self-hosted servers.
diff --git a/studio/backend/tests/test_external_provider_stream_usage_opt_in.py b/studio/backend/tests/test_external_provider_stream_usage_opt_in.py
index 8c5c890134e..0880075d578 100644
--- a/studio/backend/tests/test_external_provider_stream_usage_opt_in.py
+++ b/studio/backend/tests/test_external_provider_stream_usage_opt_in.py
@@ -105,8 +105,14 @@ def test_an_ollama_connection_receives_the_usage_chunk():
assert _usage_chunks(opted_in) == [_USAGE]
+def test_a_qwen_connection_receives_the_usage_chunk():
+ opted_in, body = _proxy("qwen", stream_options = {"include_usage": True})
+ assert body["stream_options"] == {"include_usage": True}
+ assert _usage_chunks(opted_in) == [_USAGE]
+
+
def test_the_opt_in_does_not_reach_a_custom_endpoint():
- # custom endpoints omit upstream usage requests because strict endpoints reject the field with HTTP 400.
+ # strict custom endpoints reject upstream usage requests with HTTP 400.
_, opted_in = _proxy("custom", stream_options = {"include_usage": True})
_, plain = _proxy("custom")
assert opted_in == plain
diff --git a/studio/backend/tests/test_external_provider_usage_chunk.py b/studio/backend/tests/test_external_provider_usage_chunk.py
index 8a4308e16b0..291f014a7e2 100644
--- a/studio/backend/tests/test_external_provider_usage_chunk.py
+++ b/studio/backend/tests/test_external_provider_usage_chunk.py
@@ -734,6 +734,7 @@ def test_other_providers_do_not_get_the_continuation_flags(monkeypatch, provider
("kimi", True),
("llama_cpp", True),
("ollama", True),
+ ("qwen", True),
# user-supplied base_url endpoints may reject the unknown field with a 400.
("custom", False),
# "openai" is absent because /v1/responses reports usage.