Skip to content

~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.

fix(lmstudio): use configured URL when fetching models

LearningCircuit6e7de70809d5
diff --git a/src/local_deep_research/llm/providers/implementations/lmstudio.py b/src/local_deep_research/llm/providers/implementations/lmstudio.py
index e4b3455f03..4828fc6ba3 100644
--- a/src/local_deep_research/llm/providers/implementations/lmstudio.py
+++ b/src/local_deep_research/llm/providers/implementations/lmstudio.py
@@ -76,6 +76,63 @@ class LMStudioProvider(OpenAICompatibleProvider):
"""LM Studio doesn't require authentication for listing models."""
return False
+ @classmethod
+ def list_models_for_api(cls, api_key=None, settings_snapshot=None):
+ """List available models from LM Studio.
+
+ Overrides the base class to use the configured URL from settings
+ instead of the hardcoded default_base_url.
+
+ Args:
+ api_key: Not used (LM Studio doesn't require auth)
+ settings_snapshot: Optional settings snapshot for configuration
+
+ Returns:
+ List of model dictionaries with 'value' and 'label' keys
+ """
+ try:
+ from openai import OpenAI
+
+ from ....utilities.db_utils import get_settings_manager
+
+ # Get LM Studio URL from settings
+ settings = get_settings_manager()
+ lmstudio_url = settings.get_setting("llm.lmstudio.url")
+
+ if not lmstudio_url:
+ lmstudio_url = "http://localhost:1234"
+
+ # LM Studio uses /v1 endpoint
+ base_url = f"{lmstudio_url}/v1"
+
+ # Create OpenAI client (LM Studio doesn't need real auth)
+ client = OpenAI(
+ api_key="not-required", # pragma: allowlist secret
+ base_url=base_url,
+ )
+
+ # Fetch models
+ logger.debug(f"Fetching models from LM Studio at {base_url}")
+ models_response = client.models.list()
+
+ models = []
+ for model in models_response.data:
+ if model.id:
+ models.append(
+ {
+ "value": model.id,
+ "label": f"{model.id} (LM Studio)",
+ "provider": "LMSTUDIO",
+ }
+ )
+
+ logger.info(f"Found {len(models)} models from LM Studio")
+ return models
+
+ except Exception as e:
+ logger.warning(f"Error listing models from LM Studio: {e}")
+ return []
+
# Keep the standalone functions for backward compatibility and registration
def create_lmstudio_llm(model_name=None, temperature=0.7, **kwargs):