~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
refactor(lmstudio): ensure URLs end with /v1 for LM Studio integration (#4532)
Jacek Tańczykfdb5a9034c30
diff --git a/src/local_deep_research/config/llm_config.py b/src/local_deep_research/config/llm_config.pyindex 45e6149c09..30d8c65d74 100644--- a/src/local_deep_research/config/llm_config.py+++ b/src/local_deep_research/config/llm_config.py@@ -719,8 +719,8 @@ def get_llm(DEFAULT_LMSTUDIO_URL,settings_snapshot=settings_snapshot,)- # Use URL as-is (default already includes /v1)- base_url = normalize_url(lmstudio_url)+ _normalized = normalize_url(lmstudio_url)+ base_url = _normalized if _normalized.rstrip("/").endswith("/v1") else _normalized.rstrip("/") + "/v1"# Optional API key for LM Studio with auth enabled. Empty/whitespace# falls back to a placeholder ChatOpenAI accepts; a no-auth LM Studio# ignores it. Whitespace stripping mirrors LMStudioProvider.create_llm.diff --git a/src/local_deep_research/llm/providers/implementations/lmstudio.py b/src/local_deep_research/llm/providers/implementations/lmstudio.pyindex bb936edb5f..b59d68ca97 100644--- a/src/local_deep_research/llm/providers/implementations/lmstudio.py+++ b/src/local_deep_research/llm/providers/implementations/lmstudio.py@@ -24,6 +24,14 @@ class LMStudioProvider(OpenAICompatibleProvider):"" # User must specify the model they loaded — no silent fallback)+ @classmethod+ def _ensure_v1_suffix(cls, url: str) -> str:+ """Ensure URL ends with /v1 — LM Studio always uses this path prefix."""+ normalized = normalize_url(url)+ if not normalized.rstrip("/").endswith("/v1"):+ normalized = normalized.rstrip("/") + "/v1"+ return normalized+# Metadata for auto-discoveryprovider_key = "LMSTUDIO"company_name = "LM Studio"@@ -72,8 +80,7 @@ class LMStudioProvider(OpenAICompatibleProvider):settings_snapshot=settings_snapshot,)- # Use URL as-is (user should provide complete URL including /v1 if needed)- kwargs["base_url"] = normalize_url(lmstudio_url)+ kwargs["base_url"] = cls._ensure_v1_suffix(lmstudio_url)# If user configured a real API key (LM Studio with auth enabled), use# it. Otherwise pass a placeholder ChatOpenAI accepts; a no-auth@@ -100,8 +107,7 @@ class LMStudioProvider(OpenAICompatibleProvider):cls.default_base_url,settings_snapshot=settings_snapshot,)- # Use URL as-is (default already includes /v1)- base_url = normalize_url(lmstudio_url)+ base_url = cls._ensure_v1_suffix(lmstudio_url)response = safe_get(f"{base_url}/models",timeout=1,@@ -153,4 +159,5 @@ class LMStudioProvider(OpenAICompatibleProvider):settings_snapshot=None,)+ base_url = cls._ensure_v1_suffix(base_url)return super().list_models_for_api(api_key=api_key, base_url=base_url)