Skip to content
Python

Add LM Studio as a local server provider

Rohit C Prasad45d58dc9a5d6
diff --git a/coworker/providers/capabilities.py b/coworker/providers/capabilities.py
index c3514148..f9285fa5 100644
--- a/coworker/providers/capabilities.py
+++ b/coworker/providers/capabilities.py
@@ -25,7 +25,7 @@ def capabilities_for(model: str) -> ModelCapabilities:
# Ollama (local) models vary widely and many fake/mishandle parallel tool calls — assume
# tools work (we only point at tool-capable models) but stay conservative otherwise.
# Vision is detected from common model naming conventions (-vl, vision, llava, etc.).
- if provider in ("ollama", "llamacpp", "vllm"):
+ if provider in ("ollama", "llamacpp", "vllm", "lmstudio"):
_vision_patterns = ("-vl", "vision", "llava", "bakllava", "cogvlm", "minicpm-v")
has_vision = any(p in name for p in _vision_patterns)
return ModelCapabilities(
diff --git a/coworker/providers/local_server.py b/coworker/providers/local_server.py
index f33f9154..51f20375 100644
--- a/coworker/providers/local_server.py
+++ b/coworker/providers/local_server.py
@@ -1,6 +1,6 @@
-"""llama.cpp and vLLM: servers the user starts, reached through their OpenAI-compatible
-`/v1`. One module for both, since OpenWorker treats them the same way and the two
-differ only in what they report about themselves.
+"""llama.cpp, vLLM and LM Studio: servers the user starts, reached through their
+OpenAI-compatible `/v1`. One module for all three, since OpenWorker treats them the same
+way and they differ only in what they report about themselves.
- llama.cpp `llama-server`: `localhost:8080` by default; `/v1/models` lists the loaded
model (its id is the file path unless the server was started with `--alias`), with
@@ -11,8 +11,12 @@ differ only in what they report about themselves.
`max_model_len`. Tool calls work only when the server was started with
`--enable-auto-tool-choice --tool-call-parser <name>`; the harness cannot turn them on,
but it can find out, and say so, before a session breaks.
+- LM Studio: `localhost:1234` by default (`lms server start` or the Developer tab); its
+ `/v1/models` lists every downloaded model, and its own `/api/v0/models` adds each one's
+ `max_context_length` and whether it is loaded. Tool calls go through the model's chat
+ template, as in llama.cpp.
-Neither tells the harness what the machine is; that is local_machine.py. Both may take an
+None of them tells the harness what the machine is; that is local_machine.py. Both may take an
API key; without one any value is accepted, and OpenWorker sends a placeholder.
"""
@@ -31,6 +35,7 @@ from .recommended import recommendation_for
LOCAL_SERVERS: dict[str, dict[str, str]] = {
"llamacpp": {"title": "llama.cpp", "default_base": "http://localhost:8080"},
"vllm": {"title": "vLLM", "default_base": "http://localhost:8000"},
+ "lmstudio": {"title": "LM Studio", "default_base": "http://localhost:1234"},
}
PLACEHOLDER_KEY = "none"
CACHE_SECONDS = 60.0
@@ -122,6 +127,8 @@ def _fetch(name: str, base: str, api_key: Optional[str]) -> list[dict[str, Any]]
if not isinstance(items, list):
return []
props: dict[str, Any] = {}
+ if name == "lmstudio":
+ props = _lmstudio_catalog(base, headers)
if name == "llamacpp":
try:
got = httpx.get(base[: -len("/v1")] + "/props", headers=headers, timeout=4.0).json()
@@ -142,6 +149,20 @@ def _fetch(name: str, base: str, api_key: Optional[str]) -> list[dict[str, Any]]
return rows
+def _lmstudio_catalog(base: str, headers: dict[str, str]) -> dict[str, Any]:
+ """LM Studio's own listing (`/api/v0/models`), keyed by id: the trained window
+ (`max_context_length`) and the load state the OpenAI-compatible listing leaves out.
+ Empty when the server does not answer it."""
+ try:
+ got = httpx.get(base[: -len("/v1")] + "/api/v0/models", headers=headers, timeout=4.0).json()
+ except (httpx.HTTPError, ValueError, OSError):
+ return {}
+ items = got.get("data") if isinstance(got, dict) else None
+ if not isinstance(items, list):
+ return {}
+ return {str(it["id"]): it for it in items if isinstance(it, dict) and it.get("id")}
+
+
def _vllm_tools_on(base: str, headers: dict[str, str], model: str) -> Optional[bool]:
"""Ask vLLM for a one-token reply with a tool offered. A server started without tool
calling refuses the request and names the flag; one with it answers."""
@@ -171,6 +192,13 @@ def _row(name: str, item: dict[str, Any], props: dict[str, Any], tools: Optional
context = _int((props.get("default_generation_settings") or {}).get("n_ctx"))
context_max = _int(meta.get("n_ctx_train"))
size = _int(meta.get("size"))
+ elif name == "lmstudio":
+ # LM Studio sizes the window when it loads the model (JIT, on first request, by
+ # default); until then the trained window is the only figure it reports.
+ own = props.get(served_id) if isinstance(props.get(served_id), dict) else {}
+ context_max = _int(own.get("max_context_length"))
+ context = _int(own.get("loaded_context_length")) or context_max
+ size = None
else:
context = _int(item.get("max_model_len"))
context_max = context
@@ -205,8 +233,8 @@ def _int(value: Any) -> Optional[int]:
def thinking_as_template_kwargs(settings: dict[str, Any]) -> dict[str, Any]:
- """The thinking switch travels as Ollama's `think` field (model_config.py); llama.cpp
- and vLLM read it from the chat template's `enable_thinking` instead. Rewrites one into
+ """The thinking switch travels as Ollama's `think` field (model_config.py); llama.cpp,
+ vLLM and LM Studio read it from the chat template's `enable_thinking` instead. Rewrites one into
the other and leaves everything else alone."""
extra = settings.get("extra_body")
if not isinstance(extra, dict) or "think" not in extra:
diff --git a/coworker/providers/registry.py b/coworker/providers/registry.py
index 6df37aa5..6dc5a6df 100644
--- a/coworker/providers/registry.py
+++ b/coworker/providers/registry.py
@@ -211,7 +211,7 @@ def _build_ollama(profile: dict[str, Any], secrets: Any) -> ProviderClient:
def _local_server(name: str):
- """Builder for llama.cpp and vLLM (providers/local_server.py): the user's own server,
+ """Builder for llama.cpp, vLLM and LM Studio (providers/local_server.py): the user's own server,
reached through its `/v1`, with an optional key. Without a key the server takes any
value, so a placeholder goes out."""
from .local_server import PLACEHOLDER_KEY, remember_server, thinking_as_template_kwargs, v1_base
@@ -861,6 +861,34 @@ DESCRIPTORS: list[ProviderDescriptor] = [
blurb="A vLLM server, usually on a Linux machine with an NVIDIA GPU.",
kind="local",
),
+ ProviderDescriptor(
+ name="lmstudio",
+ title="LM Studio",
+ needs_key=False,
+ fields=[
+ ProviderField(
+ "base_url",
+ "Server address",
+ secret=False,
+ required=False,
+ placeholder="http://localhost:1234",
+ help="Where LM Studio's local server is listening (the Developer tab, or "
+ "`lms server start`). The /v1 path is added automatically.",
+ ),
+ ProviderField(
+ "api_key",
+ "API key (only if the server was started with one)",
+ secret=True,
+ required=False,
+ ),
+ ],
+ build=_local_server("lmstudio"),
+ # The same verified tool-calling pick as Ollama's, under LM Studio's catalog id
+ # (lmstudio.ai/models/qwen/qwen3-coder-30b, read 2026-10-25) — download it in-app.
+ recommended_model="qwen/qwen3-coder-30b",
+ blurb="The LM Studio app's local server, with whatever models you downloaded there.",
+ kind="local",
+ ),
]
_BY_NAME = {d.name: d for d in DESCRIPTORS}
@@ -1188,7 +1216,7 @@ def verify_provider_key(
elif name == "ollama":
base = _normalize_ollama_url(base_url)
resp = httpx.get(base.rstrip("/") + "/models", timeout=timeout)
- elif name in ("llamacpp", "vllm"):
+ elif name in ("llamacpp", "vllm", "lmstudio"):
from .local_server import v1_base
headers = {"Authorization": f"Bearer {key}"} if key else {}
diff --git a/coworker/server/manager.py b/coworker/server/manager.py
index acb8bc9e..12a4939f 100644
--- a/coworker/server/manager.py
+++ b/coworker/server/manager.py
@@ -4288,7 +4288,7 @@ class SessionManager:
topped up with the compat-vendor extras the matrix doesn't vouch for."""
if name == "ollama":
return [m.split(":", 1)[-1] for m in self._ollama_models()]
- if name in ("llamacpp", "vllm"):
+ if name in ("llamacpp", "vllm", "lmstudio"):
return [m.split(":", 1)[-1] for m in self._local_server_models(name)]
from ..providers.matrix import models_for_provider
@@ -4351,7 +4351,7 @@ class SessionManager:
if rec and rec in suggested:
# OpenAI models stay bare (the router's default); others carry their prefix.
added = rec if name == "openai" else f"{name}:{rec}"
- elif name in ("ollama", "llamacpp", "vllm") and suggested:
+ elif name in ("ollama", "llamacpp", "vllm", "lmstudio") and suggested:
# A local server offers whatever the user loaded — the recommended model may
# not be one.
added = f"{name}:{suggested[0]}"
@@ -4590,7 +4590,7 @@ class SessionManager:
return {"provider": name, "models": [], "error": "no local model list for this provider"}
def _local_server_alive(self, name: str) -> bool:
- """Best-effort liveness of a llama.cpp or vLLM server, cached 30 s like Ollama's."""
+ """Best-effort liveness of a llama.cpp, vLLM or LM Studio server, cached 30 s like Ollama's."""
import time
from ..providers import local_server
@@ -4607,7 +4607,7 @@ class SessionManager:
return alive
def _local_server_models(self, name: str) -> list[str]:
- """The model ids a llama.cpp or vLLM server serves, as `<name>:<id>`; empty when
+ """The model ids a llama.cpp, vLLM or LM Studio server serves, as `<name>:<id>`; empty when
it does not answer or was started without tool calling."""
from ..providers import local_server
@@ -4631,7 +4631,7 @@ class SessionManager:
provider = self._model_provider(model)
if provider == "ollama":
return self._ollama_alive()
- if provider in ("llamacpp", "vllm"):
+ if provider in ("llamacpp", "vllm", "lmstudio"):
return self._local_server_alive(provider)
return self._provider_configured(provider)
@@ -4864,7 +4864,7 @@ class SessionManager:
# Pulled Ollama models are offered live while Ollama answers — no need to add each one.
if self._ollama_alive():
selectable = list(dict.fromkeys([*selectable, *self._ollama_models()]))
- for local in ("llamacpp", "vllm"):
+ for local in ("llamacpp", "vllm", "lmstudio"):
if self.secrets.get(f"provider:{local}") and self._local_server_alive(local):
selectable = list(dict.fromkeys([*selectable, *self._local_server_models(local)]))
if self.model not in selectable:
diff --git a/docs/local-servers.md b/docs/local-servers.md
index e904fe9e..f5a4addb 100644
--- a/docs/local-servers.md
+++ b/docs/local-servers.md
@@ -1,8 +1,8 @@
-# llama.cpp and vLLM
+# llama.cpp, vLLM and LM Studio
-OpenWorker can use a model served by [llama.cpp](https://github.com/ggml-org/llama.cpp)
-or [vLLM](https://github.com/vllm-project/vllm), on this computer or on another machine.
-Each is its own provider in Settings ▸ Models & Keys, under "On your own hardware", next
+OpenWorker can use a model served by [llama.cpp](https://github.com/ggml-org/llama.cpp),
+[vLLM](https://github.com/vllm-project/vllm) or [LM Studio](https://lmstudio.ai), on this
+computer or on another machine. Each is its own provider in Settings ▸ Models & Keys, under "On your own hardware", next
to Ollama. Give it the server's address and, only if the server was started with one, its
API key. OpenWorker reads the rest from the server.
@@ -44,9 +44,22 @@ vllm serve nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-NVFP4 \
The default address is `http://localhost:8000`.
+## LM Studio
+
+Download a model in the LM Studio app, then start its server from the Developer tab or
+with `lms server start`. Every downloaded model is listed; LM Studio loads one when the
+first request names it.
+
+- The model's id is its LM Studio catalog name, for example `qwen/qwen3-coder-30b`.
+- The context size is the one LM Studio loaded the model with (its own listing reports
+ it); until the model is loaded, the trained window is shown instead.
+- A key is needed only if you turned one on in the app.
+
+The default address is `http://localhost:1234`.
+
## In the CLI
-The model id is `llamacpp:<id>` or `vllm:<id>`:
+The model id is `llamacpp:<id>`, `vllm:<id>` or `lmstudio:<id>`:
```bash
openworker run --model llamacpp:my-model --prompt "..."
@@ -55,5 +68,6 @@ openworker run --model llamacpp:my-model --prompt "..."
## Per-model settings
Longest reply, sampling, thinking and auto-compaction are set per model as for any other
-provider; see [model settings](model-settings.md). The context size of these two servers
-is set when the server starts, so OpenWorker shows it rather than setting it.
+provider; see [model settings](model-settings.md). The context size of these servers is
+set when the server starts (or, in LM Studio, when it loads the model), so OpenWorker
+shows it rather than setting it.
diff --git a/surfaces/gui/src/locales/en.json b/surfaces/gui/src/locales/en.json
index 51709c75..c1fecfe0 100644
--- a/surfaces/gui/src/locales/en.json
+++ b/surfaces/gui/src/locales/en.json
@@ -1621,7 +1621,9 @@
"llamacpp_desc": "No API key needed unless your llama-server was started with one.",
"install_llamacpp": "Install llama.cpp",
"vllm_desc": "vLLM runs on Linux with an NVIDIA GPU. A key is needed only if the server was started with one.",
- "install_vllm": "Install vLLM"
+ "install_vllm": "Install vLLM",
+ "lmstudio_desc": "The LM Studio app serves the models you downloaded there. A key is needed only if you turned one on in the app.",
+ "install_lmstudio": "Install LM Studio"
},
"workspace_trust": {
"title": "Trust this workspace’s commands?",
diff --git a/surfaces/gui/src/locales/zh.json b/surfaces/gui/src/locales/zh.json
index 534f68c9..fa111121 100644
--- a/surfaces/gui/src/locales/zh.json
+++ b/surfaces/gui/src/locales/zh.json
@@ -1601,7 +1601,9 @@
"llamacpp_desc": "无需 API 密钥,除非你的 llama-server 启动时设置了密钥。",
"install_llamacpp": "安装 llama.cpp",
"vllm_desc": "vLLM 运行在带 NVIDIA GPU 的 Linux 上。仅当服务器启动时设置了密钥才需要填写。",
- "install_vllm": "安装 vLLM"
+ "install_vllm": "安装 vLLM",
+ "lmstudio_desc": "LM Studio 应用会提供你在其中下载的模型。仅当你在应用中开启了密钥才需要填写。",
+ "install_lmstudio": "安装 LM Studio"
},
"workspace_trust": {
"title": "信任此工作区的命令?",
diff --git a/surfaces/gui/src/providers/ProviderSetup.tsx b/surfaces/gui/src/providers/ProviderSetup.tsx
index 941799b9..1227b51f 100644
--- a/surfaces/gui/src/providers/ProviderSetup.tsx
+++ b/surfaces/gui/src/providers/ProviderSetup.tsx
@@ -28,6 +28,7 @@ const LOCAL_HELP: Record<string, { desc: string; link: string; url: string }> =
ollama: { desc: "provider.no_key_needed_desc", link: "provider.install_ollama", url: "https://ollama.com/download" },
llamacpp: { desc: "provider.llamacpp_desc", link: "provider.install_llamacpp", url: "https://github.com/ggml-org/llama.cpp#quick-start" },
vllm: { desc: "provider.vllm_desc", link: "provider.install_vllm", url: "https://docs.vllm.ai/en/latest/getting_started/installation/" },
+ lmstudio: { desc: "provider.lmstudio_desc", link: "provider.install_lmstudio", url: "https://lmstudio.ai/download" },
};
export const KEY_HELP: Record<string, { url: string; label: string; labelKey?: string }> = {
diff --git a/surfaces/gui/src/providers/logos.ts b/surfaces/gui/src/providers/logos.ts
index 487bb314..7e2995e9 100644
--- a/surfaces/gui/src/providers/logos.ts
+++ b/surfaces/gui/src/providers/logos.ts
@@ -11,9 +11,11 @@ import gemini from "./logos/gemini.svg";
import byteplus from "./logos/byteplus.svg";
import volcengine from "./logos/volcengine.svg";
import ollama from "./logos/ollama.svg";
-// llama.cpp: selfhst/icons (CC BY 4.0); vLLM: homarr-labs/dashboard-icons (Apache 2.0).
+// llama.cpp: selfhst/icons (CC BY 4.0); vLLM: homarr-labs/dashboard-icons (Apache 2.0);
+// LM Studio: lobe-icons (MIT).
import llamacpp from "./logos/llamacpp.svg";
import vllm from "./logos/vllm.svg";
+import lmstudio from "./logos/lmstudio.svg";
import bedrock from "./logos/bedrock.svg";
import vertex from "./logos/vertex.svg";
import openrouter from "./logos/openrouter.svg";
@@ -49,6 +51,7 @@ export const PROVIDER_LOGOS: Record<string, string> = {
ollama,
llamacpp,
vllm,
+ lmstudio,
bedrock,
vertex,
openrouter,
@@ -83,6 +86,7 @@ export const PROVIDER_ORDER = [
"ollama",
"llamacpp",
"vllm",
+ "lmstudio",
"bedrock",
"vertex",
"openrouter",
diff --git a/surfaces/gui/src/providers/logos/lmstudio.svg b/surfaces/gui/src/providers/logos/lmstudio.svg
new file mode 100644
index 00000000..ea0816b6
--- /dev/null
+++ b/surfaces/gui/src/providers/logos/lmstudio.svg
@@ -0,0 +1 @@
+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>LM Studio</title><path d="M2.84 2a1.273 1.273 0 100 2.547h14.107a1.273 1.273 0 100-2.547H2.84zM7.935 5.33a1.273 1.273 0 000 2.548H22.04a1.274 1.274 0 000-2.547H7.935zM3.624 9.935c0-.704.57-1.274 1.274-1.274h14.106a1.274 1.274 0 010 2.547H4.898c-.703 0-1.274-.57-1.274-1.273zM1.273 12.188a1.273 1.273 0 100 2.547H15.38a1.274 1.274 0 000-2.547H1.273zM3.624 16.792c0-.704.57-1.274 1.274-1.274h14.106a1.273 1.273 0 110 2.547H4.898c-.703 0-1.274-.57-1.274-1.273zM13.029 18.849a1.273 1.273 0 100 2.547h9.698a1.273 1.273 0 100-2.547h-9.698z" fill-opacity=".3"></path><path d="M2.84 2a1.273 1.273 0 100 2.547h10.287a1.274 1.274 0 000-2.547H2.84zM7.935 5.33a1.273 1.273 0 000 2.548H18.22a1.274 1.274 0 000-2.547H7.935zM3.624 9.935c0-.704.57-1.274 1.274-1.274h10.286a1.273 1.273 0 010 2.547H4.898c-.703 0-1.274-.57-1.274-1.273zM1.273 12.188a1.273 1.273 0 100 2.547H11.56a1.274 1.274 0 000-2.547H1.273zM3.624 16.792c0-.704.57-1.274 1.274-1.274h10.286a1.273 1.273 0 110 2.547H4.898c-.703 0-1.274-.57-1.274-1.273zM13.029 18.849a1.273 1.273 0 100 2.547h5.78a1.273 1.273 0 100-2.547h-5.78z"></path></svg>
\ No newline at end of file
diff --git a/tests/test_local_server.py b/tests/test_local_server.py
index d896372d..889809ee 100644
--- a/tests/test_local_server.py
+++ b/tests/test_local_server.py
@@ -1,4 +1,4 @@
-"""llama.cpp and vLLM as providers (providers/local_server.py, registry.py): the user's
+"""llama.cpp, vLLM and LM Studio as providers (providers/local_server.py, registry.py): the user's
own server through its /v1, what each reports about its model, and how the server's
model lists, liveness and adoption treat them."""
@@ -29,10 +29,10 @@ def _fake_http(monkeypatch, handler):
def test_descriptors_carry_a_kind_for_grouping():
kinds = {d.name: d.kind for d in provider_descriptors()}
- assert kinds["ollama"] == kinds["llamacpp"] == kinds["vllm"] == "local"
+ assert kinds["ollama"] == kinds["llamacpp"] == kinds["vllm"] == kinds["lmstudio"] == "local"
assert kinds["openai-codex"] == "subscription"
assert kinds["openai"] == kinds["anthropic"] == "api_key"
- for name in ("llamacpp", "vllm"):
+ for name in ("llamacpp", "vllm", "lmstudio"):
d = get_descriptor(name)
assert d is not None and not d.needs_key
assert [f.key for f in d.fields] == ["base_url", "api_key"]
@@ -44,6 +44,8 @@ def test_v1_base_takes_the_root_or_an_explicit_v1():
assert local_server.v1_base("llamacpp", None) == "http://localhost:8080/v1"
assert local_server.v1_base("llamacpp", "http://box.local:9000/") == "http://box.local:9000/v1"
assert local_server.v1_base("vllm", "http://box.local:8000/v1") == "http://box.local:8000/v1"
+ assert local_server.v1_base("lmstudio", None) == "http://localhost:1234/v1"
+ assert local_server.v1_base("lmstudio", "http://127.0.0.1:1234/v1/") == "http://127.0.0.1:1234/v1"
def test_the_builder_sends_a_placeholder_key_when_none_is_set():
@@ -52,6 +54,8 @@ def test_the_builder_sends_a_placeholder_key_when_none_is_set():
assert client._api_key == "none"
client = get_descriptor("vllm").build({"base_url": "http://gpu:8000", "api_key": "s3"}, None)
assert client._base_url == "http://gpu:8000/v1" and client._api_key == "s3"
+ client = get_descriptor("lmstudio").build({}, None)
+ assert client._base_url == "http://localhost:1234/v1" and client._api_key == "none"
def test_llamacpp_facts_come_from_models_and_props(monkeypatch):
@@ -77,6 +81,49 @@ def test_llamacpp_facts_come_from_models_and_props(monkeypatch):
assert local_server.context_window_for("ollama:x") is None
+def test_lmstudio_facts_add_the_window_from_its_own_listing(monkeypatch):
+ """LM Studio's /v1/models names every downloaded model; its /api/v0/models carries
+ the trained window and the load state, which the row reads when they answer."""
+ def handler(request: httpx.Request) -> httpx.Response:
+ if request.url.path == "/v1/models":
+ return httpx.Response(200, json={"data": [
+ {"id": "qwen/qwen3-coder-30b", "object": "model", "owned_by": "organization_owner"},
+ {"id": "text-embedding-nomic-embed-text-v1.5", "object": "model", "owned_by": "organization_owner"},
+ ]})
+ if request.url.path == "/api/v0/models":
+ return httpx.Response(200, json={"data": [
+ {"id": "qwen/qwen3-coder-30b", "type": "llm", "state": "loaded",
+ "max_context_length": 262144, "loaded_context_length": 32768},
+ {"id": "text-embedding-nomic-embed-text-v1.5", "type": "embeddings", "state": "not-loaded",
+ "max_context_length": 2048},
+ ]})
+ return httpx.Response(404)
+
+ _fake_http(monkeypatch, handler)
+ rows = local_server.model_facts("lmstudio", "http://localhost:1234")
+ by_id = {r["name"]: r for r in rows}
+ coder = by_id["qwen/qwen3-coder-30b"]
+ assert coder["model"] == "lmstudio:qwen/qwen3-coder-30b"
+ assert coder["context_max"] == 262144 and coder["context"] == 32768
+ assert coder["context_from"] == "server" and coder["tools"] is None
+ # Not loaded yet: only the trained window is known, and it stands in for the window.
+ embed = by_id["text-embedding-nomic-embed-text-v1.5"]
+ assert embed["context_max"] == embed["context"] == 2048
+ assert local_server.context_window_for("lmstudio:qwen/qwen3-coder-30b") == 32768
+
+
+def test_lmstudio_facts_survive_a_missing_own_listing(monkeypatch):
+ def handler(request: httpx.Request) -> httpx.Response:
+ if request.url.path == "/v1/models":
+ return httpx.Response(200, json={"data": [{"id": "qwen/qwen3-coder-30b", "object": "model"}]})
+ return httpx.Response(404)
+
+ _fake_http(monkeypatch, handler)
+ (row,) = local_server.model_facts("lmstudio", "http://localhost:1234")
+ assert row["model"] == "lmstudio:qwen/qwen3-coder-30b"
+ assert row["context"] is None and row["context_max"] is None
+
+
def test_vllm_facts_probe_whether_tool_calling_is_on(monkeypatch):
calls = []
@@ -119,7 +166,7 @@ def test_thinking_switch_reaches_llama_cpp_and_vllm_as_template_kwargs(monkeypat
sent = {}
monkeypatch.setattr(openai_provider.OpenAIProvider, "complete", lambda self, **kw: sent.update(kw) or "ok")
- for name in ("llamacpp", "vllm"):
+ for name in ("llamacpp", "vllm", "lmstudio"):
client = get_descriptor(name).build({}, None)
client.complete(model="m", messages=[], max_tokens=10, extra_body={"think": False})
assert sent["extra_body"] == {"chat_template_kwargs": {"enable_thinking": False}}
diff --git a/tests/test_matrix_current_models.py b/tests/test_matrix_current_models.py
index ea2516da..a7747686 100644
--- a/tests/test_matrix_current_models.py
+++ b/tests/test_matrix_current_models.py
@@ -82,11 +82,12 @@ _KNOWN_UNVERIFIED_RECOMMENDATIONS = {"minimax:MiniMax-M2.5", "meta:muse-spark-1.
def test_every_recommended_model_is_in_the_matrix():
"""The Settings pane suggests each provider's `recommended_model`; every one must be a
- curated row (Ollama excepted: a user-local model name, not a vendor catalog id)."""
+ curated row (local servers excepted: Ollama and LM Studio recommend a model the user
+ downloads, named as that app names it, not a vendor catalog id)."""
missing = [
_matrix_key(d.name, d.recommended_model)
for d in DESCRIPTORS
- if d.name != "ollama" and d.recommended_model
+ if d.kind != "local" and d.recommended_model
and _matrix_key(d.name, d.recommended_model) not in MATRIX
]
assert not missing, f"recommended models without a matrix row: {missing}"
@@ -99,7 +100,7 @@ def test_recommended_models_without_a_window_are_exactly_the_known_set():
without = {
_matrix_key(d.name, d.recommended_model)
for d in DESCRIPTORS
- if d.name != "ollama" and d.recommended_model
+ if d.kind != "local" and d.recommended_model
and _matrix_key(d.name, d.recommended_model) not in windows
}
assert without == _KNOWN_UNVERIFIED_RECOMMENDATIONS