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.

Standardize list_models_for_api signature across all providers

LearningCircuit50c806980b72
diff --git a/src/local_deep_research/llm/providers/implementations/google.py b/src/local_deep_research/llm/providers/implementations/google.py
index 6c193eecfe..d6296e63ea 100644
--- a/src/local_deep_research/llm/providers/implementations/google.py
+++ b/src/local_deep_research/llm/providers/implementations/google.py
@@ -37,9 +37,16 @@ class GoogleProvider(OpenAICompatibleProvider):
return True
@classmethod
- def list_models_for_api(cls, api_key=None, settings_snapshot=None):
+ def list_models_for_api(
+ cls, api_key=None, base_url=None, settings_snapshot=None
+ ):
"""List available models using Google's native API.
+ Args:
+ api_key: Google API key
+ base_url: Not used - Google uses a fixed endpoint
+ settings_snapshot: Not used
+
Google's OpenAI-compatible /models endpoint returns 401 (bug),
so we use the native Gemini API endpoint instead.
"""
diff --git a/src/local_deep_research/llm/providers/implementations/xai.py b/src/local_deep_research/llm/providers/implementations/xai.py
index 0d6006a6e4..848e381b2e 100644
--- a/src/local_deep_research/llm/providers/implementations/xai.py
+++ b/src/local_deep_research/llm/providers/implementations/xai.py
@@ -31,7 +31,9 @@ class XAIProvider(OpenAICompatibleProvider):
return True
@classmethod
- def list_models_for_api(cls, api_key=None, settings_snapshot=None):
+ def list_models_for_api(
+ cls, api_key=None, base_url=None, settings_snapshot=None
+ ):
"""List available models for xAI.
xAI requires authentication for the /models endpoint.
@@ -41,7 +43,7 @@ class XAIProvider(OpenAICompatibleProvider):
return []
# Use the parent class implementation which handles the OpenAI-compatible endpoint
- return super().list_models_for_api(api_key, settings_snapshot)
+ return super().list_models_for_api(api_key, base_url, settings_snapshot)
# Keep the standalone functions for backward compatibility and registration
diff --git a/src/local_deep_research/llm/providers/openai_base.py b/src/local_deep_research/llm/providers/openai_base.py
index d16c5375f2..b2e1aa7a09 100644
--- a/src/local_deep_research/llm/providers/openai_base.py
+++ b/src/local_deep_research/llm/providers/openai_base.py
@@ -247,7 +247,9 @@ class OpenAICompatibleProvider:
return cls.default_base_url
@classmethod
- def list_models_for_api(cls, api_key=None, base_url=None):
+ def list_models_for_api(
+ cls, api_key=None, base_url=None, settings_snapshot=None
+ ):
"""List available models for API endpoint use.
This method is designed to be called from Flask routes.
@@ -255,6 +257,7 @@ class OpenAICompatibleProvider:
Args:
api_key: Optional API key (if None and required, returns empty list)
base_url: Optional base URL to use (if None, uses cls.default_base_url)
+ settings_snapshot: Optional settings snapshot for subclasses that need it
Returns:
List of model dictionaries with 'value' and 'label' keys
@@ -330,7 +333,7 @@ class OpenAICompatibleProvider:
# Get base URL from settings if provider has configurable URL
base_url = cls._get_base_url_for_models(settings_snapshot)
- return cls.list_models_for_api(api_key, base_url)
+ return cls.list_models_for_api(api_key, base_url, settings_snapshot)
except Exception as e:
logger.exception(