Repository navigation
Fill in missing model metadata from a preset catalog - #47
Merged
Merged
Conversation
Linyxus
force-pushed
the
atc-thinking-mapping
branch
3 times, most recently
from
December 5, 2026 18:05
220e243 to
eef392a
Compare
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
force-pushed
the
atc-thinking-mapping
branch
from
December 5, 2026 18:27
eef392a to
61f6486
Compare
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.jsonships with the release; a user's own~/.atc/models.jsonis layered over it. An entry matches models and supplies metadata for them:{ "match": { "name": "glm-5\\.4" }, "metadata": { "contextWindow": "1m", "efforts": ["low", "high", "max"] } }nameis a regex matched against the whole model id, ignoring case; an id listed under a vendor prefix (OpenRouter'sz-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.
providerandapican narrow an entry to one provider of the config or one wire protocol; those are there for a user's ownmodels.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 asreasoningorwebSearch, and nevermaxTokens, 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:
modelRulesmodelApiRulesproviderSiteRulestemplateModelRulesbuiltinProviderModelRulesenabledonlyA 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 capabilitiesModelConfighas no field for:inputFormatmodalities,supportsToolCall,supportsJsonSchemaOutput,supportsNativeWebSearch,supportsMidConversationSystem. Holding those would need newModelConfigfields 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:
Resolved against ZCode's own per-route resolution over all 321 (model, route) pairs it lists, comparing window, effort levels and thinking switch:
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-*andclaude-*entries deliberately carry nothinking: 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
namespelling out more of the id wins. A user entry outranks every shipped entry whatever either one's specificity, and"only": truereplaces rather than refines.Presets apply as a model leaves
ModelCatalogand never before a provider's list is stored, so~/.atc/model-lists.jsonholds only what the provider itself said. A corrected preset takes effect at once instead of staying frozen in an earlier session's cache;ModelPresetsSuiteasserts this by inspecting the stored file.A correction about Z.ai
The development guide claimed GLM ignores
output_config.effortand that/effortchanges nothing. That was wrong. Z.ai does honor it, translating to GLM's ownreasoning_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 takelow,highandmaxonly, which meant/effort mediumlooked as though it had worked.Measured against the live endpoint, thinking-block length as the proxy, interleaved rounds, n=5:
lowmaxlowandmaxare 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.typetakes onlyenabled), so thethinking: {"type": "disabled"}that calls asking for no thinking send is accepted and ignored.Notes
131072are written literally rather than as"128k", sinceTokensparseskas decimal 1000.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),distandtests/atc_test.sh(422) all green.🤖 Generated with Claude Code