opencode: label models with the catalog title, not the slug

/models showed "qwen3.8-27b (Local)" where the catalog already has a name
meant for reading: "Qwen3.8 27B". The dict key stays the slug -- that is the
model id the API answers to -- so only the display name changes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Neil Bantoc 2026-11-02 23:52:31 -08:00
parent 504ea3018a
commit 13a7def080

View file

@ -74,7 +74,9 @@ def key_ref(key_path):
def provider_block(cfg, host, key_path, label): def provider_block(cfg, host, key_path, label):
models = {} models = {}
for m in cfg["models"]: for m in cfg["models"]:
entry = {"name": f"{m['name']} ({label})", "tool_call": True, # Key by the slug -- that's the model id the API answers to -- but show the
# catalog's title, which is what reads well in opencode's /models list.
entry = {"name": f"{m.get('title') or m['name']} ({label})", "tool_call": True,
"limit": {"context": m["est_context"], "output": min(65536, m["est_context"] // 2)}} "limit": {"context": m["est_context"], "output": min(65536, m["est_context"] // 2)}}
if m.get("reasoning"): if m.get("reasoning"):
entry["reasoning"] = True entry["reasoning"] = True