Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,13 +23,13 @@ OPENROUTER_BASE_URL = "https://openrouter.ai/api/v1"
|
|
| 23 |
TEXT_MODELS = [
|
| 24 |
m.strip() for m in os.getenv(
|
| 25 |
"OPENROUTER_MODELS",
|
| 26 |
-
#
|
| 27 |
-
"deepseek/deepseek-chat-v3-0324:free,"
|
| 28 |
"meta-llama/llama-3.3-70b-instruct:free,"
|
| 29 |
"mistralai/mistral-small-3.2-24b-instruct:free,"
|
| 30 |
"google/gemini-2.0-flash-exp:free,"
|
| 31 |
"qwen/qwen-2.5-72b-instruct:free,"
|
| 32 |
-
"deepseek/deepseek-r1:free"
|
|
|
|
| 33 |
).split(",")
|
| 34 |
if m.strip()
|
| 35 |
]
|
|
@@ -612,6 +612,17 @@ class OpenRouterAgent:
|
|
| 612 |
is_rate = "429" in msg or "rate" in msg.lower() or "limit" in msg.lower()
|
| 613 |
is_quota = ("daily" in msg.lower() or "quota" in msg.lower()
|
| 614 |
or "exhausted" in msg.lower())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 615 |
if is_rate and is_quota:
|
| 616 |
print(f"[{m}] daily quota exhausted; switching model.")
|
| 617 |
self.exhausted.add(m)
|
|
|
|
| 23 |
TEXT_MODELS = [
|
| 24 |
m.strip() for m in os.getenv(
|
| 25 |
"OPENROUTER_MODELS",
|
| 26 |
+
# Currently-valid free OpenRouter models (verify at https://openrouter.ai/models?q=free).
|
|
|
|
| 27 |
"meta-llama/llama-3.3-70b-instruct:free,"
|
| 28 |
"mistralai/mistral-small-3.2-24b-instruct:free,"
|
| 29 |
"google/gemini-2.0-flash-exp:free,"
|
| 30 |
"qwen/qwen-2.5-72b-instruct:free,"
|
| 31 |
+
"deepseek/deepseek-r1:free,"
|
| 32 |
+
"deepseek/deepseek-chat:free"
|
| 33 |
).split(",")
|
| 34 |
if m.strip()
|
| 35 |
]
|
|
|
|
| 612 |
is_rate = "429" in msg or "rate" in msg.lower() or "limit" in msg.lower()
|
| 613 |
is_quota = ("daily" in msg.lower() or "quota" in msg.lower()
|
| 614 |
or "exhausted" in msg.lower())
|
| 615 |
+
# 404 / "No endpoints found" / "model not found" -> dead model, never retry.
|
| 616 |
+
is_dead = (
|
| 617 |
+
"404" in msg
|
| 618 |
+
or "no endpoints" in msg.lower()
|
| 619 |
+
or "not found" in msg.lower()
|
| 620 |
+
or "model_not_found" in msg.lower()
|
| 621 |
+
)
|
| 622 |
+
if is_dead:
|
| 623 |
+
print(f"[{m}] model unavailable (404 / no endpoints); marking exhausted.")
|
| 624 |
+
self.exhausted.add(m)
|
| 625 |
+
break
|
| 626 |
if is_rate and is_quota:
|
| 627 |
print(f"[{m}] daily quota exhausted; switching model.")
|
| 628 |
self.exhausted.add(m)
|