~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
Fix #2747: Error when using llama.cpp server without API key (#3359)
Zakir Jiwanie1b7322c7316
diff --git a/.gitleaks.toml b/.gitleaks.tomlindex ba7bd480e6..ecebe02890 100644--- a/.gitleaks.toml+++ b/.gitleaks.toml@@ -259,6 +259,8 @@ regexes = [# Allow api_key type hints and docstrings'''api_key:\s*Optional''','''api_key\s*=\s*None''',+ # Allow placeholder API key for local servers without auth+ '''api_key\s*=\s*"not-needed"''',# Allow research_id, user_password in notification flow docs (example code)'''research_id,\s*user_password''',# Allow CSRF token patterns in HTML templatesdiff --git a/.gitleaksignore b/.gitleaksignoreindex 4610fd3fe8..bc52641820 100644--- a/.gitleaksignore+++ b/.gitleaksignore@@ -577,3 +577,6 @@ src/local_deep_research/research_library/search/routes/search_routes.py:generic-# Shared engine filtering - variable names, not actual secretssrc/local_deep_research/web_search_engines/search_engines_config.py:generic-secret:322src/local_deep_research/web_search_engines/search_engines_config.py:generic-secret:360++# Placeholder API key for local servers without auth (e.g. llama.cpp)+7c84e267390264c58c3857881c70f9b80677d76b:src/local_deep_research/config/llm_config.py:generic-secret:516diff --git a/src/local_deep_research/config/llm_config.py b/src/local_deep_research/config/llm_config.pyindex 2ed944a18d..067cf944cf 100644--- a/src/local_deep_research/config/llm_config.py+++ b/src/local_deep_research/config/llm_config.py@@ -510,10 +510,15 @@ def get_llm("llm.openai_endpoint.api_key", settings_snapshot=settings_snapshot)+ # Local servers (e.g. llama.cpp) don't require an API key.+ # Use a placeholder so ChatOpenAI doesn't reject the request.if not api_key:- raise ValueError(- "OpenAI endpoint API key not configured. Please set llm.openai_endpoint.api_key in settings."+ logger.info(+ "No API key configured for openai_endpoint provider. "+ "Using placeholder key. If you are connecting to a hosted "+ "service, set llm.openai_endpoint.api_key in settings.")+ api_key = "not-needed" # pragma: allowlist secret# Get endpoint URL from settingsif openai_endpoint_url is None:diff --git a/tests/config/test_llm_config.py b/tests/config/test_llm_config.pyindex 50a53af554..4836287b60 100644--- a/tests/config/test_llm_config.py+++ b/tests/config/test_llm_config.py@@ -656,6 +656,42 @@ class TestGetLlm:"openai_api_base", "")+ def test_openai_endpoint_without_api_key_uses_placeholder(self):+ """Should succeed without API key for local servers like llama.cpp."""+ from langchain_openai import ChatOpenAI++ with patch(+ "local_deep_research.config.llm_config.is_llm_registered",+ return_value=False,+ ):+ with patch(+ "local_deep_research.config.llm_config.get_setting_from_snapshot"+ ) as mock_get:+ mock_get.side_effect = lambda key, default=None, **kwargs: {+ "llm.model": "local-model",+ "llm.temperature": 0.7,+ "llm.provider": "openai_endpoint",+ "llm.openai_endpoint.api_key": None,+ "llm.openai_endpoint.url": "http://localhost:8080/v1",+ "llm.local_context_window_size": 4096,+ "llm.context_window_unrestricted": True,+ "llm.supports_max_tokens": True,+ "llm.max_tokens": 4096,+ "rate_limiting.llm_enabled": False,+ }.get(key, default)++ with patch.object(+ ChatOpenAI, "__init__", return_value=None+ ) as mock_init:+ # Should not raise even without an API key+ get_llm(provider="openai_endpoint")+ mock_init.assert_called_once()+ call_kwargs = mock_init.call_args.kwargs+ assert call_kwargs["model"] == "local-model"+ # A placeholder key should be passed, not None+ assert call_kwargs["api_key"] is not None+ assert call_kwargs["api_key"] != ""+def test_lmstudio_creates_chat_openai(self):"""Should create ChatOpenAI with LM Studio URL when provider is lmstudio."""from langchain_openai import ChatOpenAI