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.

chore(lmstudio): polish follow-ups from #3740 (#3957)

LearningCircuita08cb3f1325d
diff --git a/src/local_deep_research/config/llm_config.py b/src/local_deep_research/config/llm_config.py
index 3725e70beb..5e40191141 100644
--- a/src/local_deep_research/config/llm_config.py
+++ b/src/local_deep_research/config/llm_config.py
@@ -641,12 +641,14 @@ def get_llm(
)
# Use URL as-is (default already includes /v1)
base_url = normalize_url(lmstudio_url)
- # Optional API key for LM Studio with auth enabled. Empty falls back
- # to a placeholder ChatOpenAI accepts; a no-auth LM Studio ignores it.
- lmstudio_auth = ( # gitleaks:allow
- get_setting_from_snapshot(
- "llm.lmstudio.api_key", "", settings_snapshot=settings_snapshot
- )
+ # 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.
+ lmstudio_auth_raw = get_setting_from_snapshot( # gitleaks:allow
+ "llm.lmstudio.api_key", "", settings_snapshot=settings_snapshot
+ )
+ lmstudio_auth = (
+ str(lmstudio_auth_raw or "").strip()
or "lm-studio" # gitleaks:allow
)
diff --git a/src/local_deep_research/defaults/default_settings.json b/src/local_deep_research/defaults/default_settings.json
index 7ed6193b55..f3abe78c7e 100644
--- a/src/local_deep_research/defaults/default_settings.json
+++ b/src/local_deep_research/defaults/default_settings.json
@@ -521,6 +521,20 @@
"value": "https://openrouter.ai/api/v1",
"visible": true
},
+ "llm.ollama.api_key": {
+ "category": null,
+ "description": "Optional API key for Ollama if you've put it behind a proxy that requires authentication. Leave empty for the default no-auth setup.",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Ollama API Key",
+ "options": null,
+ "step": null,
+ "type": "LLM",
+ "ui_element": "password",
+ "value": "",
+ "visible": true
+ },
"llm.ollama.url": {
"category": null,
"description": "HTTP endpoint URL where Ollama is running. Used to connect to local or remote Ollama instances for model inference.",
diff --git a/src/local_deep_research/llm/providers/implementations/lmstudio.py b/src/local_deep_research/llm/providers/implementations/lmstudio.py
index 89fa55c386..bb936edb5f 100644
--- a/src/local_deep_research/llm/providers/implementations/lmstudio.py
+++ b/src/local_deep_research/llm/providers/implementations/lmstudio.py
@@ -130,10 +130,9 @@ class LMStudioProvider(OpenAICompatibleProvider):
"""List models, attaching the optional API key when configured.
When ``api_key`` is provided directly (e.g., from the settings route),
- it is used as-is. When the caller doesn't supply a key (e.g., via the
- high-level ``list_models(settings_snapshot)`` classmethod), the key is
- read from settings here so authenticated installs are handled
- correctly on both paths. Empty/whitespace falls through to the
+ it is used as-is. When the caller doesn't supply a key, the key is
+ read from the thread-local settings here so authenticated installs are
+ handled correctly on both paths. Empty/whitespace falls through to the
parent's dummy-key path, preserving backward compat for
unauthenticated installs.
"""
diff --git a/tests/settings/golden_master_settings.json b/tests/settings/golden_master_settings.json
index 029542159d..36d2208efc 100644
--- a/tests/settings/golden_master_settings.json
+++ b/tests/settings/golden_master_settings.json
@@ -1076,6 +1076,20 @@
"value": "",
"visible": true
},
+ "llm.ollama.api_key": {
+ "category": null,
+ "description": "Optional API key for Ollama if you've put it behind a proxy that requires authentication. Leave empty for the default no-auth setup.",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Ollama API Key",
+ "options": null,
+ "step": null,
+ "type": "LLM",
+ "ui_element": "password",
+ "value": "",
+ "visible": true
+ },
"llm.ollama.enable_thinking": {
"category": "llm",
"description": "Enable thinking/reasoning mode for models like deepseek-r1 and qwen2.5. When enabled (recommended), the model performs internal reasoning for more accurate answers, but the reasoning content is automatically separated and excluded from the final response. When disabled, the model gives faster but potentially less accurate direct answers without reasoning.",