Skip to content

Fill in missing model metadata from a preset catalog - #47

Merged
noti0na1 merged 2 commits into
lampepfl:mainfrom
Linyxus:atc-thinking-mapping
Dec 5, 2026
Merged

noti0na1 merged 2 commits into
lampepfl:mainfrom
Linyxus:atc-thinking-mapping

Conversation

@Linyxus

@Linyxus Linyxus commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Some providers report almost nothing about the models they list. Z.ai's list carries display names and no capabilities at all, which left a listed GLM model with no context window — so nothing was ever compacted or trimmed — and with the full five-level effort ladder of its protocol whether or not it took those levels.

This adds a preset catalog that fills in what a provider leaves out.

The catalog

app/resources/atc/models.json ships with the release; a user's own ~/.atc/models.json is layered over it. An entry matches models and supplies metadata for them:

{ "match": { "name": "glm-5\\.4" },
  "metadata": { "contextWindow": "1m", "efforts": ["low", "high", "max"] } }

name is a regex matched against the whole model id, ignoring case; an id listed under a vendor prefix (OpenRouter's z-ai/glm-5.4) is also tried without it, so no entry spells the prefix out.

Every shipped entry names a model and nothing else, so one model has one description wherever it is served — a test holds the catalog to that. provider and api can narrow an entry to one provider of the config or one wire protocol; those are there for a user's own models.json, where one provider is often exactly what needs correcting.

Only fields that describe a model (contextWindow, displayName) or constrain what the user may choose (efforts, thinking) are ever applied. A catalog never sets a choice the user owns, such as reasoning or webSearch, and never maxTokens, which would be sent with every request and reserved from the window rather than describing the model.

Translated from all 575 of ZCode's rules

The source states its rules in five tiers. Every rule in every tier is accounted for:

tier rules state a fact ATC can express state nothing it can
modelRules 84 78 5 unexpressible, 1 catch-all
modelApiRules 74 2 69 unexpressible, 3 catch-all
providerSiteRules 58 27 31 unexpressible
templateModelRules 321 62 259 unexpressible
builtinProviderModelRules 38 0 38 enabled only
total 575 169 406

A rule states nothing ATC can express when it carries only enabled (membership or entitlement, which a catalog must not decide), only a request-body mapping (reasoningLevel.map), or only capabilities ModelConfig has no field for: inputFormat modalities, supportsToolCall, supportsJsonSchemaOutput, supportsNativeWebSearch, supportsMidConversationSystem. Holding those would need new ModelConfig fields and is out of scope here. The one catch-all per tier would describe every model and is deliberately dropped.

Those 169 rules collapse into 115 entries covering GLM, GPT, Claude, Grok, Kimi and Moonshot, MiniMax, DeepSeek, Qwen, MiMo, Doubao, StepFun, Hunyuan and CodeGeeX.

Collapsing the scopes

ZCode states some facts per address, because a vendor, OpenRouter and OpenCode Zen serve the same model with different limits. Dropping that scope needs a policy:

  • A fact ZCode states about the model itself wins. An address or a gateway listing may only fill a field no such rule gives — a gateway that lists GLM-5.3 with one effort level is describing its listing, not the model. 56 fields were overridden this way.
  • Where only addresses state a field, the value the most of them agree on wins, except a context window, where the smallest does: overestimating a window makes a request fail at the provider, while underestimating it only compacts earlier.
  • A tie on effort levels goes to the longer list: a level the model does not take is ignored, a level the catalog hides cannot be asked for at all.

Resolved against ZCode's own per-route resolution over all 321 (model, route) pairs it lists, comparing window, effort levels and thinking switch:

count
pairs identical on all three fields 265 of 321
fields now described where a route-scoped catalog said nothing 52
fields resolved to a different value by the policy above 17
fields described by ZCode and no longer described here 0
fields contradicting what ZCode says about the model itself 0

The 17 are all gateway-listing quirks: OpenCode Zen listing Kimi-K3 with ["max"] alone against the vendor's three levels, SiliconFlow rounding a 1,000,000 window to 1,048,576, and the like.

gpt-* and claude-* entries deliberately carry no thinking: that parameter means a different thing on each protocol and OpenAI rejects it outright.

Precedence

What a provider reports wins over the catalog, and what the user configures wins over both — field by field, so the catalog only fills gaps. Within the catalog every matching entry merges, the more specific winning each field. Specificity is computed, not taken from the order entries are written in: provider beats api, which beats none, and between two of the same scope the name spelling out more of the id wins. A user entry outranks every shipped entry whatever either one's specificity, and "only": true replaces rather than refines.

Presets apply as a model leaves ModelCatalog and never before a provider's list is stored, so ~/.atc/model-lists.json holds only what the provider itself said. A corrected preset takes effect at once instead of staying frozen in an earlier session's cache; ModelPresetsSuite asserts this by inspecting the stored file.

A correction about Z.ai

The development guide claimed GLM ignores output_config.effort and that /effort changes nothing. That was wrong. Z.ai does honor it, translating to GLM's own reasoning_effort — but it validates nothing, so an effort GLM does not take is accepted and silently treated as the default. GLM-5.4, GLM-5.3 and GLM-5.3-Flash take low, high and max only, which meant /effort medium looked as though it had worked.

Measured against the live endpoint, thinking-block length as the proxy, interleaved rounds, n=5:

effort sent thinking chars (sorted) median
low 0, 59, 66, 66, 79 66
nothing 86, 87, 88, 90, 151 88
max 118, 151, 155, 157, 175 155

low and max are disjoint. The three levels also match Z.ai's docs, and the 1M/128K figures match the GLM-5.4 page.

GLM-5.4 and GLM-5.3 additionally cannot stop thinking at all (thinking.type takes only enabled), so the thinking: {"type": "disabled"} that calls asking for no thinking send is accepted and ignored.

Notes

  • Windows such as 131072 are written literally rather than as "128k", since Tokens parses k as decimal 1000.
  • 28 tests in ModelPresetsSuite, including one pinning a model id per vendor family, one pinning thirteen context windows, and one holding every shipped entry to naming a model alone, so a future regeneration cannot quietly drop coverage or reintroduce an endpoint scope.
  • checkFormat, app.test (208/208), dist and tests/atc_test.sh (422) all green.

🤖 Generated with Claude Code

@Linyxus
Linyxus force-pushed the atc-thinking-mapping branch 3 times, most recently from 220e243 to eef392a Compare December 5, 2026 18:05
Some providers report almost nothing about the models they list. Z.ai's
list carries display names and no capabilities at all, which left a GLM
model with no context window, so nothing was ever compacted or trimmed,
and with the full five-level effort ladder of its protocol whether or not
it took those levels.

`app/resources/atc/models.json` describes the models that need it, and a
user's own `~/.atc/models.json` is layered over it. An entry matches on a
model-id pattern, optionally narrowed to one provider, one wire protocol
or one address, and supplies metadata for it:

    { "match": { "name": "glm-5\\.4" },
      "metadata": { "contextWindow": "1m",
                    "efforts": ["low", "high", "max"] } }

Only fields that describe a model or constrain what the user may choose
are ever applied; a catalog never sets a choice the user owns, such as
`reasoning`, nor `maxTokens`, which would be sent with every request.
What a provider reports wins over the catalog and what the user
configures wins over both, field by field, and every matching entry
merges with the more specific winning each field. Specificity is
computed rather than taken from the order entries are written in.

Presets apply as a model leaves `ModelCatalog` and never before a
provider's list is stored, so `~/.atc/model-lists.json` keeps only what
the provider itself said and a corrected preset takes effect at once
instead of staying frozen in an earlier session's cache.

The catalog is translated from all 575 of ZCode's model-config rules:
169 entries, of which 80 describe a model wherever it is served and 89
describe one behind a single address. 169 of those rules carried a
context window or a set of effort levels; the remaining 406 carry only
membership (`enabled`), request-body mappings, or capabilities ATC's
`ModelConfig` has no field for, and one is a catch-all that would have
described every model on earth. A fact stated for one route stays scoped
to it: ZCode tells `GLM-5.3` on Z.ai apart from `glm-5.3` on OpenRouter
by the case of the id alone, which a case-insensitive pattern cannot, and
the address draws the same distinction without relying on case. Resolving
every model against every route ZCode lists agrees with ZCode's own
resolution on all 321 pairs.

Z.ai in fact honors `output_config.effort`, translating it to GLM's own
`reasoning_effort`, but validates nothing: an effort GLM does not take is
accepted and silently treated as the default. GLM-5.4, GLM-5.3 and
GLM-5.3-Flash take `low`, `high` and `max` only, so `/effort medium`
looked as though it had worked. The development guide said effort was
ignored outright, which was wrong, and is corrected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Linyxus
Linyxus force-pushed the atc-thinking-mapping branch from eef392a to 61f6486 Compare December 5, 2026 18:27
The shipped catalog carried 89 entries scoped to a single gateway address,
because ZCode states some facts per route: a vendor, OpenRouter and OpenCode
Zen serve the same model with different limits. That made the catalog a map of
endpoints as much as of models, and left a model known only through one gateway
undescribed everywhere else.

Re-derive it from ZCode's rules with every scope collapsed, so an entry names a
model and nothing else. Of the source's 575 rules, 169 state a context window,
an effort ladder or a thinking switch; the other 406 set only `enabled`, map
request fields, or describe capabilities ModelConfig has no field for. Those
169 collapse into 115 entries by this policy:

  * A fact stated about the model itself wins; an address or a gateway listing
    may only fill a field no such rule gives. A gateway that lists GLM-5.3 with
    one effort level is describing its listing, not the model.
  * Where only addresses state a field, the value the most of them agree on
    wins -- except a context window, where the smallest does, since
    overestimating one makes a request fail at the provider while
    underestimating it only compacts earlier. A tie on effort levels goes to
    the longer list: a level the model does not take is ignored, a level the
    catalog hides cannot be asked for at all.

Checked against ZCode's own resolution over all 321 (model, route) pairs: 265
identical on window, efforts and thinking, 52 fields now described where a
route-scoped catalog said nothing, 17 resolved to a different value by the
policy above, none lost. No entry contradicts a vendor-level fact.

`baseUrl` goes with the rows that needed it; `provider` and `api` stay for a
user's own models.json, where one provider is often what needs correcting.
MiniMax-M2.7 gains its thinking switch, which only a gateway had stated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@noti0na1
noti0na1 merged commit db64878 into lampepfl:main Dec 5, 2026
7 checks passed
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.

2 participants