Fix: OpenRouter/Together/Fireworks detection + deprecated gpt-4-turbo-preview model

Issues fixed:
- OpenRouter API key not recognized: _set_no_provider_error() now checks all 7
  provider keys (was only checking Anthropic/OpenAI/Google), so users with only
  OPENROUTER_API_KEY set no longer get "No API keys configured" error
- Error message now lists all 8 providers (added OpenRouter, Together, Fireworks)
  instead of only 5 (Anthropic, OpenAI, Google, Ollama, LM Studio)
- gpt-4-turbo-preview (deprecated by OpenAI, 404 error) replaced with gpt-4o
  as default OpenAI model in LLMClient init and generate() fallback
- Settings API model list updated: removed gpt-4-turbo-preview and o1-preview/mini,
  added gpt-4.1, gpt-4.1-mini, o3-mini
- .env.example comment updated to reference gpt-4o instead of gpt-4-turbo

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
CyberSecurityUP
2026-02-22 18:04:43 -03:00
parent e0935793c5
commit 4041018397
4 changed files with 25 additions and 14 deletions
+5 -3
View File
@@ -421,7 +421,7 @@ class LLMClient:
try:
self.client = openai.OpenAI(api_key=self.openai_key)
self.provider = "openai"
self.model_name = self.configured_model or "gpt-4-turbo-preview"
self.model_name = self.configured_model or "gpt-4o"
print(f"[LLM] OpenAI API initialized (model: {self.model_name})")
return
except Exception as e:
@@ -514,8 +514,10 @@ class LLMClient:
errors = []
if not ANTHROPIC_AVAILABLE and not OPENAI_AVAILABLE:
errors.append("LLM libraries not installed (run: pip install anthropic openai)")
if not self.anthropic_key and not self.openai_key and not self.google_key:
errors.append("No API keys configured")
all_keys = [self.anthropic_key, self.openai_key, self.google_key,
self.openrouter_key, self.together_key, self.fireworks_key, self.codex_key]
if not any(all_keys):
errors.append("No API keys configured (set ANTHROPIC_API_KEY, OPENAI_API_KEY, OPENROUTER_API_KEY, GEMINI_API_KEY, TOGETHER_API_KEY, or FIREWORKS_API_KEY)")
if not self._check_ollama():
errors.append("Ollama not running locally")
if not self._check_lmstudio():