Skip to content

feat(models): route normal to GLM 5.3 Flash, complex to gpt-5.4 - #268

Open
winlp4ever wants to merge 4 commits into
mainfrom
feat/model-routing-glm-5-3
Open

feat(models): route normal to GLM 5.3 Flash, complex to gpt-5.4#268
winlp4ever wants to merge 4 commits into
mainfrom
feat/model-routing-glm-5-3

Conversation

@winlp4ever

Copy link
Copy Markdown
Contributor

What

Auto model routing (model: "auto" on /ai/* and the server agent) had drifted: it resolves to the first model of a tier in models.yml order with a present provider key, which today meant normal complexity used gpt-5.4-mini and complex used gpt-5.5. This restores the intended routing:

  • normal (lite) -> GLM 5.3 Flash (OpenRouter, nitro) - newer generation, ~6x cheaper than GLM 5.2 and stronger on agent/coding benches; cheap enough to also back the complexity classifier (which reuses the lite default).
  • complex (pro) -> gpt-5.4 - best ceiling on hard multi-step reasoning (GLM 5.3 full is close and cheaper, but gpt-5.4 leads on absolute capability).

How

Config-only, via catalog order (the resolver picks the first reachable model of a tier):

  • Add glm-5.3-flash (tier lite) as the first llm entry.
  • Make gpt-5.4 the first pro entry.
  • Replace glm-5.2 with glm-5.3 (pro; a high-value picker / pro fallback) and drop glm-5.1.

No code change to the classifier or the two auto paths - they already read default_resolved("lite" | "pro").

BYOK fallback (free, from the resolver)

  • GLM 5.3 Flash is OpenRouter-only, so with no OpenRouter key the lite default falls through to gpt-5.4-mini.
  • gpt-5.4 has both an OpenAI and an OpenRouter route, so complex resolves for either key.

Test plan

  • ruff check topix test/unit: clean
  • pytest test/unit: 704 passed (bumped the glm-5.2 example refs in test_catalog to glm-5.3; integrity + tier-default tests already pass structurally)

Follow-up (not in this PR)

The auto_model.py classifier logs a full traceback when the message list doesn't end with a user turn (tool-loop continuations). It falls back to medium safely; the noise fix is a separate change.

Auto routing picks the first model of a tier in models.yml order whose provider
key is present, so the tier defaults had drifted to gpt-5.4-mini (normal) and
gpt-5.5 (complex). Restore the intended routing via catalog order:

- Add glm-5.3-flash (lite) as the first entry so normal complexity resolves to
  GLM 5.3 Flash on OpenRouter (also backs the complexity classifier). It's
  OpenRouter-only, so without an OpenRouter key lite falls through to gpt-5.4-mini.
- Make gpt-5.4 the first pro entry so complex resolves to it (native OpenAI, or
  its OpenRouter route for OpenRouter-only keys).
- Replace glm-5.2 with glm-5.3 (pro, picker / pro fallback) and drop glm-5.1.

Config-only: the classifier and both auto paths already read
default_resolved("lite"|"pro"). Bump the glm-5.2 example refs in test_catalog to
glm-5.3.
Placing glm-5.3-flash as the first catalog entry made default_resolved(None)
(the no-tier fallback for unreachable configured models) resolve to a lite model
instead of a pro one. Make gpt-5.4 the first entry so the no-tier fallback stays
strong, and move glm-5.3-flash to be the first lite entry (still the normal/base
default). Also refresh the stale glm-5.2 examples in model_enum to glm-5.3.
The blank-field BYOK fallback for OpenRouter was openai/gpt-5.4; point it at
z-ai/glm-5.3-flash:nitro so a signed-out OpenRouter BYOK user who doesn't pick a
model lands on the same base model the managed path uses. OpenAI stays gpt-5.4.
Update the matching model-field placeholder to match.
winlp4ever added a commit that referenced this pull request Sep 4, 2026
…s-120b (#272)

* feat(models): route normal to DeepSeek V4 Flash, classifier to gpt-oss-120b

Alternative to the GLM base (#268), which regressed: GLM 5.3 Flash via OpenRouter
did not emit real tool_calls and was too slow for the 2s classifier timeout.

- Make deepseek-v4-flash the first lite entry so normal complexity resolves to it
  on OpenRouter (falls through to gpt-5.4-mini with no OpenRouter key). It tests
  clean for tool calling.
- Pin the complexity classifier to gpt-oss-120b (cheap, fast, native structured
  output) via a new catalog.resolved_by_id, decoupled from the base model. Bump
  AUTO_MODEL_TIMEOUT_SECONDS 2 -> 5 for OpenRouter first-token latency headroom.
- gpt-5.5 stays first overall, so the no-tier fallback and the complex/pro default
  are unchanged (5.5 > 5.4).

* fix(models): give gpt-oss-120b the :nitro throughput route

gpt-oss is OpenAI-branded but open-weight and multi-provider on OpenRouter, so
:nitro routes the classifier to the fastest provider (it isn't single-provider
like proprietary openai/* models). Refine the nitro-rule tests to treat gpt-oss
as multi-provider so it requires :nitro rather than forbidding it.

* fix(agent): tighten classifier timeout to 3s on the hot path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant