"""The models this harness offers, and what is true about each one. Kept as data rather than fetched at boot: the Space must come up and be usable when huggingface.co is slow or down, and a model list that sometimes appears is worse than one that is occasionally a day stale. `insight.py` fetches the live provider mapping on demand, for the panel that exists to show exactly that. """ from __future__ import annotations from dataclasses import asdict, dataclass, field @dataclass(frozen=True) class Model: id: str label: str vendor: str providers: list[str] = field(default_factory=list) reasoning: bool = False context_tokens: int | None = None note: str = "" def to_json(self) -> dict: d = asdict(self) d["contextTokens"] = d.pop("context_tokens") return d # Verified live on the HF router on 2026-08-28. `providers` is the routing # order reported by the hub, not a preference of ours. MODELS: tuple[Model, ...] = ( Model( id="zai-org/GLM-5.3", label="GLM-5.3", vendor="Z.ai", providers=["zai-org", "baseten"], reasoning=True, context_tokens=200_000, note="Released 2026-08-28. Emits a separate reasoning stream and " "defaults to maximum thinking budget.", ), Model( id="zai-org/GLM-5.3-Flash", label="GLM-5.3 Flash", vendor="Z.ai", providers=["novita", "together", "fireworks-ai", "zai-org", "baseten"], reasoning=True, context_tokens=200_000, note="The small sibling. Useful for checking whether a slow answer is " "the model or the route.", ), Model( id="deepseek-ai/DeepSeek-V4-Pro-0813", label="DeepSeek V4 Pro", vendor="DeepSeek", providers=["novita", "together", "fireworks-ai", "baseten", "deepinfra"], reasoning=True, context_tokens=163_840, note="The comparison model: the latest DeepSeek as of 2026-08-13.", ), Model( id="deepseek-ai/DeepSeek-V4-Flash-0731", label="DeepSeek V4 Flash", vendor="DeepSeek", providers=["novita", "together", "fireworks-ai", "baseten", "deepinfra"], reasoning=True, context_tokens=163_840, note="Fast DeepSeek, for a like-for-like against GLM-5.3 Flash.", ), ) DEFAULT_MODEL = "zai-org/GLM-5.3" _BY_ID = {m.id: m for m in MODELS} def get(model_id: str) -> Model | None: return _BY_ID.get(model_id) def is_allowed(model_id: str) -> bool: """Model ids arrive from the browser and are pasted into an upstream URL.""" return model_id in _BY_ID