1ccacad63281094de8a3372d5a507d38f9969e5c
150
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
2b825f69da |
catalog: the loaded catalog goes after two idle minutes, and the shipped copy is not kept unpacked
An idle magpie's heap (real-account copy, 600s idle on mote, t58) held two copies of models.dev's catalog for the life of the process: - the shipped copy, unpacked by Seed at start into a sync.OnceValue: 5.7 MB of io.ReadAll, though Seed has nothing to write once a newer catalog file is there, and nothing else reads it then; - the parsed catalog (loadGen, ~6.7 MB with its votes and indexes), loaded at start and by dsh's five-minutely rebuild. Seed now looks at the file before unpacking, and the copy is unpacked for each call and kept by no one. The loaded catalog, with what is built and indexed of it, is let go once nothing has read it for two minutes (load_idle.go, like the sessions' cacheIdle). The next read parses the same file again. Forget is not told: the provider package's lists stay right, since a changed file is Reset by whoever wrote it. TestIdleCatalogLetGoAndReadAgain and TestSeedUnpacksNothingOverANewerCatalog are red with dropIdleLoad returning false and with Seed unpacking first (broken by hand in a copy). TestListedByReadsAnIndex is red under -race at the base too (#6023). |
||
|
|
7e1858515b |
remote magpie: name its models by the provider serving them there (lcc580 on X)
lcc580 asked for a pass-through on the Remote magpie provider: show the
upstream magpie's own provider beside each model, so an agent can tell the
same model from two of its providers apart. Before, the names followed
both magpies' Provider in model names: with either one Off, both relays'
DeepSeek Chat reached the agents as "DeepSeek Chat · Office" (or plain
"DeepSeek Chat").
- The list a magpie gives another magpie (X-Magpie-Drawers) now names,
as magpie_by, the provider serving each model there (Entry.ServedBy):
"routing group" for a group, and for a model of its own Remote magpie
the provider at the start of that chain. The fetch keeps it as the
model's By (catalog/live.go).
- A Remote magpie provider gets upstreamProviders: the editor's "Model
names" tick ("With the provider serving it there"), or
`magpie provider set <id> upstream-providers=on`. With it on, each of
its models is labelled "DeepSeek Chat · Office › Relay A" in every
agent's list, whatever either magpie's Provider in model names says,
unless the user named the model themselves under Own
(Entry.Label/upstream, LabelsFor). Model settings' "Agents' lists show"
line follows the tick at once.
- Ids are unchanged, so a request still goes by office/relay-b/model.
Off (the default) names everything as before. A remote older than
magpie_by has nothing to add, so its names stay as before.
- The core's scripts stay in budget: four long comments in app.js were
cut to pay for it, no raise.
Run:
- Tests that fail on the old code: TestRemoteMagpieUpstreamNames
(gateway: an httptest remote with two relays' DeepSeek Chat and a
group, every Provider in model names mode, on and off, the third
magpie's magpie_by, ids kept), TestServedByAndUpstreamLabel (provider),
and name-suffix-remote.test.cjs's new case (tick, hint, save body).
- Broken by hand: upstream() returning "" and the magpie_by line removed;
both Go tests went red with the plain labels, then restored.
- Two real gateways, built -tags nogui on the Linux box (WSL) under
sandbox HOMEs: B with Relay A and Relay B both serving deepseek-chat,
A with B as Remote magpie "Office". A's /v1/models before:
"DeepSeek Chat · Relay A · Office"; after
`provider set office upstream-providers=on`:
"DeepSeek Chat · Office › Relay A" / "› Relay B" / "› routing group".
A request for office/relay-b/deepseek-chat reached relay-b on B.
- gofmt -l clean; go vet darwin, linux (nogui), windows on the touched
packages; go test catalog, provider, gateway, cli, gui on mote
(macOS) at the rebased head: ok (catalog 2.6s, provider 165s, gateway 948s, cli 56s, gui 149s).
- GUI on mote, chromium and webkit: name-suffix-remote, remote-magpie,
remote-self, i18n-keys, i18n-en-no-cjk, gui-ja, gui-de, gui-zh-tw,
provider-detect-draft, provider-unmasked, routing-remote-windows,
usage-remote-cards: all green except reds that fail the same on origin/main
|
||
|
|
71075af726 |
codex: "subagents on any model" tells Codex V1 for a relay of the ChatGPT backend too (brethhbbm on X)
brethhbbm on X: lead on relay/gpt-6-astra, subagent model set to
relay/gpt-6.1-terra, "Codex subagents on any model" on. A new session's
subagents still ran on Astra, and Routing said the task was sealed and
only a ChatGPT account could read it. The model's catalog entry still
said multi_agent_version "v2".
Cause: the setting (settings.CodexAgentsV1) stamped V1 only on the
ChatGPT account's own models (codex/) and the groups one is in (Fast).
The relay lists Codex's own entry for gpt-6-astra (a sub2api asked with
Codex's client_version), "v2" included, and a relay offering Ultra is
given "v2" (AgentsV2) besides. In V2 Codex hands the lead the
collaboration namespace (spawn_agent etc.), whose arguments a relay of
the ChatGPT backend seals as the backend does (#1109), so
codexSubagentPick kept the subagent on the lead's model (sealedKept).
Fix: catalog.Model.Seals (provider.CodexSeals) marks a model whose
provider is of no sign-in on the Responses API, as the gateway's
canSeal, or a group with such a member. With the setting on, its entry
says V1 like the ChatGPT account's, listed by its relay or made by
magpie, so the task goes as text and the model set for subagents takes
it. Seals is in the list's tag, so Codex asks for the list again. A
model of an account that seals nothing (Copilot's Ultra, #656) keeps
V2, and with the setting off every entry is as before. No prompt text
or instructions change.
Real Codex (0.165.0, sandbox HOME/CODEX_HOME, fake Responses server,
model_catalog_json with the user's gpt-6-astra entry as
relay/gpt-6-astra): with "v2" the first request carries the
collaboration namespace (spawn_agent, send_message, followup_task,
wait_agent, ...); with "v1" it has none.
Run (Linux box via wsl-run; mote refused SSH for the whole session):
- go vet -tags nogui (linux), GOOS=windows go vet, GOOS=darwin
CGO_ENABLED=0 go vet -tags nogui on codexcat, provider, agent,
catalog, settings: ok; gofmt -l clean
- go test -tags nogui -count=1 ./internal/codexcat ./internal/catalog
./internal/settings ./internal/provider: ok
- ./internal/agent, and -run 'Codex|Ultra|Subagent|Sealed|Collab|AgentsV1'
./internal/gateway, were still running when this was pushed; their
results go on the release's issue thread if red
- at the pushed head (rebased on
|
||
|
|
4011873001 |
catalog: models.dev unreachable falls back to the last copy or a shipped one, retried in minutes (creeksuen on X)
Where models.dev can't be reached (a network in China), the catalog that gives prices, context windows, reasoning levels and names degraded: - first run: no catalog file, so every model unpriced, no windows, and a plugin's provider listed no models, until a fetch got through; - a failed fetch: KeepFresh tried again only after an hour, and the app's backend waited up to 30s on models.dev before it asked the vendors for their lists; - Sync wrote models.json in place (os.WriteFile), so a reader could catch it half written, and a parse failure left no catalog at all. Now: - Sync writes the catalog through a temp file renamed over it (writeWhole, shared with labs.json). A refused, hanging or wrong answer (HTML, cut-off JSON) keeps the last good copy byte for byte. - The binary ships models.dev's api.json of 2026-11-10 (internal/catalog/bundled/api.json.gz, 608KB; go:generate refreshes it). loadGen reads magpie's copy, then OpenCode's, then the shipped one, passing over one it can't parse. Seed (app backend, magpie serve, the plugin host) writes the shipped copy into the cache when there is none or it is older, dated bundledAt, so the plugin host reads it and Stale still has the real one fetched. A test binary has it off (bundledOn). - The app's backend no longer waits on models.dev before the vendors' lists when a catalog is there; KeepFresh fetches beside them, and a failed fetch is tried again after 2 minutes, doubling up to the hour. - The fetch already goes through http.DefaultClient, which netproxy.Install routes through the proxy in Settings, *_PROXY or the system proxy; there is no models.dev mirror setting to honour. Run (mote, at the rebased head unless said): - gofmt -l: clean. go vet darwin (catalog, plugin, cli, gui), linux -tags nogui and windows: ok. - go test ./internal/catalog: ok at the rebased head; ./internal/plugin, ./internal/gui, ./internal/cli: ok at the pre-rebase head but for TestEveryRouteHasACommandOrIsNamed, red at that older base (a GUI route this change doesn't touch) and ok at the rebased head. - New tests, each fake models.dev on 127.0.0.1 (cut connection, hang, captive-portal HTML, cut-off JSON): TestFailedSyncKeepsLastGood, TestFirstRunOfflineAnswersFromShippedCopy, TestUnreadableCacheFallsBackToShippedCopy, TestSeed, TestSyncWritesThroughRename, TestFailedFetchRetriedSoon. - Windows (win-run): the catalog tests ok, 15 of 15 with -count=15; TestSyncWritesThroughRename skips there (it holds the file open). Broken by hand, each red: Sync back to os.WriteFile (TestSyncWritesThroughRename); load without the shipped copy (TestFirstRunOffline…, TestUnreadableCache…); Seed over a newer catalog and Seed dated now (TestSeed); first retry after the hour (TestFailedFetchRetriedSoon). Not tried: the real app started with models.dev blocked; the full suite (started after the tag). |
||
|
|
617200a320 |
providers: Vercel AI Gateway is a preset (Archie627 on X)
Archie627 said magpie has no Vercel AI Gateway. It is now a preset in Add: Chat Completions and Responses at https://ai-gateway.vercel.sh/v1, Anthropic Messages at https://ai-gateway.vercel.sh (Vercel takes the key as Bearer there too), models.dev's "vercel" catalog, the vercel icon the vercel-jev decision preset already used, and its API keys page. An OpenCode or URL import at that host becomes the preset. READMEs and the site's import pages (en, zh, ja) list it. Its /v1/models (public, 505 rows today) marks each row's "type". Read as before, the decision models (liquid/d1, typesafe-ai/jev) and realtime voices showed as chat models, ElevenLabs voices were dropped, and transcribers (elevenlabs/scribe-v2) showed as chat. At Vercel's host alone (catalog.VercelGateway) the type now decides: evaluation and realtime rows are left out, speech, transcription, embedding and reranking rows get their Serves, image rows draw and video rows film. The 48 "-batch" ids are left out: Vercel's docs say "Synchronous requests don't accept -batch IDs". context_window gives the window. Another host's "type" is read as before. Run: TestVercelPreset and TestVercelLiveList (real rows from Vercel's list in testdata, served through an httptest server, no network); go test ./internal/catalog ./internal/provider on Linux (wsl-run) and macOS (mote, -run Vercel|Preset|Import before mote stopped taking SSH); gofmt; go vet linux, windows, darwin (CGO off). Broken by hand: VercelGateway returning false turns TestVercelLiveList red (decision, realtime, batch and transcriber rows back in chat); the -batch skip alone turned off turns it red too. Not tried: no Vercel key, so no real chat, Responses or Messages call; only the public GET /v1/models. No GUI file reads the preset list by name (the Add sheet is built from /api/presets), so no GUI run. |
||
|
|
2fbead7983 |
provider: a relay URL typed without its /v1 (CRS's …/openai) is tested, detected and listed under it (Cyrus_4433 on X)
Cyrus_4433 added a claude-relay-service provider as OpenAI compatible at
http://<ip>:55088/openai. The list couldn't be fetched and Test models
said "gpt-6.1-sol: 404 · Not Found". From CRS's src/app.js and routes:
/openai mounts unifiedRoutes (POST /v1/chat/completions) and
openaiRoutes (/responses, /v1/responses); /api mounts GET /v1/models.
There is no /openai/chat/completions or /openai/models, and anything
unrouted is 404 {"error":"Not Found",...}. magpie asked base +
/chat/completions, i.e. /openai/chat/completions.
- probe: a Chat/Responses 404 at an unversioned base equal to the
provider's URL is asked once more at base/v1/... (missingV1; not
accounts, Azure, Bedrock, Vertex). Answered OK there, the saved URL
takes /v1 (setV1) and the result carries it (Result.V1); Detect uses
it as the base; the editor's URL field follows (draft.onV1) so Save
doesn't undo it. A 404 at both stays the first 404.
- catalog: an unversioned …/openai base is also listed at
<origin>/api/v1/models (RelayOpenAIList), and fixV1 adds /v1 when the
list answered there.
Run (WSL magpie-desktop via wsl-run; mote's sshd reset every
connection this session):
- at 630b0de98 (this change on
|
||
|
|
c4a5424667 |
claude: Fetch models fetches models.dev's list first when it is old, so Fable 5.2 shows (hhdaxia on X)
hhdaxia on X (magpie 0.1.3504, Linux): the Claude subscription's Models editor, "vendor list · just now" after Fetch models again, lists Fable 5.1 and the 5.5s but not Fable 5.2, which Claude Code's own /model has. Cause: a Claude account's list is models.dev's anthropic list plus what Claude Code's .claude.json says beyond it (magpie asks Anthropic nothing). Its fetch rebuilt that list from the local models.dev cache, which is fetched again only once it is a day old. models.dev added claude-fable-5-2 after the user's last daily sync, so every fetch that day answered without it. Claude Code builds /model from the catalog baked into its binary (2.1.321 and the latest 2.1.322 both have latest_per_family fable: claude-fable-5-2), not from its bootstrap's additionalModelOptionsCache (here still only claude-fable-5-1[1m]), so nothing in .claude.json would have given it either. Not Linux-specific. Fix: catalog.Asked, called by the Claude account's fetch, syncs models.dev first when the cache is older than 10 minutes and wasn't tried in that time, bounded by the fetch's context; a failure is logged and the local catalog answers. Only in a process that keeps the catalog fresh (the app, magpie serve), so CLI commands and tests never reach the network. Subsystem page updated. Run on mote at |
||
|
|
e4197144a8 |
perf: every package's package-level regexps compile on first use
v0.1.3516 made gateway's and redact's patterns lazy. The other 299 package-level regexp.MustCompile calls, in 148 files across agent, provider, gui, library, codexcat, sessions, usage, plugin and the rest, now go through lazyre.New too, so a launch that never reaches them (`magpie statusline`, run by Claude Code on every message) doesn't compile them. Fields, maps and params that held them are *lazyre.RE. Measured on mote (M5 Pro), sandbox HOME, v0.1.3516-equivalent build (t42) against this one (t43): - GODEBUG=inittrace=1 sum: 7.39 MB / 69,837 allocs -> 4.62 MB / 46,765 - `magpie statusline`, 3 runs each: instructions retired ~212M -> ~176M, peak memory footprint 19.2-19.4 MB -> 16.8-17.0 MB Run: go vet ./... (darwin) ok; GOOS=windows go vet on each of the 30 changed packages ok; GOOS=linux go vet ok except ., internal/cli and internal/gui, which stop in wails v3's cgo files when cross-compiled (the same at main). New TestAllLazyPatternsCompile at the root compiles all 574 registered patterns (ok), so a bad pattern fails a test rather than a first use. Not run before push: the changed packages' own test suites; they run on mote after it. |
||
|
|
079da3a785 |
perf: a state poll lists dsh profiles once, and skips work for Codex's models and gateway base
Each /api/state poll redid work for each agent row. That work is now done
once, or skipped:
- dsh's profile list is held for the request (dshProfilesHeld). dshModern,
Joined and dshLead each globbed profiles/*/cordis.patch.yml again.
Writers still call dshProfiles.
- CodexSignInGone reads the record first. With nothing on record for the
home, the usual case, it no longer parses auth.json and hashes the
refresh token on each look. A record that can't be read answers as
before.
- Codex's effort field reads catalog.CodexShared(), which doesn't copy.
With both lists, they are joined into one presized slice.
- codexViaMagpieFor builds one presized slice instead of two that grow
and are then joined.
- onAnotherMachine answers a plain loopback base (localhost, 127.0.0.1,
[::1], digits-only port, no user info) without url.Parse. Anything
else still goes through url.Parse.
Measured on mote with the real-account sandbox, allocations over 40
/api/state polls, two alternating pairs:
- before (
|
||
|
|
1eebd1ff3c |
providers: a known maker price is answered without garbage too
|
||
|
|
b53f4e7c49 |
providers: a known price and a known hostname are answered without garbage
The Providers list asks the price memo for every model of every provider on each poll, and the hit built its key as a new string each time. The key is now built in a stack buffer and looked up through string(k), which Go doesn't allocate for a map index; it is copied out only when the price is new. hostnameOf parsed every provider's base URL with url.Parse on every poll; the hostname is now kept per URL (reset at 512). Measured on mote with the real account copy (aalloc.sh, 40 asks of /api/providers, alloc_space delta): 213.4MB at origin/main (t12), 186.9MB with this change (t13), -12%. CPU for 30 asks 0.64s -> 0.62s. Run: go vet ./internal/catalog ./internal/provider; go test -count=1 -timeout 45m ./internal/catalog ./internal/provider (ok, ok) on mote. New TestPricedOnceHitAllocatesNothing and TestHostnameOfKept fail on the old code (1 allocation each, broken by hand) and pass with it. Not tried: Windows and Linux (no OS-specific code). |
||
|
|
7e5cebb86c |
usage: a model list fetched again unchanged keeps the usage index
Each account's model list is fetched again on every start and every 45 minutes, and saveLive writes it again with only its "fetched" time moved. Usage keyed the request index (and its file on disk, requests-v1.bin) and the priced summaries on that file's mtime (statKey(catalog.LivePath)), so each such save dropped every chunk: every start, and every refresh while running, read the whole session history again, decoded every call shard and rebuilt every row. catalog.LiveKey names a saved list by a hash of its bytes without the fetch time, made once per parse of the file (readLive's memo). A list saved before Since was kept is dated by its fetch (LiveSince), so its fetch time stays in its key. usage's liveListKey uses it for every provider and Antigravity in readRequestState's meta and in usagePriceCacheKey (the same mtime key, the sibling), and falls back to the stat when the list can't be read. Found by dumping both disk headers on mote: same binary, same sources, and only the providers' hash differed, run to run. Measured on mote, a copy of the owner's real accounts, GUI open, network blocked, the Claude list rewritten as a start's fetch does. Restart of the same build, t10 (main) against t11 (this): CPU in the first ~3 minutes 11.6s -> 2.5s allocated 2.74GB -> 0.81GB sessions.loadCalls 771MB -> gone from the top footprint 174MB -> 175MB The first start after an upgrade that changes usage's code still builds everything once (requestDiskBinary), as before. Tests: TestRequestStateKeptAcrossAListFetchedAgain saves the same list again an hour later and needs readRequestState's meta and usagePriceCacheKey unchanged, and both changed for another list; on the old usage code it is red on both. TestLiveKeyOnlyMovesWithTheList and TestLiveKeyOfAnOldListKeepsItsFetch cover the key itself. Run on mote at this tree: go test ./internal/catalog ./internal/usage ./internal/provider -count=1 ok; go vet ./... ok; GOOS darwin/linux/ windows go vet ./internal/catalog ./internal/usage ok (./... cross-OS stops at wails' cgo files, as on main); gofmt clean. Not run: the full ./... suite before the push (running after), GUI. |
||
|
|
fdabddeb41 |
catalog: a list fetched again as it was tells no agent
The magpie serving the gateway fetches each signed-in account's list
again once it is 45 minutes old (KeepAccountsListed), and saveLive
called Touched after every save: Changed ran SyncCatalog, which built
and compared every agent's model lists, and Forget moved the stamp
dsh's rounds build magpie's models by, so they built them again too.
For a list that came back the same, all of it was for nothing.
Now saveLive compares what it is about to write with the file there,
but for the fetch time. The same list is written (the new time keeps
the next relist 45 minutes away) and its next read looks at the file
(filememo.Look, also under a request's hold); nothing else is told. A
list that differs in a model, a part (Sides) or what it was asked as
is told as before.
Measured on mote with a copy of the owner's real config and accounts,
network blocked, the claude account's list set 2h old so the relist
falls in the window (acidle.sh, alloc_space from 60s to 180s idle):
v0.1.3416 (t5): 42.8 MB, SyncCatalog 27.7 MB, buildModels 8.9 MB
first cut, Forget kept (t6): 28.8 MB, dsh rounds' buildModels 12.1 MB
this (t7): 14.1 MB (4.7 MB of it the heap profile's own write),
neither SyncCatalog nor buildModels in the profile; the claude
list's fetched moved to the relist's time (06:18:52)
Without a relist due, idle was 7.8 MB before and after.
Test: TestLiveSavedAgainSameTellsNoAgent. Broken by hand: always
Touched (red: "changed 2, forgot 2; want 1, 1"), and no
filememo.Look (red: the held read keeps the old fetch time).
Run at this head on mote: go test -count=1 ./internal/catalog/
./internal/provider/ ./internal/agent/ ./internal/filememo/ ok; go vet
of internal/catalog native, GOOS=linux and GOOS=windows ok; gofmt -l
clean.
Not tried: an account whose list really changed in a running magpie
(the test covers a model, a window, a part and the asked version).
|
||
|
|
88b541a25c |
images: every pointer names Settings › Models › Images, where the page is
The image models moved under Settings › Models, but the Library's Magpie
Image sheet, the MCP server's instructions to agents, the gateway's
"no image model" errors, the video tool's text and the docs still sent
users to "Settings › Images", a tab that no longer exists (the scattered
settings audit after netube99 on X). Every user-facing string now names
Settings › Models › Images in en, zh, zh-TW, ja and de, as do the site's
Qwen docs (en, zh, ja), llms-full.txt, the subsystem pages and comments.
Run in the tree with this change and the rest of the audit's fixes
(mote, base
|
||
|
|
2b8ff0fbeb |
routing: an account's model list older than the model is unknown, not a plan without it
wudao_85256 on Discord: two ChatGPT Plus accounts on the Codex subscription, each serving gpt-6.1-sol alone. With both on, Routing said of the second "its plan doesn't list gpt-6.1-sol", and once the first ran out of its allowance nothing failed over: an unlisted account is asked only after a listing one refuses the model as unserved, never after a 429. Re-adding the account and refreshing changed nothing. Cause: the second account's own list (models/codex@<user>.json) was the evidence, and it was stale. The ChatGPT backend lists gpt-6.1-sol only to Codex 0.161.0 and later ( |
||
|
|
08a42c40ff |
provider: a Remote magpie's cards are passed on down a chain of magpies
yuyong_id (Discord) chains three magpies through Remote: magpie1 has a Codex subscription, magpie2 uses magpie1, magpie3 uses magpie2. magpie2 showed magpie1's Codex card; magpie3 showed none. Cause: since |
||
|
|
bca122bf90 |
catalog: a router's id (auto, free, default) is no one model
models.dev lists several vendors' routers under one bare id: openrouter/auto,
model-oracle-ai's auto, trustedrouter/auto, kilo-auto/free, openrouter/free…
bareID merged them into one "auto" and voted their levels, images and
window onto it, so every provider's own "auto" borrowed them. The 豆包工作
plugin's auto (Doubao picks the model) got reasoning_levels
none/low/medium/high, and pi's models.json a thinkingLevelMap for it.
vote now skips auto, default and free. A provider's own list (ListedBy)
still says what its router does. fast and balanced are routers too
(trustedrouter, Kilo) but stay voted: a vendor may name a real model so,
and TestNamedAvoidsCollisions / TestPickedNamesAvoidCollisions hold such
a "fast".
Run (mote, at
|
||
|
|
30b7a17326 |
codex: a relay's dated or renamed GPT id keeps its xhigh, max and Ultra levels
Found while looking into maomao_00001's report on Discord: the Windows Codex app offered no xhigh or Ultra for a relay's model. Their relay (vip.aipro.love, ids from its public /api/pricing) names its 31 models plainly, and every one already got its full levels in magpie-models.json before this change and gets the same after it, so this is not their fix. Exact ids (gpt-6.1-sol, openai/gpt-6.1-sol) were fine; two spellings other relays use were not: - OpenAI's dated snapshot id (gpt-6.1-sol-2026-09-29) was unknown to the catalog, so it got the low/medium/high fallback. borrowedEfforts now drops a dated suffix and takes the base model's levels. - A relay's rename (codex-gpt-6.1-sol, "[A] gpt-6.1-sol", an id the user marked the same as gpt-6.1-sol) got the levels up to max but no Ultra, because OffersUltra matched exact ids only. It now matches through catalog.IsOneOf, the lookup ContextOf and EffortsOf use. Only known models change: a dated id whose base is unknown (model-x-2026-01-01) keeps low/medium/high, a dated Luna gets its own levels without Ultra, and glm-5.3-flash keeps [low high max]. Not changed: a dashed-date id's window and price are still unknown, because catalog.SameModel doesn't strip that date form (#5643). Run: - TestCodexCatalogRelaysKnownModelsLevels red on the old code (the dated Sol and Luna at [low medium high], three renames without ultra), green with the fix. - gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... and builds on mote. - go test -tags nogui ./internal/catalog ./internal/provider ./internal/agent ./internal/codexcat on mote: all ok. - The relay's 31 ids put through codex's Set with the real models.dev file (a probe, not committed): the same levels on origin/main and with this change. - Full suite: not finished. My probe runs reused the suite's copy on mote, so it was stopped; it runs again after the push. Refs: maomao_00001 (Discord) |
||
|
|
37c1bc043b |
agent: a group whose members all serve Responses, one best there, is asked on Responses
zyh6036 on X: several subscriptions that all serve the Responses API were asked on Chat once they were put in a routing group. Pi, OmO, omp, StepCode, droid, dsh, Hermes, Grok CLI and the live agents ask each model on the one API catalog.Model.APIs names, and a group had Responses only when every member's Native was Responses (allResponses, #1594). A relay that serves Chat and Responses, best on Chat (no Base URL API given, not OpenAI's own host), counts as Chat there, so one such member put the whole group on Chat, and the gateway then translated Chat to Responses for the ChatGPT, Copilot GPT or Responses-relay members. Found groups (auto-<slug>) hit this without the user doing anything: a new relay that also lists gpt-5.5 moved auto/gpt-5.5 from openai-responses to Chat (pi_api_test shows it). provider.GroupAPI now gives Responses when one member is best on Responses and every other takes a Responses request as it is (Responses among the APIs it relays), or translates every request anyway (a Claude Code subscription). So no member is translated that Chat would have relayed, and the ones best on Responses are relayed, not translated from Chat. The gateway already relays a /v1/responses request to each member that serves it (usable), so nothing changes there. Mixed groups: a member that Responses doesn't reach (a Chat-only key, a Messages-only Claude) keeps the group on Chat, where that member is relayed; picking Responses there would translate it on every turn. A Messages-only group stays on Chat as before (#1594's reason: a Claude member's thinking is known by its own model id, not the group's). An agent plugin's connect is told a group's native_endpoints now (provider.GroupEndpoints: the APIs every member relays), where it had none. /v1/models still leaves them out for a group: TestRemoteMagpieNativeAPI holds that a remote magpie sends a group's request on in the client's API for the other side to pick per member. No setting added: the group's API follows from its members. Run (mote, through mote-run): - go test ./... -timeout 45m at 65780f04f on |
||
|
|
f86dd7910a |
openrouter: list every image model from its Image API, and draw them there
iwinux on Discord: the OpenRouter image picker listed only Nano Banana,
GPT-5.4 Image 2, GPT-5 Image and GPT-5 Image Mini, and asked whether the
protocol was the reason. It wasn't. OpenRouter's GET /api/v1/models lists
only models whose output includes text (454 rows on 2026-11-06, 13 of them
with image output), and that was the only list magpie read. The models
that answer in images alone (FLUX, Seedream, Riverflow, Recraft, GPT
Image, Krea, MAI Image, Qwen Image, Grok Imagine, Hunyuan, Muse) are at
its Image API's GET /api/v1/images/models (63 rows, no key needed), and
every one of them is served by POST /api/v1/images, which magpie already
spoke for FLUX/Seedream/GPT Image ids.
- catalog: openrouter.ai's public drawer list is /images/models; each row
becomes a drawer with its output modalities, release date, name without
the "Vendor: " prefix, and image input when it takes one.
- gateway: a model that answers in images only goes to /images, so
Recraft, Riverflow, Krea, MAI, Muse and Hunyuan (ids ImagesAPI doesn't
know) no longer go to chat completions. A pixel size is sent as
aspect_ratio plus resolution (2K/4K by the long side), since no
/images endpoint lists size and Riverflow refuses one: a real request
with "size":"1024x1024" got 400 "Sourceful V2 does not support explicit
pixel sizes. Use resolution and aspect_ratio instead." A ratio goes as
aspect_ratio; anything else (auto) as size.
- Recraft's vector models answer image/svg+xml: saved as .svg in the
gateway and in the image MCP (its sibling extOf).
Not listed: openrouter/auto (a router that may answer with an image).
krea/k3-edit is listed but only edits. Image prices are not imported
(OpenRouter prices per image per endpoint). Existing users see the new
models after their next model-list fetch.
Run (mote, at this tree):
- go test -count=1 ./internal/provider/ ./internal/catalog/ ./internal/imagemcp/: ok
- go test -count=1 -run 'Draw|Image|OpenRouter|ViaFor|Aspect|Drawer' ./internal/gateway/: ok
- gofmt -l internal: nothing; go vet of the four packages for darwin,
GOOS=linux and GOOS=windows: ok
- Real: the worktree's binary in a sandbox HOME (magpie-wt/orimg-scratch,
only the owner's OpenRouter provider copied in), serve on 127.0.0.1:3471,
magpie sync: "openrouter (405)" and 63 drawers in its live list,
Riverflow, Recraft, FLUX, Krea, MAI among them. POST
/v1/images/generations openrouter/sourceful/riverflow-v2-fast at
1024x1024: a 1024x1024 WebP back (27KB, 4175 output tokens).
Broken by hand: without the /images/models catalog entry,
TestOpenRouterImageModelsComeFromItsImageAPI fails ("/images/models asked
0 times"); sending size as given, TestOpenRouterImageOnlyModelsDrawAtItsImageAPI
fails (size 1024x1024 sent, aspect_ratio missing).
Not tried: a real draw with Recraft vector (SVG), Krea, xAI or MAI
through magpie; the GUI picker itself with the longer list; Windows and
Linux runs of the tests (vet only).
Reported-by: iwinux
|
||
|
|
e17c6976b2 |
provider: Voyage AI preset, its embedding and rerank models (heatonz on Discord)
heatonz on Discord asked for Voyage AI, its embeddings and rerank. The gateway already had /v1/embeddings and /v1/rerank; what was missing was a way to add Voyage and have its models found there. - presets.go: `voyage`, a vendor with an API key at https://api.voyageai.com/v1 (docs.voyageai.com, keys at dashboard.voyageai.com). Voyage has no /models, so it is NoList and the preset names its models in two new PresetDef fields, Embeddings (voyage-4-large, -4, -4-lite, code-4, finance-2, law-2, 3-large, 3.5, 3.5-lite, code-3, code-2) and Rerankers (rerank-3, -3-lite, 2.5, 2.5-lite), as Voyage's docs list them on 11-06. Region gets Rerankers too. - models.go: planMedia marks each plan model with what it serves (catalog.Model.Serves), falls back to the preset's own lists when the provider has no region, and PlanRerankers / PlanRetrieval(kind) sit beside PlanEmbeddings. A NoList provider's ListAll has them too, marked, so catalog.Chat keeps them out of agents' lists, keys and Routing's chat pickers. - gateway: resolveRetrievalModel and servesKind look up the kind asked for (PlanRetrieval(kind)) and not only embeddings. Before this, a plan's embedding model named on /v1/rerank was sent there, and a plan's reranker was never found. - catalog.ServesOf: `voyage-*` is an embedding model (its ids have no "embed"), so Test, detection and a relay serving voyage ids know it. - test.go / gui providers.go: the retrieval-only Test fallback and the editor's "retrieval" count read PlanRetrieval as well. - docs/reference.md: a new "Embeddings and rerank" section with both routes' bodies (OpenAI's for embeddings; the Cohere/Jina/Voyage shape for rerank, top_n or top_k) and the Voyage preset. READMEs and the import docs pages (en, ja, zh) list it. Not served: Voyage's contextualized and multimodal embeddings (their own endpoints). A Voyage 4xx comes back as its raw {"detail": ...} body with its status (errorSaid has no "detail" reader). Tests (no network; a fake built from Voyage's documented request and reply shapes): TestVoyageEmbeddingsAndRerank (bare and provider ids, input_type/output_dimension and top_k/return_documents passed on, usage total_tokens recorded), TestVoyageModelsStayOnTheirRoutes, TestVoyageRefusalSaysWhy, TestVoyagePreset, TestVoyageTestAsksItsRetrievalAPIs, TestServesOf's voyage cases. Run on mote: go test -count=1 -timeout 45m ./internal/provider ./internal/catalog ./internal/gui ./internal/gateway. provider, catalog and gateway ok. gui has one red, TestMainWindowCorners/macOS_26_SDK, which is #3949 (red on macOS 27); this change doesn't touch AppKit. go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... ok. gofmt -l clean. Broken by hand: - resolveRetrievalModel/servesKind back on PlanEmbeddings: TestVoyageEmbeddingsAndRerank red (rerank-3: 404 "magpie knows no model"), TestVoyageModelsStayOnTheirRoutes red (voyage-4 on /v1/rerank answered 200). - the voyage- prefix out of ServesOf: TestServesOf and TestVoyagePreset red. Not tried: against the real API. No Voyage key was available, so the endpoints, auth and shapes come from Voyage's docs alone. Not tried in the GUI's Add sheet by hand, and not on Windows or Linux beyond vet. |
||
|
|
72e09cc019 |
catalog: a list's sora ids are video models, made at its OpenAI-shaped videos API (#4954)
What changed: a fetched model list keeps an id naming a video model the way it keeps one that draws (FilmsID: sora-2, sora-2-pro). OpenAI's list marks no kind, and textModel counts sora out of the chat models, so a Sora model was never listed at all: the provider editor could not mark it a video model, and startVideo answered 400 "can't make videos". A sora id now reaches the list as Films - a video model of the provider, asked at its OpenAI-shaped videos API, which the gateway already speaks - and is still no chat model. The other video families keep the faces their own APIs are asked on: Ark's Seedance at its tasks, a MiniMax key's H3, and a model the user says makes videos (#1399). Run: - go test ./internal/gateway -run TestOpenAIKeySoraMakesVideos -count=1 RED before (videomakers [] - the list carried no sora model), green after: sora-2 and sora-2-pro are the provider's video models, a video is started, polled and fetched at its /v1/videos, and neither id is among the chat models. - TestCustomProviderMakesVideos, TestCustomProviderVideoNeedsTheListsWord, TestCustomProviderVideoTheUserMarks green, the last two with the fixture's unmarked model renamed to agnes-video-2.5-flash (#1399's own case): a name alone still makes no video model, even one with "video" in it. - go test ./internal/catalog, the video family with -race, gofmt, go vet -tags nogui, builds (darwin, linux, windows): clean. Reviewed and ported (on origin/main |
||
|
|
a732f3c493 |
gateway: models of one API other than chat are grouped by id on their route (#5339)
XYenon (Discord) has the same embedding model at several providers and
asked why it isn't grouped the way chat models are. It wasn't even
listed: a fetched list dropped every embedding, rerank, speech and
transcription model, so "embed-1" on /v1/embeddings was a 404 unless a
hand-made group named it.
- catalog: a fetched list keeps those models, tagged with their API
(Model.Serves, read from the id by ServesOf: rerank, embed/bge-,
whisper/transcribe, tts-/-tts). Chat() and Live() leave them out, so
agents' model lists, gateway keys and Routing's chat pickers never
see them; LiveServing(id, kind) reads them. The live file says
"kinded": true; a list fetched before this is fetched again once a
run (autolist), with no schedule needed.
- provider: KindGroup(kind, ref) is made per request, never stored, so
it is in neither Groups() nor Catalog(). Its id is
auto-<kind>:<model> ("group/auto-embedding:embed-1"); its members are
the providers that serve exactly that id for that API, in the order
they were added, none off, decide-only, serving none, or with the
model disabled.
- gateway: embeddings, rerank, speech, transcriptions and videos pick
the group by route (mediaMembers): a bare id is a kind group when
more than one provider serves it, the group's own id always; a
hand-made group still works through offChatList. A group is of its
own API: an embedding model's id on /v1/rerank is a 404.
Run at
|
||
|
|
0e55a75936 |
remote magpie: a request that goes round magpies pointing at each other stops after 8, and a remote that is this magpie lists its models once
Follows |
||
|
|
c2c991a5b3 |
remote magpie: two magpies each the other's remote no longer list each other's models back without end
cdredfox (Discord) saw 100-200% CPU while magpie used a remote magpie
over Tailscale, gone with the remote off. Their providers mask anyway
and their agent asks auto/ ids, so the earlier unmasked-group lead
doesn't explain it. What does: when A and B are each other's remote,
A's /v1/models (to another magpie) lists rem/<B's models>, B fetches it
as back/rem/..., lists that back to A, and so on: one level deeper on
every 10-minute fetch, without end. Each level is another member of
the found auto/ group and another route round the two machines, masked
again on each pass. On mote, two sandbox magpies in that setup went
from A: [auto/m1 own/m1 rem/auto/m1 rem/up/m1 rem/back/own/m1] to
[... rem/back/rem/back/own/m1, rem/back/rem/auto/m1 ...] after one
more scheduled fetch, and B had back/rem/back/own/m1. A request on the
loop route (rem/back/own/m1) cost A 1.07s CPU over 10 turns against
0.69s for own/m1.
The list a magpie gives another magpie now names, as magpie_via, the
magpies each model passes through, itself last. Each process has a
random id (catalog.Self). A fetched list leaves out a model whose via
has this magpie and another one (it left here and came back), or more
than 8 magpies. A remote that is this magpie itself (via only this id,
as the in-process tests set up) is kept. A magpie older than this sends
no via, and its list is taken as before: both machines need the update.
Stamped on every list a magpie gives: models(), its deciders, and the
drawer and video lists. A routing group's via is its members'
together, so A's auto/m1 holding B's auto/m1 (which holds A's) is left
out at B, and requests no longer go A -> B -> A through groups.
What a user of A loses: B's own auto/ group of a model when it holds
A's model (it reaches A again); B's own models stay listed at A one by
one, and A's group of the model holds them. The cached list keeps Via, so a model a remote served
through others keeps its path in this magpie's list too.
Run (mote, at this tree on
|
||
|
|
78128b5101 |
provider: a plugin's thinking model listed as, or the same as, another takes that model's levels (axelburks)
axelburks on Discord: a plugin's model that thinks and declares no
variants, set the same as and listed as claude-opus-5.5, took Claude Opus
5.5's price but showed its reasoning levels unknown, none ticked.
Cause: pluginCatalog borrowed levels for the plugin's own model id
(borrowedEfforts(m.ID)), which no catalog knows, so it got none; the
rename to the id the user lists it by (localIDs.list) then kept that
empty list. The price is looked up by the listed/same-as id, which is why
only the levels were missing.
Fix: a model whose levels were borrowed (catalog.Model.EffortsBorrowed,
set only in pluginCatalog's borrow) borrows them again for the id it is
listed by, which also follows the user's same-as. Levels the plugin's
own variants give stay first, and the levels the user kept narrow the
borrowed ones as before (effortsKept).
Test: TestPluginModelListedAsBorrowsLevels (listed as and same as one
id, listed by a name of the user's own, a model with variants of its
own, the price, and kept levels narrowing them).
Red on the old code: with the localid.go hunk reverted it fails with
"claude-opus-5.5 listed with levels [] ... want [low medium high xhigh
max]", the same for the gateway's p.Efforts and for my-opus.
Broken by hand: dropping the EffortsBorrowed set in plugins.go turns it
red (4 "want [low" errors). TestPluginThinkingModelBorrowsEfforts and
TestClinePluginBorrowsEfforts stay green.
Run on mote at this tree (on
|
||
|
|
1a1ca0351b |
Revert "catalog: a listed model its id names a video model is one (agnes-video-2.5)"
This reverts commit |
||
|
|
b5b6cc5739 |
catalog: a listed model its id names a video model is one (agnes-video-2.5)
glorious_rabbit_30894 on Discord (#help): models of a custom provider pointed at Agnes AI (apihub.agnes-ai.com/v1) "can't be added to an agent". Agnes runs new-api; its /v1/models rows carry only id, owned_by "custom" and supported_endpoint_types ["openai"], no kind, domain or modalities. Nothing but the id tells agnes-video-2.5 and agnes-video-2.5-flash from its chat models, and magpie had a name check for image models (DrawsID) but none for video, so both were offered to every agent as chat models, and never as video models. FilmsID is DrawsID for videos (video, sora, veo, kling, seedance, hailuo, vidu, runway, *-t2v/i2v/r2v; veo and kling only as a word of their own, so inkling still chats). fetchPage marks a row a video model by it when the list says no kind, no domain, no text output and the id isn't an image model's. mendKinds applies the same to a list saved before, so a fetched Agnes list is fixed on the first read, not the next fetch. A model whose list says it answers in text is never moved. Checked FilmsID against every id in models.dev's cache (~/.cache/magpie models.json, 2026-11-04): every id it matches outputs video and no text, except nvidia/synthetic-video-detector (a classifier, text out); video models it misses are named for nothing it could know (ray2, minimax-h3, gemini-omni), and their lists' modalities or a user's kind still mark them. Not the cause of the report, as far as can be told: with Agnes's real list (testdata, fetched 2026-11-04) and models.dev's real cache, a custom provider at .../v1, at the bare host, Anthropic or Responses protocol, reaches Available, Exposed and Catalog with all four chat models, and every agent's picker (claude, codex, opencode, pi, omp, ... 75 fields) lists them beside a relay's. The reporter says (#help 09:52) dsh, VS Code and Codex can't pick them, with no error; that is not reproduced here and is asked for. Run (mote): - at this tree on origin/main |
||
|
|
92d2ed74f9 |
providers: an Ark key's Seedance models are under Video models in its editor, each to tick
axelburks on Discord: "供应商里方舟的配置页,有图像模型选项能勾选模型,但是没 有视频模型选项不能勾选视频模型". A Volcengine Ark key's editor listed its Seedream models under Image models, to tick, and had its Seedance models among the chat models or nowhere. Cause, two parts: - The editor had no video section at all: video models had no list and no hidden set (gateway-routing.md said "Video models aren't listed in the editor, so there is nothing to hide there"). - catalog's live parse read only "kind" and modalities.input/output. Ark's /api/v3/models marks no kind: it says domain "VideoGeneration" / "ImageGeneration" and modalities.input_modalities/output_modalities. So Seedance came back as a chat model, and 3D models (output 3d, no text) as chat models too. Change: - catalog: a live row with no kind is a video model when its domain is VideoGeneration or it outputs video without text, an image model for ImageGeneration or image without text; Ark's input_modalities / output_modalities are read when input/output aren't there, so a model that gives no text (Ark's 3D) is left out of the chat list. TestFetchArkMarksVideoModels runs on a captured Ark list (testdata/volcengine-ark-models-2026-11-03.json, fetched read-only with GET /api/v3/models, no key in it). - provider: HiddenVideomakers beside HiddenDrawers, VideomakerHidden. - gateway: VideomakersOf (Videomakers on a given list, for the editor), OfferedVideomakers = Videomakers less the unticked ones, read by AutoVideomaker, videomakerObjects (another magpie's list) and mediaModels(true) (generate_video). A hidden one still makes its video when named: bareVideomaker, videosCreate and arkFilms read Videomakers. - gui: the editor's Video models section (renderVideomakers), filmIds and hiddenVideomakers on /api/providers, kept on save as hiddenDrawers is; i18n for every language. app.js comments cut to stay under TestCoreScriptBudget, which this change reached; no raise. - docs: gateway-routing.md's Hidden image models section. Old data: an Ark list fetched before keeps Seedance among its chat models until its list is fetched again; customVideomakers already counts any Seedance id an Ark key lists or picks as a video model, so it makes videos and shows under Video models now. Run on mote, this change and the next (/v1/models ?kind=, gateway and docs only) rebased on f4c664a09; this commit's own tree, on |
||
|
|
d97e52aea5 |
draw: Loomy's Hy-Image generators draw on the images API (#4913)
iFlytek's Loomy gateway serves three image generators, each listed in its /v1/models with type "image": Hy-Image-3.5-preview, doubao-seedream-5-lite, qwen-image-3.0-pro. An OpenAI-compatible plugin in front of it lists all three, and the reporter measured all three answering a normal OpenAI-shaped draw on the images API with a 200 and a URL each. qwen-image and seedream match catalog.ImagesAPI's words, so those two reach Settings' image generation picker and draw. hy-image matches only DrawsID's "image", so Hy-Image-3.5-preview stayed a chat model with no way to pick it for drawing — the same reason WorkBuddy's Hy-Image models need their wbDrawers path. Add "hy-image" to ImagesAPI's words: the model is then a drawer on the plugin's row like the other two, and the gateway asks it on the images API instead of chat. No other model's answer changes — every id the new word catches was already a drawer by DrawsID's broader "image"; only where it is asked moves. Test: TestLoomyPluginDraws (internal/gateway) installs a fake Loomy plugin listing the three generators beside a chat model, checks Drawers lists all three, and draws Hy-Image-3.5-preview (images API, image back, chat never asked). Broken by hand: without "hy-image" it is red (drawers [doubao-seedream-5-lite qwen-image-3.0-pro], the Hy-Image one missing). Review: applied as ggbdpq posted it (patch sha256 checked against the issue's). Broken by hand at the reviewed head: catalog.go reverted to its parent, TestLoomyPluginDraws red; restored, green. Run at the pushed tree (this stack of nine on origin/main |
||
|
|
9d08993c8b |
routing: Cheapest first prices Ollama Cloud's DeepSeek models at double from 12:00 to 18:00 UTC on weekdays (hayden4608)
hayden4608 on Discord asked that time-of-day routing use the gap between peak and off-peak prices, citing https://ollama.com/pricing. That page (read live on 11-01) gives Off-Peak rows for two models only, deepseek-v4.1-flash ($0.30/$1.20 peak, $0.15/$0.60 off-peak) and deepseek-v4-pro ($1.32/$3.96 peak, $0.66/$1.98), and says off-peak is "outside 12:00 and 18:00 UTC on weekdays and all day on weekends". models.dev's ollama-cloud catalog lists the off-peak prices, so magpie priced Ollama Cloud's peak hours at half. - catalog: a new Peak kind, PeakOllama. Its hours are 12:00 to 18:00 UTC, Monday to Friday, with no holidays. PeakFactor (2) matches the page for both models, cache reads included. - provider: a peakBill for ollama.com (preset/catalog ollama-cloud) that names the two models. Dated tags (deepseek-v4-pro:1017) count as their model; the bare name before ':' is compared without allocating. Every other model there (glm-5.3, gpt-oss...) and every other vendor stays flat. A local Ollama, a relay that names itself ollama-cloud, and an ollama.com.evil host are not matched. - GUI: a model's price tooltip names Ollama's hours for peak "ollama". The Cheapest first and rate-window texts no longer say that only DeepSeek's hours count, in en, zh, zh-TW, ja and de. - docs/reference.md, site docs (en, zh, ja) and the gateway-routing and providers-accounts subsystem pages say the same. Run (on mote through mote-run, at this tree rebased on |
||
|
|
21882a68dc |
providers: a model's list price skips Grok's two name patterns unless it names grok-
/api/providers prices every model of every provider on each poll, and pricedNames ran grokWindow and grokEffort over each id, lowercasing it twice. Both patterns need "grok-" in the lowercased id, so any other id now returns before them; what a Grok id is priced as is unchanged. pricedOnce's memo key is sized once instead of growing by doublings. Run (on mote unless named): - go test -count=1 -timeout 45m ./internal/provider ok (103.8s), ./internal/catalog ok; GOOS=linux and windows go vet of both ok; gofmt clean (here). - Broken by hand: the guard narrowed to "grokx-" turns TestGrokEffortListPrice, TestCursorGrokFastPrice and TestGrokWindowWithoutKListPrice red, so the Grok aliases are covered. - Here, 200 GET /api/providers on the sandbox with the real config copy (offline, proxy :9), against v0.1.2548's tree: pricedNames 0.28s -> 0.02s, ListPrice 0.63s -> 0.40s; process CPU 4.62s -> 4.24s, median 20.4ms -> 19.0ms. pricedOnce stayed ~0.20s: its cost is the key's bytes, not the growth. Not run: the full ./... suite; GUI tests (the JSON is the same). |
||
|
|
8ac1c7a563 |
catalog: a model's list price is looked for once a catalog load
The GUI's provider list prices every model of every provider on each
request of /api/providers: ListPrice asks catalog.PricedBy and
MakerPriced by every spelling of the id across every maker's catalog,
and a model none of them lists (most of a relay's) went through all of
them each time. In a CPU profile of the GUI's polls (drift, state,
providers, 40 rounds, a real-account sandbox) ListPrice was 14% of the
process's CPU, PricedBy and makerListPrice most of it.
What PricedBy and MakerPriced find depends on the loaded catalog, the
providers asked and the id, and nothing else, so pricedOnce keeps it by
those for the load's Reset count (gen), as priceIndexOf and AtEndpoint
keep what they build. A Reset (a new catalog synced) starts it again; it
holds at most 32,768 answers and starts again past that. find runs
without the memo's lock, as PricedBy calls itself for a renamed id.
Run on mote (macOS 27, Go 1.26.8) at this tree:
- gofmt clean; go vet ./internal/catalog on darwin, GOOS=windows and
GOOS=linux ok.
- TestPricedOnceALoad 3 of 3 alone, and with -race beside
TestPricedBy*/TestMakerPriced*: ok.
- Broken by hand: the memo never answering, TestPricedOnceALoad red
("looked for 20 times again at one load"); the memo not keyed by gen,
red (the old catalog's 0.15 after a new one's 0.2).
- go test ./internal/catalog ./internal/provider ./internal/usage ok.
./internal/gui: TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestMainWindowCorners/macOS_26_SDK (#3949) red, the same two red with
the same output at origin/main
|
||
|
|
314940d2d6 |
catalog: SameModel leaves a plain model id as it is, without a regexp or a copy
SameModel ran modelGaps' ReplaceAllString and built a byte copy for every
id it was asked about, even one with nothing to change. The Providers
poll asks it for each provider's models, 21.5 MB of 540 MB over forty
polls with real accounts. An id with no underscore, whitespace or double
dash now skips the regexp, and one with no version dot to rewrite is
not copied.
TestSameModelPlainIDsAllocateNothing compares SameModel with the old
code over about 30 ids (underscores, tabs, no-break spaces, "--",
dotted versions, leading and trailing dashes) and checks a plain id
allocates nothing. Broken by hand both ways it goes red: allocations
back (4 to 5), and wrong answers with the plain-id check inverted.
Run on mote: the test alone 3 of 3, internal/catalog ok,
internal/provider ok, gofmt and vet clean. Real accounts in a sandbox
HOME, forty Providers polls: SameModel 21.5 MB -> 2.5 MB, state and
drift replies byte for byte the same as before. Not run: the GUI suite
(no GUI file changed).
Picked onto
|
||
|
|
15066f84f6 |
appdir: a folder and file name are joined once, not on every read
appdir.Config and Cache, catalog.CachePath and LivePath, settings.Path, provider.Path and the logins path each ran filepath.Join on every call, and they are called on every read of a cached file, many times a request. Those joins were 70 MB of the 1.4 GB twenty window polls allocated. appdir.Join and JoinFile keep each (dir, name, ext) they joined, up to 4096 of them, so a path named again is the same string. A changed HOME or folder is a different key, so a test's sandbox still gets its own path. TestFoldersJoinedOnce and TestLivePathNamedOnce: 0 allocations a call. Broken by hand on mote (the files before this change) they are red at 1 allocation a call, and 3 for LivePath. Run on mote at this tree (on |
||
|
|
d714c4216d |
catalog: a newer model's line is looked up in the index made once per load
KinEfforts gives a model newer than the catalog its line's levels (gpt- 6.1-sol's from gpt-6-sol). borrowedEfforts asks it for every model with no levels of its own, on each look at the providers. Each ask ranged over every model of every maker's catalog and split and joined each key to compare its versionless shape: 66 MB of the 1.4 GB a main magpie allocated over 20 window polls with the owner's real config. levelIndex ( |
||
|
|
f9ca3dd44c |
provider: a look at one model of the vendor's list reads it without a copy
ListedAPIs, the Kilo and Cline free marks, a model's fast tiers and a remote magpie's price each look up one model of the provider's fetched list (liveByID), for every model a page lists. Each look copied the models of that id out of the list read, to read one field. With the owner's real config the copies were 32 MB of the 2.6 GB a v0.1.2432 magpie allocated over 20 window polls. catalog.LiveByIDShared is LiveByID without the copy (clipped, so an append is the caller's own); liveByID uses it, and still copies a model the user gave its own id, to set that id. Every caller only reads it. TestLiveModelReadWithoutACopy (a 200-model list, under provider.Hold and filememo.Hold as a request runs): a look costs less than a model over the list's read itself, a caller's append doesn't reach the list, and LiveByID still hands back its own copy. Broken by hand on mote: liveByID back on LiveByID is red (1112 bytes a look against 520 for the read; a model is 432). Run on mote (go test -timeout 45m): internal/catalog ok 0.7s, internal/provider ok 112s. go vet of both on darwin, windows and linux ok; gofmt -l clean. |
||
|
|
97ec2f8ae6 |
catalog: a model's levels are looked up in an index made once per load
listedBy (ListedBy, ListedByBorrowed) is asked for every model's
levels on each look at the providers, through borrowedEfforts. Each
ask ranged over every model of every maker's catalog twice: for its id
as given, then, for a name models.dev knows, through SameModel, whose
regexp ran on each of those thousands of keys every time. On a real
config that was 0.28 GB of the 2.6 GB twenty polls allocated.
Each provider's keys are now indexed by their bare id and by
SameModel's spelling, in key order, once per catalog load (the Reset
count loadGen gives), as PricedBy's priceIndex is. Of several keys with
one bare id, the first in key order is now asked first, where before
it was the map's order.
TestListedByReadsAnIndex: a 2000-model provider beside zai; glm-5.3-
flash is found under another spelling, a key under its bare id, an ask
takes under 8KB, and a catalog loaded since is read at once. Red on
the old code ("an ask took 341917 bytes with the catalog unchanged").
Run on mote at 98a8dee82 (go test -timeout 45m): internal/catalog ok
2.2s, internal/provider ok 214s, internal/agent ok 368s,
internal/gateway ok 801s. go vet ./... darwin and windows ok; linux vet
of catalog, provider and agent ok (./... as a whole needs cgo for
wails). gofmt -l clean.
|
||
|
|
c7c19d49d5 |
provider: asking whether a model decides copies no list
DecidesModel answered for a remote magpie, and for a provider that lists
its decision models (OpenRouter's), by building decideListed's whole
list (catalog.Live copies every chat model) and scanning it. Every model
of such a provider is asked this from available(), pluginDecisions and
the decider list, so a list of n models was copied n times per look:
0.43 GB of the 4.1 GB a real config allocated over 20 polls of
/api/drift, /api/state and /api/providers (v0.1.2430,
DecidesModel -> decideListed -> catalog.Live -> catalog.Chat).
It now looks the model up in the list as kept (catalog.LiveByID, which
readLive indexes once per read), and catalog.LiveListed says whether the
list has any model, for the Jev fallback decideListed has. The answers
are decideListed's: a remote magpie's models its list marks Decides; a
listed decision list's models; with none listed, OpenRouter's Jev unless
the server marks its own.
TestDecidesModelCopiesNoList: 2000 decision models, each ask under a
twentieth of the list's bytes, for both kinds, and the answers above.
Red on the old code (an ask 869,336 bytes, the list 869,829).
Run at
|
||
|
|
8413267097 |
catalog: a list's image/jpeg is an image, so OpenCode Go's models that see take images again (zeo9901)
zeo9901 (CC01CC) on Discord #feedback: "magpie 中 opencode go 所有的模型似乎 都无法实现图片输入了". Their screenshot is a routing group of DeepSeek V4.1 Flash at Open Design and at OpenCode Go. Cause: OpenCode Go's own /models (https://opencode.ai/inference/go/v1/models, the same at /zen/go/v1/models) lists what a model takes as media types: deepseek-v4.1-flash's modalities.input is ["text","image/jpeg","image/png", "image/gif","image/webp"], Gemini's adds application/pdf and audio/*, and so on. catalog's live-list reader took the list word for word and asked for "image", found none, and recorded ImageInput = false, an explicit answer. entryFor puts a list's explicit answer over models.dev's (which says image), so with a working Go key every Go model was text-only: a direct pick had its image described or turned away with "model does not support image input", a group member was sent it described or not at all, and agents were told the models take text only. It used to work while Go's list spelt modalities as models.dev does, or said nothing. Fix: catalog.Kinds reads a modalities list as models.dev words it (image/* image, video/* video, audio/* audio, text/* text, application/pdf pdf, each once, an unknown word kept, nil stays nil). imageInput and the live reader's InputModalities/OutputModalities go through it, as do Codex's input_modalities, the labs rows and a decision provider's listed facts (decide.go). A list saved before this, still holding Go's media types and false, is mended when read (mendKinds), so a user sees images from the first read after the update, not the next fetch. A user's own Accepts images answer still wins. Which OpenCode Go models take images, per Go's list on 2026-10-31: deepseek-v4.1-flash, kimi-k3, kimi-k3.1-pro, kimi-k2.7-code, glm-5.3-flash, qwen3.8-max, qwen3.8-flash, qwen3.7-plus, minimax-m3, minimax-m3.1-flash, mimo-v2.6-flash, mimo-v2.6-pro, step-5-preview, gemini-4-argon, grok-4.7, gpt-6-luna, gpt-5.6-luna, claude-haiku-5-5, muse-spark-1.2/1.3-contributor. Text only: deepseek-v4-pro, glm-5.2, glm-5.3, hy3, hy4-preview, longcat-2.0, beam-free, iceman-contributor-free. Tests (fixture: four rows of Go's real list, read without a key, no test reaches the network): - TestOpenCodeGoMediaTypesSee (catalog), TestKinds, TestSavedMediaTypesListSees, TestListedFactsMediaTypesSee (provider). - Broken by hand: Kinds returning its input unchanged turns all four red (deepseek-v4.1-flash, kimi-k3, gemini-4-argon "Images false"); the mendKinds call taken out turns TestSavedMediaTypesListSees red. Run on mote at the working tree on |
||
|
|
2ac423f4f2 |
kimi: a Kimi Code plan model is told always_thinking, dynamically_loaded_tools and its default effort, as Kimi's list says (jiabubu)
jiabubu on Discord (Kimi Code 2.2.0, Windows): Kimi Code's own provider
gives K2.8 Preview and K3.1 Pro the capabilities thinking,
always_thinking, image_in, video_in, tool_use and
dynamically_loaded_tools; through magpie they had thinking, image_in and
tool_use, so Kimi Code offered a thinking switch the models refuse to
turn off, and started K2.8 on high where Kimi's own starts it on max.
Kimi Code 2.4.1's managed provider (packages/oauth managed-kimi-code.ts,
capabilitiesForModel) derives them from /coding/v1/models:
supports_thinking_type "only" -> thinking + always_thinking,
supports_dynamic_tools -> dynamically_loaded_tools, supports_video_in ->
video_in, think_efforts.default_effort -> the default. magpie now reads
the same fields (flat, or nested reasoning.type, tools.dynamic_load,
reasoning.effort.default) into catalog.Model (AlwaysThinks,
DynamicTools, DefaultEffort; kimiFacts), carries them through
provider.Entry and the agent's model list, and the new Kimi Code's table
gets always_thinking, dynamically_loaded_tools and default_effort at the
vendor's default (else high, as before). Only Kimi's list sends these
fields, so another vendor's model is written as before; kimi-cli, which
refuses unknown words, gets none. A routing group has none of them.
default_effort is now recorded in the stash as magpie's (kimiOwn), so a
level the user picked stays while the model has it. A table with high
and no record is read as the high magpie wrote before it kept one, and
becomes the vendor's default (max on K2.8, high on K3/K3.1).
Left out:
- video_in: with type="kimi" Kimi Code uploads a video to
{base_url}/files (purpose=video) and sends the ms:// id. The gateway
has no /files route, and the id belongs to the account that stored it.
Filed as #4485.
- dynamically_loaded_tools works (Kimi Code's tool select is behind
KIMI_CODE_EXPERIMENTAL_TOOL_SELECT): the loaded tools' system message
is lifted into the request's tools (liftMessageTools, #2322), so they
stay callable (TestKimiCodeLoadedToolsReachKimi), but each load
restarts Kimi's prompt cache. Filed as #4486.
- max_output_size: Kimi's own provider writes none; magpie keeps writing
the model's known reply cap (32768 on K2.8 per models.dev), unchanged.
This also covers #3399 (K3.1 offered thinking off): Kimi's list says
"only" for both K3.1 models.
Real list: tests read Kimi's /coding/v1/models reply of 2026-10-31
(internal/catalog/testdata/kimi-code-cn-models-2026-10-31.json, read
with the owner's kimi-code-cn key, no key in the file).
Run (mote, at this commit on origin/main b62fa332f; the agent-wiring.md
line was added after the run, docs only):
- go test -tags nogui -count=1 -timeout 45m ./... : 79 packages ok;
internal/proc (TestNoCommandBypassesProc) and internal/sqlitedb
(TestOnlyThisPackageReachesSQLite) red on a Go module cache my e2e
sandbox had left inside the run folder (vendor files under
e2e-kimi/sb/home/go/pkg/mod); with it removed both ok.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./... ok; gofmt -l clean.
- Real Kimi Code 2.4.1 (npm) in a sandbox HOME/KIMI_CODE_HOME on mote,
with a sandbox magpie serve (MAGPIE_ADDR 127.0.0.1:34652), the
kimi-code-cn preset pointed at a fake upstream that serves the real
list: magpie wrote the six tables (K2.8: thinking, always_thinking,
image_in, tool_use, dynamically_loaded_tools, support_efforts low/high/
max, default_effort max; K2.7 Highspeed without
dynamically_loaded_tools), Kimi Code took the config, and `kimi -p`
reached the upstream with thinking enabled and reasoning_effort max
(K2.8) and high (K3.1 Pro).
- Rebased onto 43966a53f..f2eb56c6b (claude, GUI budget, usage; none of
them touch these files) as f5a82f215, then again at this head:
internal/agent, internal/catalog, internal/provider ok, internal/gateway
-run 'Kimi|MessageTools|Lift' ok. The full suite was not rerun there.
Broken by hand, each red then green:
- kimiFacts not called: TestFetchKimiCodeFacts and
TestKimiCodePlanCapabilities red.
- fields not carried in route.go / entryFor: TestKimiCodePlanCapabilities
red.
- the unrecorded-high rule off: TestKimiCodeOldHighBecomesTheVendorsDefault
red.
- always_thinking without the !legacy guard: the kimi-cli case red.
Not tried: the TUI picker by eye (that the thinking switch is gone);
tool select with a real MCP server and the experimental flag; Windows
(the reporter's system; nothing here is OS-specific); a real Kimi
upstream through magpie (the list was real, the chat was a fake).
|
||
|
|
643b525469 |
usage: a DeepSeek call at peak hours costs double its off-peak list price
treeMan on Discord: DeepSeek bills off-peak at half the peak rate, and the Usage page didn't follow it. The catalog's list prices for these models are already the off-peak ones: models.dev's DeepSeek, Command Code and OpenCode Go entries give the off-peak rate as the price and a factor-2 multiplier for peak hours, and api.json leaves the multiplier out (deepseek-flash: $0.15/$0.60/$0.003, DeepSeek's page says $0.30/$1.20/ $0.006 at peak). So every peak call was counted at half its cost. Now a call made from 01:00 to 04:00 or 06:00 to 10:00 UTC, Monday to Friday, costs twice the list price. The call's own timestamp decides. Which providers (provider.PeakOf, by base URL, or by preset/id only for a provider with no URL, such as a plugin's or a removed one): - DeepSeek's API (api.deepseek.com), every model, except on Chinese public holidays (catalog.PeakDeepSeek); - Command Code (api.commandcode.ai, the commandcode preset and the commandcode-plan plugin): deepseek-v4.1-flash, -v4.1-flash-fast, -v4-flash, -v4-flash-vision-exp and -v4-pro, every weekday, since its docs name no holiday. deepseek-v4-flash-fast is one price at every hour; - OpenCode Go (opencode.ai/zen/go): deepseek-v4.1-flash and deepseek-v4-pro, every weekday. Unchanged: OpenCode Zen (a flat $0.30/$1.20), ZenMux, Cline Pass, OrcaRouter and every other relay, a price the user set (ModelPrices returns before a Peak is set), a "same as" price and every other model. The provider's price rate still applies. Holidays: catalog.cnHolidays has 2026 from the State Council's notice (2025-11-04). TestCNHolidaysCoverThisYear fails on 2027-01-01 unless that year's notice, due in November, is added. A year missing from the table counts no holidays. Where the hour is applied (catalog.Price.In): Record.CostAt (Usage's totals and groups), the packed gateway blocks (priceBlock), OTLP's exported cost and budget's estimate (now). The Sessions page sums per model without per-call times and stays at the list price. The model editor's price box says when a list price counts double (four languages; app.js kept under its budget by shortening, not by a raise). Run at the tree pushed (parent |
||
|
|
e887139e7a |
providers: Best in family serves the newest model of each family a provider lists
Steven on Discord #feedback asked for a provider to serve only the newest model of each family, so a newer one (Opus 5.6) takes the old one's place without re-picking. The provider editor's Models control gets a fourth option, beside Vendor's list / Picked only / Usage only: Best in family. It is also on the CLI as `magpie provider models <id> best`. With nothing picked, the provider serves only the newest model of each family in the vendor's list, up to 24. A family is the id with its version numbers taken out (catalog.FamilyOf/BestInFamily in internal/catalog/family.go). A dated snapshot counts as its alias, and sizes and suffixes (mini, flash, -fast, -thinking) stay part of the name. Provider.Exposed applies it, and so does Codex's native list (CodexNativePicked). A provider/model a request names explicitly is still served, since resolve doesn't go through Exposed. A pick, Select none or Usage only clears the flag (normalize), and a providers.json without bestInFamily reads as before, so every existing mode is unchanged. The editor draws the family's newest as dashed (m.best) before saving. Every language has the wording (zh, zh-TW, ja, de). The design reference is docs/subsystems/providers-accounts.md (Model picks). Tests: family_test.go is a table of real ids, including the models.dev Claude list in testdata (no network). There are also best_in_family_test.go (provider), TestProviderModelsBest (cli), provider_save_best_test.go (gui save keeps/clears), codex_best_in_family_test.go (gateway) and provider-best-in-family.test.cjs (5 languages x chromium/webkit x 1100/420). Broken by hand: with the BestInFamily filter in Exposed and in CodexNativePicked turned off, the 4 new Go tests went red. Budget: after the rebase app.js went over appScriptBudget. Comments were cut and the tooltip and hint merged into one string, so app.js is 1,311,399 of 1,311,735. Neither budget was raised. Run at this head, on origin/main |
||
|
|
9b833205f7 |
groups: a found group's id and name come from models.dev's one spelling (XYenon)
XYenon on Discord (#feedback, 10-30): autoGroups() and spelledIn() picked a found group's name and its public id apart, so a group read glm-5-3-flash beside auto/glm-5.3-flash. The id also followed the order the providers were added in. Now: - spelledIn takes the spelling models.dev gives the model most (catalog.Spelling, the normal index normalFor already reads): every member spelling of GLM-5.3 Flash (glm-5-3-flash, Ark's glm-5-3-flash-260828, glm-5.3-flash) gives auto/glm-5.3-flash. A model models.dev doesn't know keeps the old pick (first listed member spelling, else the first member's). - autoGroups names the group from the same choice: catalog.NameOf of that spelling, else a vendor's own name, else the spelling itself. A found group the user changed keeps the name they saved. - Old ids keep working. group/auto-<slug> doesn't change, and any auto/<spelling> is still the group (CanonicalRef: gateway, key allow-lists, fallbacks, members). PublicRef now takes an old auto/<spelling> to the current one too, so hidden, picked and ordered models saved by it hold, and a pick of it written now (Agent.Apply) is written as listed. An agent field magpie set to an old spelling moves on the next SyncCatalog (renameFoundGroups), as group/auto- values already did, because OpenCode checks its model against the list magpie writes. A value the user set stays as it is and is still served. Tests (on mote, via mote-run): - TestFoundGroupIDAndNameAreOneSpelling (5 member orders/spellings, the user's name kept), TestFoundGroupUnknownToModelsDevNamedByItsID, TestFoundGroupMovedOffAnOldSpelling. The catalog fixtures use models.dev's real spellings and names (glm-5.3-flash "GLM-5.3-Flash", volcengine's glm-5-3-flash "GLM 5.3 Flash"). - Broken by hand, one file reverted at a time: group.go reverted, the test is red (named "GLM 5.3 Flash" beside auto/glm-5.3-flash); provider/autoref.go reverted, red (id auto/glm-5-3-flash with Ark first, PublicRef of the old spelling unchanged); agent/autoref.go reverted, TestFoundGroupMovedOffAnOldSpelling red (field stays magpie/auto/glm-5-3-flash). - go test -timeout 45m: internal/catalog, provider, agent, tui, cli, usageapi ok. internal/gui: everything ok except TestMainWindowCorners/ macOS_26_SDK, which is #3949 (AppKit on macOS 27, nothing to do with this change). internal/gateway, codexcat, sessions ok. - gofmt -l clean; go vet darwin, linux -tags nogui, windows clean. - No GUI file changed, so the GUI suite wasn't run. Names reach it through /api/groups. Not tried: a real models.dev sync with real providers in a sandbox app. Groups whose first provider spelled a model differently from models.dev (e.g. claude-opus-4.8 from a relay vs Anthropic's claude-opus-4-8) get the models.dev spelling once. Magpie-set agent fields move with it, and values the user set keep resolving. A key or fallback chip saved under the old spelling still shows it in the editor (it still works). |
||
|
|
810a4144fe |
catalog: a model's Same as gives it that model's window, levels and images; a channel's tag in brackets is read past (pinmmis on X)
pinmmis on X (tweet 2115776439341506603): the same model from several
relays, each renamed to be told apart ("ds.4.1(WB)" for
deepseek-v4.1-flash), had none of models.dev's specs, and setting each
spec by hand per model was the only way.
The ids are the relay's own (magpie looks up the model's id, not a
display name), so this is not a display-name bug. The editor's
per-model "Same as" (settings' ModelSameAs) already merged routing
groups and priced the model; now it also gives the model that model's
window, reply limit, reasoning levels, thinking and images:
- catalog.UserSame, set by the settings package (sameas.go,
sameAsBare: ModelSameAs indexed by bare model id, memoised per
shared map), is asked by contextIn/lookupIn after the id as given
and before magpie's own guesses (renamed, normalFor). An id
models.dev lists stays its own; the user's own window, output,
levels and images settings still win (callers read them first).
The model named is looked up once, never sent back to UserSame (no
loops). KnowsAsWritten (usage telemetry) never hears it.
- Zero-config part: those lookups also read past a channel's tag in
brackets at an id's start or end (untagged: "deepseek-v4.1-flash
(WB)", "[WB] ...", fullwidth and CJK brackets). A "[...]" written
onto the id with no space is not a tag ("deepseek-v4.1-flash[fast]"
may be a variant, TestRenameNeverTakesAModelForAnother). Prices are
never borrowed this way (TestOtherSpellingIsNotPriced's rule); a
Same as's price is still SamePriceIn.
- "ds.4.1(WB)" itself is not guessed: ds/4.1 could be flash or pro.
- GUI: the Same as box's tooltip says what it now covers, in every
language; provider-same-as.test.cjs checks every language, not zh
only. No layout or API change.
- docs/subsystems/providers-accounts.md says it.
Run on mote via mote-run:
- at the same change on
|
||
|
|
65bd4e4f72 |
provider: a model is priced at its maker's own API before a reseller's (bestony on Discord)
bestony on Discord (#feedback) asked that a subscription with no price of
its own, such as Command Code, be costed at the model's official list
price. magpie already estimates every subscription at the maker's list
price, but the maker step (PricedBy over the maker presets) took the
first preset that listed the id, and Mistral resells other labs' models:
deepseek-v4.1-flash-1017 was costed at Mistral's $0.30/$1.20 instead of
DeepSeek's $0.15/$0.60, glm-5-2 at Mistral's instead of Zhipu's, and a
lab that isn't a preset (Meta's muse-spark, Sakana, Tencent hy4-preview)
had no price at all.
catalog.MakerPriced prices a model at a models.dev provider that lists it
as its own: the entry's canonical_model_id names that provider as maker,
or the provider id is the maker's with a region (alibaba-cn), never a
plan's ("-plan") and never an entry at $0. A maker preset that is such
an API is asked first, in preset order, then the other owners by id;
the old PricedBy over the presets stays the fallback. makerListPrice
uses it in ListPrice's maker step, MakerPrice and PricedName. No new
setting: a model no maker lists still takes the user's price or a
same-as model.
Over every id in the real models.dev cache (2026-10-29, ~4086 ids) the
only prices that changed are the deepseek-v4.1-flash-1017 family
(0.30 -> 0.15), glm-5-2 (Mistral 1.40 -> Zhipu 1.19516), and newly
priced Meta, Sakana, Thinking Machines and Tencent hy4-preview models.
Run (mote-run, rebased on 1a8539432; catalog, provider, usage run again at this head):
- TestMakerPriceIsTheMakersOwn (fixture: literal entries of the real
models.dev cache) red on the old code, 10 errors (Mistral's resale
price, Meta unpriced), green on the new.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows
for internal/catalog, internal/provider, internal/usage.
- go test -timeout 45m ./internal/catalog ./internal/provider
./internal/usage: ok.
- go test -run 'Pric|Cost|Usage' ./internal/gateway ./internal/gui
./internal/cli: ok.
Not tried: a real Command Code request and its Usage row in the GUI;
the full gateway suite; Windows/Linux runs of the tests.
|
||
|
|
0366e35c11 |
catalog: a model models.dev lists under another spelling takes its limits
xyenon (Discord #feedback, 10-29): Volcengine Ark lists
kimi-k3-1-pro-261024 where models.dev lists kimi-k3.1-pro, so magpie
knew neither its context window nor its reply limit. The ids differ only
in what the provider package's sameModel already folds when it groups
models: a version's dot written as "-" (or Fireworks' "p"), and Ark's
six-digit YYMMDD date.
Design
- sameModel moves to internal/catalog as SameModel, word for word
(snapshotDate, modelGaps and atoi2 with it). provider's sameModel calls
it, so grouping and catalog lookups fold ids by one rule.
- Exact matches go first and are unchanged: found (exact, Bedrock
profile, "(variant)", ":tag"), then renamed (relay prefixes, window
marks). Only when both miss does normalFor look up the id models.dev
spells as SameModel(id) folds it. When several spellings fold into one
key, the spelling most providers use wins, and then the lowest id, so
Venice's kimi-k3-1-pro keeps its own 1000000/131072 and the other
spelling gets the majority's 1048576/1048576.
- Decorate (a vendor's live list against the provider's own models.dev
entries) tries the same provider's entry under another spelling before
anything else. It fills only what the vendor's list leaves at zero and
never copies a price, so a limit the upstream states always wins.
ListedBy (a provider's own levels) gets the same last pass, per
provider, after its exact passes.
- What is not borrowed: a price (PricedBy has no such pass, so nothing is
priced from another provider's or another spelling's row) and a display
name (NameOf; the upstream id stays the id).
- What is not matched: -pro-max, -mini, another version (k3.2, k3), a
four-digit release (-2610), a six-digit number that isn't a date
(261324), and OpenAI's dashed date. SameModel already kept those apart.
- Re-derived: everything that reads these tables goes through
ContextOf/OutputOf/lookup, so ListedWindow, replyLimit, the Codex
catalog, efforts and thinks get the fallback with them. Knows now takes
other spellings too, so the usage report (stats modelLabel), which may
send only ids models.dev lists, reads the new KnowsAsWritten, which
doesn't.
- docs/subsystems/providers-accounts.md says all this.
Tests (internal/catalog/spelling_test.go, a fixture from models.dev's
rows for these ids, no network)
- TestOtherSpellingLimits: the report's literal ids
(kimi-k3-1-pro-261024, volcengine/…, Kimi-K3.1-Pro-20261024) and
twelve near misses; levels; Knows vs KnowsAsWritten; no name.
- TestOtherSpellingIsNotPriced: no provider prices the dated id, and the
plan's price isn't taken for pay-as-you-go's id.
- TestDecorateOtherSpelling: the vendor's 200000 stays, the reply limit,
levels and name are filled, no price; a -max id and kimi-k3 vs
kimi-k3.1-pro are kept apart; ListedBy likewise.
- TestSameModelReportIDs.
- stats_test: a dated id models.dev knows only under another spelling is
sent as "other".
Red on the old code (catalog.go and live.go reverted, KnowsAsWritten
stubbed): TestOtherSpellingLimits "ContextOf("kimi-k3-1-pro-261024") = 0,
want 1048576" and the rest; TestDecorateOtherSpelling Output 0, ListedBy
false.
Broken by hand
- The majority vote inverted: Venice's spelling wins, and the test asks
for 1048576 and gets 1000000/131072. Red.
- KnowsAsWritten taking other spellings: TestOtherSpellingLimits red.
- stats reading Knows: "deepseek/DeepSeek_V4-260101", want
"deepseek/other". Red.
Real catalog (models.dev cache on the WSL box, a throwaway test since
deleted): kimi-k3-1-pro-261024 gets 1048576/1048576 and levels
low,high,max, is not priced by volcengine, and isn't KnowsAsWritten;
kimi-k3-1-pro-max-261024 gets 0; Decorate of glm-5-3-flash-260828
against volcengine-coding-plan gets 1000000/131072 and the name
GLM-5.3-Flash with no price; claude-opus-5-5-20260801 gets
1000000/128000; gpt-4o-2024-08-06 is unchanged.
Run
- Full suite on the Linux box (wsl-run, Go 1.26.8) at 242e5c68d on base
|
||
|
|
60561129f8 |
codexcat: two entries Codex's picker would name the same are told apart by their provider's id (nb5p on Discord)
nb5p had GPT-6.1-Sol from two providers both called Codex, and Codex's
model picker showed two identical entries, the hover text identical too.
Now, only when two listed entries would have the same display_name,
each gets its provider's id after it ("GPT-6.1-Sol · Codex · codex-b"),
or its own model id where the provider's doesn't tell them apart (a
routing group, two of one provider). Every other entry is unchanged.
Only display_name changes. The description and catalog Model.Name are
as on main. Codex puts each of the first five catalog models'
description into spawn_agent's "Available model overrides" (codex-rs
multi_agents_spec.rs spawn_agent_models_description, and
context/world_state/model_catalog.rs with model_catalog_in_context),
which goes upstream on every request; the real Codex 0.162.1 bytes in
internal/redact/testdata/codex-0.162.1-request.json show "- `fake/m1`:
m1 · fake via magpie". magpie's own spawnChoices sends Name. So the
first try (provider/account in the description) was dropped: it would
have sent the account's email upstream. display_name: read in codex-rs
at 5d5e5c5 (cloned on mote), core builds no prompt or tool text from a
model's display_name (model_catalog.rs and spawn_agent_models_description
use slug + description + efforts + tiers only); in the captured Codex
requests the name appears only inside the description. The id is in the
slug already, which is sent anyway. Apart is in the Model's JSON, so it
is in the list's tag and Codex asks for the list again when it changes.
Run (mote, at the rebased head):
- TestCodexPickerNamesSameNamesApart (internal/provider) and
TestCodexApartInDisplayNameOnly (internal/codexcat): pass.
- Broken by hand: codexApart never marking a pair, and shownName
ignoring Apart (the old behaviour): both tests FAIL, e.g.
codex-b/gpt-6.1-sol shown as "GPT-6.1-Sol · Codex", want
"GPT-6.1-Sol · Codex · codex-b".
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: all ok (at base
|
||
|
|
f6ed2c99bc |
effort: a vendor's light and extra_high are low and xhigh, in dsh, Pi and the gateway
nianshou5 (Discord) runs Trae's DeepSeek V4.1 Flash through the Our Free Model plugin (github:mu-zi-lee/magpie-our-free-model). Its variants are Trae's own names, light, high and extra_high, and dsh offered only default and high: dshModelLevels (and Pi's piThinkingLevels) matched a model's efforts to pi-ai's level names only, so light and extra_high were dropped. The gateway dropped them too: effortOf read "light" as no effort, and NearestEffort fitted an agent's low or xhigh to the plugin's high. catalog.EffortAliases names light as low and extra_high as xhigh (EffortLevel). NearestEffort places a model's levels by the level they name and returns the model's own word; the gateway's effortOf reads an alias as its level. dsh's reasoningEfforts and Pi's thinkingLevelMap map dsh's low/xhigh to the model's own word (modelEffort), which llm-pi-ai sends on the wire as written (resolveModelReasoning in dsh-llm-pi-ai reads each value as "the spelling dispatch sends"). Levels a user kept are untouched: only the names a model lists are mapped. Tests: TestDshOffersTraeNamedLevels (agent), TestNearestEffortTakesVendorWords (catalog), TestPluginThinkingOff's new fake-trae subtests (gateway, a real plugin host with the fake plugin listing light/high/extra_high). Broken by hand: modelEffort without the alias, dsh levels [high] (the report's picker); NearestEffort without EffortLevel, low/xhigh sent as high; effortOf without the alias, light/extra_high sent as nothing. Run on mote at this tree (base |
||
|
|
32ea16c5a4 |
gateway, provider: a model AgentRouter turns away on chat in Chinese is asked, and tested, on the next API (#3766)
char1eslu (#3766): AgentRouter answers gpt-5.6-sol, gpt-6-astra and gpt-6.1-sol on chat completions with a 400, "模型 gpt-5.6-sol 不支持 /v1/chat/completions 接口,请改用 /v1/responses(OpenAI Responses API)。", and serves them on Responses (gpt-5.6-sol on Messages too: the report's provider test has ✓ anthropic). wrongEndpoint, the gateway's word that a model is served on another API, which has the request asked there when the provider has a URL for it (and remembers it in unfit), read English alone. So while the provider had a Chat URL, a Chat client's request for these models got that 400 back, whatever other URLs it had. The report's 200 ("/v1/chat/completions → /v1/responses") is a request translated past chat, which |