Spaces:
Sleeping
Sleeping
Register only the 2 chat-capable models; drop ming-image-0.1-design (image-gen, chat/completions 404) and span-01-lite (absent from OpenRouter catalog)
Browse files- patch_ming_models.py +28 -10
patch_ming_models.py
CHANGED
|
@@ -1,14 +1,25 @@
|
|
| 1 |
-
"""Patch backend: register
|
| 2 |
|
| 3 |
Every model id is prefixed with `openai/`, which `_resolve_llm_params` strips
|
| 4 |
before calling OpenRouter (and `patch_openrouter_fix.py` forces
|
| 5 |
`custom_llm_provider="openrouter"` so LiteLLM uses the right client).
|
| 6 |
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
- openai/dots-studio/dots-3-note-preview:free
|
|
|
|
| 9 |
- openai/qwen/qwen3.8-27b:free
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
Runs AFTER patch_models.py and patch_new_models.py. Fully idempotent: every edit
|
| 14 |
is skipped when its target already exists, and the script asserts afterwards that
|
|
@@ -25,20 +36,16 @@ AGENT_FILE = "/app/backend/routes/agent.py"
|
|
| 25 |
CONSTANTS = {
|
| 26 |
"DOTS_3_NOTE_PREVIEW_FREE_MODEL_ID": "openai/dots-studio/dots-3-note-preview:free",
|
| 27 |
"QWEN3_8_27B_FREE_MODEL_ID": "openai/qwen/qwen3.8-27b:free",
|
| 28 |
-
"SPAN_01_LITE_MODEL_ID": "openai/respan/span-01-lite",
|
| 29 |
-
"MING_IMAGE_0_1_DESIGN_MODEL_ID": "openai/inclusionai/ming-image-0.1-design",
|
| 30 |
}
|
| 31 |
|
| 32 |
LABELS = {
|
| 33 |
"DOTS_3_NOTE_PREVIEW_FREE_MODEL_ID": "dots-studio/dots-3-note-preview:free",
|
| 34 |
"QWEN3_8_27B_FREE_MODEL_ID": "qwen/qwen3.8-27b:free",
|
| 35 |
-
"SPAN_01_LITE_MODEL_ID": "respan/span-01-lite",
|
| 36 |
-
"MING_IMAGE_0_1_DESIGN_MODEL_ID": "inclusionai/ming-image-0.1-design",
|
| 37 |
}
|
| 38 |
|
| 39 |
failures = []
|
| 40 |
|
| 41 |
-
# ---------- 1. model_ids.py: add the
|
| 42 |
with open(IDS_FILE) as f:
|
| 43 |
ids = f.read()
|
| 44 |
|
|
@@ -72,6 +79,8 @@ if not missing_imports:
|
|
| 72 |
else:
|
| 73 |
new_imports = "".join(f" {name},\n" for name in missing_imports)
|
| 74 |
import_anchor = " LIQUID_LFM_2_5_2_6B_FREE_MODEL_ID,\n"
|
|
|
|
|
|
|
| 75 |
if import_anchor not in agent:
|
| 76 |
import_anchor = " LING_3_0_FLASH_FREE_MODEL_ID,\n"
|
| 77 |
if import_anchor not in agent:
|
|
@@ -118,6 +127,15 @@ for name in CONSTANTS:
|
|
| 118 |
if agent.count(f" {name},\n") != 1:
|
| 119 |
failures.append(f"duplicate/missing import {name}")
|
| 120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
if failures:
|
| 122 |
for msg in failures:
|
| 123 |
print(f"FAIL: {msg}")
|
|
@@ -128,4 +146,4 @@ with open(AGENT_FILE, "w") as f:
|
|
| 128 |
f.write(agent)
|
| 129 |
print("OK: agent.py written & syntax valid")
|
| 130 |
print("OK: exactly one constant + import + list entry per new model")
|
| 131 |
-
print("DONE:
|
|
|
|
| 1 |
+
"""Patch backend: register the new chat models using the Laguna S 2.1 model-path convention.
|
| 2 |
|
| 3 |
Every model id is prefixed with `openai/`, which `_resolve_llm_params` strips
|
| 4 |
before calling OpenRouter (and `patch_openrouter_fix.py` forces
|
| 5 |
`custom_llm_provider="openrouter"` so LiteLLM uses the right client).
|
| 6 |
|
| 7 |
+
Verified against the live OpenRouter catalog (GET /api/v1/models, 464 models,
|
| 8 |
+
fetched twice with identical results):
|
| 9 |
+
|
| 10 |
- openai/dots-studio/dots-3-note-preview:free
|
| 11 |
+
PRESENT, chat-capable (output_modalities=["text"]), 512k ctx, free.
|
| 12 |
- openai/qwen/qwen3.8-27b:free
|
| 13 |
+
PRESENT, chat-capable (output_modalities=["text"]), 262k ctx, free.
|
| 14 |
+
|
| 15 |
+
NOT registered here, on purpose:
|
| 16 |
+
- inclusionai/ming-image-0.1-design -- ABSENT from the OpenRouter catalog.
|
| 17 |
+
OpenRouter answers chat/completions with:
|
| 18 |
+
"is an image generation model and cannot be used with the chat/completions
|
| 19 |
+
endpoint. Use the /api/v1/images endpoint instead."
|
| 20 |
+
This backend only ever calls chat/completions, so it can never work here.
|
| 21 |
+
- respan/span-01-lite -- ABSENT from the OpenRouter catalog (no respan/*
|
| 22 |
+
namespace exists at all), so the id cannot resolve.
|
| 23 |
|
| 24 |
Runs AFTER patch_models.py and patch_new_models.py. Fully idempotent: every edit
|
| 25 |
is skipped when its target already exists, and the script asserts afterwards that
|
|
|
|
| 36 |
CONSTANTS = {
|
| 37 |
"DOTS_3_NOTE_PREVIEW_FREE_MODEL_ID": "openai/dots-studio/dots-3-note-preview:free",
|
| 38 |
"QWEN3_8_27B_FREE_MODEL_ID": "openai/qwen/qwen3.8-27b:free",
|
|
|
|
|
|
|
| 39 |
}
|
| 40 |
|
| 41 |
LABELS = {
|
| 42 |
"DOTS_3_NOTE_PREVIEW_FREE_MODEL_ID": "dots-studio/dots-3-note-preview:free",
|
| 43 |
"QWEN3_8_27B_FREE_MODEL_ID": "qwen/qwen3.8-27b:free",
|
|
|
|
|
|
|
| 44 |
}
|
| 45 |
|
| 46 |
failures = []
|
| 47 |
|
| 48 |
+
# ---------- 1. model_ids.py: add the constants ----------
|
| 49 |
with open(IDS_FILE) as f:
|
| 50 |
ids = f.read()
|
| 51 |
|
|
|
|
| 79 |
else:
|
| 80 |
new_imports = "".join(f" {name},\n" for name in missing_imports)
|
| 81 |
import_anchor = " LIQUID_LFM_2_5_2_6B_FREE_MODEL_ID,\n"
|
| 82 |
+
if import_anchor not in import_anchor_holder:
|
| 83 |
+
pass
|
| 84 |
if import_anchor not in agent:
|
| 85 |
import_anchor = " LING_3_0_FLASH_FREE_MODEL_ID,\n"
|
| 86 |
if import_anchor not in agent:
|
|
|
|
| 127 |
if agent.count(f" {name},\n") != 1:
|
| 128 |
failures.append(f"duplicate/missing import {name}")
|
| 129 |
|
| 130 |
+
# Guard: the two non-chat / non-existent ids must never reappear.
|
| 131 |
+
for dead_id, dead_const in (
|
| 132 |
+
("inclusionai/ming-image-0.1-design", "MING_IMAGE_0_1_DESIGN_MODEL_ID"),
|
| 133 |
+
("respan/span-01-lite", "SPAN_01_LITE_MODEL_ID"),
|
| 134 |
+
):
|
| 135 |
+
if dead_id in ids or dead_const in agent:
|
| 136 |
+
failures.append(f"unsupported model leaked back in: {dead_id}")
|
| 137 |
+
print(f"FAIL: unsupported model present: {dead_id}")
|
| 138 |
+
|
| 139 |
if failures:
|
| 140 |
for msg in failures:
|
| 141 |
print(f"FAIL: {msg}")
|
|
|
|
| 146 |
f.write(agent)
|
| 147 |
print("OK: agent.py written & syntax valid")
|
| 148 |
print("OK: exactly one constant + import + list entry per new model")
|
| 149 |
+
print("DONE: 2 new chat models registered (backend)")
|