A Trae model's rate (and the rate before a discount) now comes from its
list entry's display_contact_config: consumption_rate when enabled, the
member discount's consumption_rate when that discount is enabled, and an
off-peak activity's after/before price by its time_windows in its own
time zone, computed when the list is read. A field that throws (an
unknown time_zone) costs that model its rate only; the rest of the live
list stays. Fixtures are the reporter's literal display_contact_config
strings from batch_get_detail_param.
Run at the reviewed head f47880ff on mote:
- bun test packages/trae: 234 pass, 0 fail.
- Broken by hand: making traeRateOf's outer catch rethrow turns "a broken
time zone costs that model its rate only, not the list" red (1 fail).
- Real samples probed under TZ=UTC and TZ=America/Los_Angeles: deepseek
0.06/was 0.12 at 08:59, 12:30, 18:00 weekdays and all weekend
(Asia/Shanghai), 0.12 at 09:00 and 14:00; glm-5.3 0.58/was 0.78; a
Bogus/Zone entry gives 0.12; missing, bad JSON, null and arrays give
nothing.
Not tried: a real Trae account through magpie. The rate is computed when
the host reads the list, so it can lag a window edge until the next read.
Every chat function's roster is read, so each model's reasoning levels come from Trae's own config, and a model keeps its levels in magpie and in plain OpenCode (#300, sphuang1030-prog).
- A model in the fallback table keeps the levels its entry names, even though the host hands every model `variants: {}`.
- A variant's value is OpenCode's name (low/high/xhigh); effortOf takes either spelling and sends Trae's (light/high/extra_high), and nothing for a level the model doesn't name.
- The token-keyed record check that never fired is gone; the host's strict refresh reads the list again after a re-sign-in.
Reviewed at 4b968adb: bun test in packages/trae (temp HOME/TMPDIR) 203 pass / 0 fail on bun 1.4.2; bun scripts/check.mjs exit 0. The three new tests go red on the previous head 41904d9. Probes through the loader's fetch: low→light, high→high, xhigh→extra_high; medium/__proto__ send nothing; glm-5.2 fallback gives high, xhigh (was []). merge-tree against main clean; npm latest trae 0.2.19.
Not tried: a real Trae account; OpenCode's own source (whether it fills default variants first).
magpie's host builds a provider's models from the plugin's config first
(internal/plugin/host.js: the config's flat fields are spread into
capabilities), then lets the provider.models hook replace the list. The
hook handed back each model without capabilities, and magpie reads
capabilities.reasoning alone for a model a plugin lists, so every model
the site's fallback table doesn't have was listed as one that doesn't
reason. On Trae CN that was every model but the table's six; on Trae
Global every model but its five. A routing group with one of them in it
lost reasoning for the whole group (magpie's groups take a member that
thinks), and the agent turned thinking off for it.
modelOf now gives each model it builds capabilities: the fallback table's
own where it has an entry, else MODEL's flat fields (reasoning,
temperature, tool_call, the input modalities) with an empty variants, as
Trae's request takes no effort or thinking level. The Max twin takes them
through the same path.
packages/trae/models.test.mjs (5 tests) fails without the change:
capabilities.reasoning is undefined for deepseek-v4-flash-0731-max, for
the whole list, and for the Max twin; the fallback table's own entry and
Trae Global's models pass either way. bun test packages/trae: 79 pass.
bun scripts/check.mjs: every package ok. The whole suite has the same 40
failures before and after (Windows-only, other packages).