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: Check environment variables in fallback LLM logic

LearningCircuit93fc045d82e0
diff --git a/src/local_deep_research/config/llm_config.py b/src/local_deep_research/config/llm_config.py
index 15c30a6adb..d896316c95 100644
--- a/src/local_deep_research/config/llm_config.py
+++ b/src/local_deep_research/config/llm_config.py
@@ -313,18 +313,24 @@ def get_llm(
if (
(
provider == "openai"
- and get_setting_from_snapshot(
- "llm.openai.api_key",
- default=None,
- settings_snapshot=settings_snapshot,
+ and (
+ get_setting_from_snapshot(
+ "llm.openai.api_key",
+ default=None,
+ settings_snapshot=settings_snapshot,
+ )
+ or os.environ.get("OPENAI_API_KEY")
)
)
or (
provider == "anthropic"
- and get_setting_from_snapshot(
- "llm.anthropic.api_key",
- default=None,
- settings_snapshot=settings_snapshot,
+ and (
+ get_setting_from_snapshot(
+ "llm.anthropic.api_key",
+ default=None,
+ settings_snapshot=settings_snapshot,
+ )
+ or os.environ.get("ANTHROPIC_API_KEY")
)
)
or (
diff --git a/test_api_endpoint.py b/test_api_endpoint.py
deleted file mode 100644
index 5f65488b9c..0000000000
--- a/test_api_endpoint.py
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/env python3
-"""Test the API endpoint directly"""
-
-import os
-import sys
-import tempfile
-import shutil
-
-# Set up environment
-temp_dir = tempfile.mkdtemp()
-os.environ["LDR_DATA_DIR"] = temp_dir
-os.environ["TESTING"] = "1"
-
-# Add src to path
-sys.path.insert(0, "src")
-
-try:
- from local_deep_research.web.app_factory import create_app
- from local_deep_research.database.auth.init_auth_db import (
- init_auth_database,
- )
-
- print("Creating Flask app...")
- app, _ = create_app()
- app.config["TESTING"] = True
- app.config["WTF_CSRF_ENABLED"] = False
-
- # Initialize auth database
- init_auth_database()
-
- client = app.test_client()
-
- # Register and login
- print("\nRegistering test user...")
- client.post(
- "/auth/register",
- data={
- "username": "testuser",
- "password": "testpassword123",
- "confirm_password": "testpassword123",
- "acknowledge": "true",
- },
- )
-
- print("Logging in...")
- client.post(
- "/auth/login",
- data={
- "username": "testuser",
- "password": "testpassword123",
- },
- )
-
- # Test the API endpoint
- print("\nTesting /api/v1/quick_summary endpoint...")
- payload = {
- "query": "test",
- "search_tool": "wikipedia",
- "iterations": 1,
- "temperature": 0.7,
- }
-
- response = client.post(
- "/api/v1/quick_summary",
- json=payload,
- content_type="application/json",
- )
-
- print(f"Status code: {response.status_code}")
- print(f"Response data: {response.data.decode()[:500]}")
-
- if response.status_code == 500:
- print("\nFull response:")
- print(response.data.decode())
-
-except Exception as e:
- print(f"Error: {e}")
- import traceback
-
- traceback.print_exc()
-finally:
- # Clean up
- shutil.rmtree(temp_dir, ignore_errors=True)