ac4af582301a4e8a29245dbba767eba31334ddf9
138
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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 |
||
|
|
ab546a4eea |
draw: SenseNova's sensenova-u1.5-lite is an image model, and draws on its images API
lileo0668 (Discord, #help) added SenseNova's API (token.sensenova.cn/v1)
as a provider. sensenova-u1.5-lite showed in its model list but not in
Settings' image generation picker, so magpie's generate_image couldn't
use it.
SenseTime's launch post for U1.5 Lite on the Token Plan says it is an
image model only (no chat), served at /v1/images/generations and
/v1/images/edits in OpenAI's shape; an edit is JSON with
"images": [{"image_url": "<https URL or data URL>"}], and
response_format is url (a 24h link) or b64_json.
- catalog.DrawsID and ImagesAPI know "sensenova-u1" (u1.5-lite,
u1.5-fast), so the model a vendor's /models lists is a drawer, listed
in the picker and asked on the images API, not chat.
- drawImages, for those models only: ask for b64_json, and send an edit
as JSON with the images as [{"image_url": data URL}], the shape
ChatGPT's backend takes, instead of the multipart form other OpenAI
images APIs get. No other vendor's request changes.
Test: TestSenseNovaU1Draws (internal/gateway) fetches a fake SenseNova
/models (a chat and the U1 model), checks Drawers lists the U1 model
alone, draws it (images API, b64 back, chat never asked) and edits it
(JSON images). Broken by hand: without "sensenova-u1" in DrawsID it is
red (drawers []); with senseNovaDrawer returning false it is red (the
fake answers a link, image ""), and the edit would go multipart.
Run at this head: gofmt -l (clean), go vet ./..., GOOS=linux go vet
-tags nogui ./..., GOOS=windows go vet ./..., go build, GOOS=linux go
build -tags nogui, GOOS=windows go build, and
go test -tags nogui -timeout 45m ./internal/catalog ./internal/gateway
./internal/provider ./internal/imagemcp ./internal/gui: catalog, gateway
(566s), imagemcp and gui ok; provider crashes in
TestUnreadLoginsWriteErrorsKeepCredentials (synctest channel closed
from outside its bubble in filememo.Forget), which is #3632, open and
red on main since
|
||
|
|
6eb510f788 |
codex: a relay's own Codex entries reach Codex as it gave them (ctopsc on Discord)
ctopsc's custom provider points at a self-hosted sub2api (Responses). Its plain /v1/models gives id, display_name, owner and created alone; asked with Codex's client_version it answers Codex's own catalog shape per model (window, max window, levels, base_instructions, tools, truncation, tiers). magpie read the plain list and made Codex's entries up from models.dev, so GPT-6.1 Terra went to Codex at 922000 where the relay said 272000. What changed: - catalog: a list row in Codex's shape (slug, supported_reasoning_levels, shell_type, base_instructions: CodexEntry) is kept whole on the Model (Codex), its window, max window and input modalities read off it. - provider: for a provider the user added by its address (no preset, no account) whose Responses list has no such row, fetchOne asks the same URL once more with client_version (codexEntries). Only where the list is fetched (add, key change, Refresh), never per Codex poll. The answer only adds entries to models the plain list has. One that fails or can't be read keeps the last list's entries (a failed read is unknown); one that answers plainly says there are none. The entry's levels become the model's levels, and withUltra adds none to it. - codexcat: listedEntry hands Codex the relay's entry as given, base_instructions included and unchanged, with magpie's slug, name, priority and " via magpie" description. The user's window, compaction, levels and image setting still win (levels keep the relay's descriptions). A model without one is made as before. - agent: Codex's magpie-models.json gets the same entries. - docs: providers-accounts.md, "A relay's Codex entries". Run at this head (sandbox HOME, pinned caches): - go test -tags nogui -count=1 ./internal/catalog ./internal/codexcat ./internal/provider ./internal/agent ./internal/gateway before the rebase onto |
||
|
|
f51ab771f6 |
catalog, provider: a model only models.dev's lab lists is known, and a Claude account lists the gated models Anthropic told its Claude Code of (iebb on Discord)
iebb on Discord (10-27): his account has Claude Mythos 5.1, magpie doesn't list it. models.dev took the gated Mythos 5.1 out of anthropic's provider list (models.dev #11327) and kept only its lab file, models/anthropic/claude-mythos-5-1.toml (#11328). Cause. magpie read only models.dev's api.json (providers -> models). The Claude subscription's list was exactly catalog.Provider("anthropic"), so Mythos 5.1 left it with that PR. And a vendor list that still returns it (an Anthropic key's /v1/models) got no window, reply limit, name or thinking for it, since nothing read the lab catalog. Fix. - catalog: Sync also keeps models.dev's lab catalog (models.json) as labs.json beside the cache, through temp+rename; a failed fetch keeps the last one, and a cache without it is Stale once a process. A model only a lab lists votes into the same tables as a listed one (ContextOf, OutputOf, NameOf, Thinks, SeesImages); a model a provider lists keeps what providers say. A thinking lab-only model with no levels takes those of the newest of its family a provider gives (labKinEfforts: Mythos 5.1 takes Mythos 5's). catalog.Describe builds a Model from an id for lists that name ids alone. - provider: the Claude account's list is models.dev's anthropic list plus what Anthropic told the account's Claude Code beyond it, read from .claude.json's additionalModelOptionsCache / modelAccessCache / additionalModelCostsCache (Claude Code's own sign-in and each saved account's directory). Account.Lists honours modelAccessCache's entitled per account, ListPrice falls back to Anthropic's price from additionalModelCostsCache, and the agent's own Claude Code picker (claudeOwn) offers the signed-in account's extras. WSL keeps the catalog list. magpie still asks Anthropic nothing with a Claude sign-in; nothing is sent differently, no Claude Code mimicry change. - docs/subsystems/providers-accounts.md: two rows, the lab catalog and a Claude account's models. Testdata: models.dev's api.json and models.json as served on 10-27, cut to the anthropic and azure providers' Claude models and the anthropic lab. Tests never reach the network. Run: - TestLabOnlyModelIsKnown, TestLabsLeaveListedModels, TestSyncKeepsLabs, TestClaudeAccountListsGatedModels, TestAnthropicKeyGatedModelDescribed: pass. - go test -count=1 -timeout 45m ./internal/catalog/ ./internal/provider/ ./internal/agent/ ./internal/gateway/ at |
||
|
|
ea33a78a05 |
provider: a proxy's level- or speed-named model takes its model's levels (nianshou5)
nianshou5 on Discord added their own CLIProxyAPI (CPA) as a custom provider, and its models offered no reasoning effort in the ChatGPT app while a plugin's did. CPA's /v1/models gives id, object, created and owned_by alone (sdk/api/handlers/openai OpenAIModels strips its registry's thinking levels), so every level comes from magpie borrowing the model's. That works for an id models.dev knows (gpt-5.5, claude-*, gemini-*, deepseek-*), but CPA's Antigravity and xAI channels name a model for the level or speed they serve it at: gemini-3.8-flash-high, claude-opus-5-5-high, claude-opus-4-6-thinking, gpt-oss-120b-medium, grok-3-mini-fast. No catalog lists those names, so they had no levels, and Codex, the ChatGPT app, /v1/models and the gateway's effort fitting all read none. CPA's own registry gives those models levels or a thinking budget it fits an effort to. borrowedEfforts, which is reached only for a model its provider gave no word on, now tries the id without a trailing -minimal/-low/-medium/-high/-xhigh/-max/-thinking/-fast (catalog.Unsuffixed) after every other match failed. A vendor whose own list names a model so keeps its own word (effortsOf takes the provider's), and a variant whose base magpie doesn't know (grok-4.7-build-fast) still takes none. Every list reads Entry.Efforts or Provider.Known, so Codex CLI's magpie-models.json, the Codex and ChatGPT apps' /backend-api/codex/models, /v1/codex/models and /v1/models' reasoning_levels all change together. The reporter's one visible id, whatstoken/deepseek-v4.1-flash-1017, already borrowed low,high,max on main against this machine's real models.dev cache; their other two CPA ids are not known yet (asked on Discord). So this fixes the class of CPA ids that had none; it may not be their case. TestCPAVariantModelsBorrowLevels serves CPA's /v1/models bytes from an httptest server, fetches them with catalog.Fetch, and checks Entry.Efforts, Provider.Efforts and the Codex list's supported_reasoning_levels. It is red with the fallback turned off by hand (three ids with "" in each list) and green with it. Run at the pushed head (rebased on origin/main |
||
|
|
0b72ccbeff |
agentplug: connect's models carry /v1/models' native_endpoints and pricing
cleary5779 on Discord builds an agent as an agent plugin and wants, in
connect({ gateway, model, models }), the API each model passes straight
through on and what it costs. Each entry of models (and model) now also
has, by the names /v1/models uses:
"native_endpoints": ["/v1/chat/completions"],
"pricing": {"prompt": "0.0000003", "completion": "0.0000012",
"input_cache_read": "0.00000003"}
Each is left out when not known: a group or a model translated anyway
has no native_endpoints, an unpriced model no pricing, never [] or 0.
The fields connect had (id, name, context, output, images, efforts) are
as they were.
No second lookup: nativeEndpoints moved from the gateway to
provider.NativeEndpoints, and openRouterPricing/perToken to
catalog.OpenRouterPricing/PerToken (internal/catalog/openrouter.go); the
gateway calls them as before. magpieModels already priced each model with
provider.EntryPricer, the price /v1/models gives (m.Price); it now also
keeps NativeEndpoints in catalog.Model.Endpoints (json:"-"), which
plugged's wire turns into the two keys.
Docs: reference.md's agent plugins section (what connect gets, with an
example), agent-wiring and gateway-routing subsystem pages, and the
site's Plugins page in en, zh and ja.
Run at this tree (on origin/main
|
||
|
|
b094a577f5 |
catalog: a price and an endpoint's catalog are looked up in indexes, and a list is priced at one read of the providers
/v1/models is about to price every model it lists (next commit), and the
lookup it shares with the Usage pages was too slow for a path agents poll:
for 755 models over 30 providers, pricing alone took ~35ms a list.
- catalog.PricedBy walked every model of every models.dev vendor it was
asked, lower-casing each key, five times over for an id it doesn't
list (the bare pass, the dashed pass, both canonical passes).
priceIndexOf builds per provider, once a catalog load (keyed on the
Reset count read under loadMu, loadGen), the first key by bare id and
by dashed bare id, and the agreed price under each canonical id.
Same answers: the old PricedBy, kept beside the new in a scratch test,
gave the same price and ok for 120,546 ids (every key of the real
5.9MB models.json, upper-cased, dot-for-dash, with a path and :free,
with -nope, and each canonical id) over six vendor sets, all vendors
included.
- catalog.AtEndpoint walked every vendor's API each call (asked by
EndpointCatalog in every ListPrice); now an index by endpointKey, once
a load.
- provider.EntryPricer is EntryPriceIn for a list, reading All() once
instead of once a model (byIDOrWas copied every provider for each);
EntryPriceIn calls it, and agent.magpieModels (Pi's, dsh's model
files) prices its list through it too.
Run at 9afa86306 (both commits, on origin/main
|
||
|
|
9b0f48612b |
gateway: a plugin's model that searches by itself can be the web searcher
01huadalang (Discord #feedback, 10-20): Settings › Web search offered only Antigravity; Trae's search model couldn't be picked, "可能也有别的模型能搜索 但是识别不到". partSearcher and modelSearches answer false for every provider with an account behind it, so no plugin-served provider was ever offered, and a plugin had no way to say which of its models searches. A plugin now marks such a model with `searches: true` (in its config models or the list its models hook gives). host.js passes it on, plugin.Model carries it, and pluginCatalog makes it WebSearch "native". partSearcher offers a plugin provider with such a model, with those models only, at rank 4 (as Command Code's search models); remoteSearch asks it in plain words, the way it asks Command Code's. A client's own web_search sent to that model still goes to magpie's searcher (searchesModel is unchanged): the plugin's upstream takes no web_search tool. Behaviour change: a marked plugin model ranks ahead of Antigravity and Google (rank 5) when magpie picks the searcher itself. Run: - TestPluginSearchModelIsASearcher (new; a fake plugin's model marked searches answers a weather question with a URL): red on the old code (the picker offers [], want the plugin's fake-search alone), green now. - Broken by hand: host.js without the `searches` passthrough; the test goes red at the picker. - gofmt -l clean; go vet darwin, linux -tags nogui, windows on gateway, plugin, provider, catalog. - set -o pipefail; go test -timeout 45m ./... at this tree: 68 ok, no FAIL. Not tried: the Trae plugin itself. It declares nothing about search yet; marking Trae CN's search_agent there needs a Trae account to try it with, which this machine doesn't have. No GUI files changed. |
||
|
|
f73f39050d |
catalog: a provider's model list is built once a load, without copying every model to the heap for each
Why magpie's own process sat at ~650 MB: a live heap profile of a
user's magpie (magpie heap, 48 minutes) held ~157 MB live but had
allocated 34.8 GB, ~725 MB a minute, so Go's heap peaked near 885 MB
and the footprint followed it. KeepDshWired's round every 30 seconds
was 11.8 GB of it: magpieModels("dsh") → Provider.Catalog → ... →
catalog.Provider for each catalog, which built every model again, and
mdProvider.levels alone was 5.97 GB flat. Its `kin = &x` took the
address of the range variable, so every model of the provider was
copied to the heap for every model asked: allocations grew with the
square of a provider's models.
- levels keeps the kin by id, date and levels, the same choice as
before (newest by release date, then id, with levels, not after the
model), with no pointer to the loop's copy.
- Provider keeps each provider's list for the load it was built from
and gives callers a copy of it; Reset drops them, and a list built
from a load that a Reset ended meanwhile isn't kept (gen).
Run:
- real models.json (5.8 MB), Provider for every provider id, a pass:
63.5 MB / 272,952 allocs before; 8.96 MB / 10,478 with the levels fix
alone; 3.2 MB / 232 with both (a throwaway benchmark, not committed).
- TestProviderAllocsGrowWithModels: red with `kin = &x` put back
(40012 allocations for 200 models, at most 2000 wanted); red with the
memo not stored; red with Provider handing out its own slice
(a caller's change reached the next one). Green on this code.
- go test -race -count=3 ./internal/catalog: ok.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui on
catalog, provider and agent: ok.
- Full suite, go test -count=1 -timeout 45m ./... on this batch at load
~380: every package ok but agent and gateway (past 45m, #2869),
TestQueueFullAndWaitedOut (#3061), TestRequestBuildsProvidersOnce
(#2965), TestMainWindowCorners (#2645, red alone on main too) and the
app.js budget (raised in its own commit). gateway alone: ok but
TestClaudeAccountsSpentFallBackToCodex (#2858); agent alone past 45m
at load ~600, its codex/running/connect tests ok alone.
Not done here: a singleflight in provider's heldOf was written and
taken out again; a waiter blocking on another request's build can
deadlock if that build needs a lock the waiter holds, and nothing here
proved it can't.
|
||
|
|
81a24cf8fe |
groups: a found group is listed as auto/<model id as the vendor spells it>
ZeroClover asked on X: Auto Group ids group/auto-<slug> can't be looked
up on models.dev. A found group is now listed and written as
auto/<model>, e.g. auto/claude-opus-5.5: /v1/models, the catalog, agent
configs, the GUI's Routing page and the CLI. Context and output limits
come from the model's metadata as before.
What stays the same:
- The internal id is still group/auto-<slug> (Group.Ref() gives the
public one). Every old form is still accepted as input forever:
provider.CanonicalRef turns auto/<model>[:level][[1m]] into it at the
gateway (validateModel), keys, stats, affinity and usage, so both ids
route to the same group and count as one.
- A key's model list allows a model by either id, group/* included
(allows() in key_models.go).
- Hand-made groups stay group/<id>.
- A provider whose stored id is "auto" keeps its models: while one
exists, found groups are listed by their old id (AutoRefsOn) and
auto/<x> means that provider's model. Documented in
docs/subsystems/gateway-routing.md.
Agent configs: SyncCatalog rewrites a field that holds a found group's
old id (renameFoundGroups), but only while the value is still what
applied.json says magpie wrote; a value the user set stays. A pick by
the old id written now is written as auto/<model> (Apply). Hidden,
picked and ordered model lists saved by the old id hold for the new one
(visible.go), and a bare model id still reaches its found group (bare.go).
Claude Code is given a dotted Claude version dashed (ClaudeSpelled), so
auto/claude-sonnet-4.5 sits in its settings as auto/claude-sonnet-4-5.
That routes to the same group, but with found groups off nothing reads
it back dotted, and Reseat took the field for changed and left the agent
on a group that was gone. Reseat now compares a group pick by its
canonical id (samePick). The old ids had no dots, so this is new with
auto/<model>.
Run at this tree (sandbox HOME, caches pinned):
- gofmt -l: clean. go vet ./...: clean on darwin, GOOS=linux -tags
nogui, GOOS=windows.
- go test -p 4 -timeout 45m ./...: every package ok except agent and
gateway, whose failures were the tests' expected ids (updated here)
and two regressions now fixed (bare ids; desktop models hiding groups
by prefix). Every failing test passes on rerun. Load average was
~210-290 from other sessions throughout.
- Reruns: provider, cli, codexcat ok. internal/gui: only
TestSetAnswersWhileDevinAndProvidersHang fails (set slow/slow-1 took
10.19s), and it fails the same in a git-archive export of
|
||
|
|
224ea7d5be |
catalog: a reset drops what a request built of the old catalog
5351343e7 keeps what a request built of the catalog for the next request within heldFor, dropped by every write magpie makes. A reset of models.dev's catalog (catalog.Reset) wasn't one of them: Sync tells Touched after it, but a Reset alone left the providers' entries with the old windows and output limits for up to a second, and Pi's and Crush's model lists written in that second carried them (TestPiModelsCarryMaxTokens, TestCrushModelsCarryMaxTokens red in the full run: "unknown output sent: ...maxTokens:131072"). Reset now tells Forget (provider.Changed) after it lets go of its lock. Test: TestHoldKeptUntilAWrite gains "the catalog reset". Broken by hand (Reset not telling Forget): red, "the catalog reset: built 0 times, want 1", and both agent tests red again; fixed, the agent tests pass 3 of 3. Run: go test ./internal/catalog -count 1: ok (3.4s); go test ./internal/provider -run TestHoldKeptUntilAWrite: ok; go test ./internal/agent -run 'TestPiModelsCarryMaxTokens|TestCrushModelsCarryMaxTokens' -count 3: ok; go vet ./internal/catalog ./internal/provider. |
||
|
|
9f9bfc1600 |
gateway, provider: a Codex account's models say Codex's 272K window, not models.dev's 922K (netube on Discord)
netube's Codex Plus account showed a 922K context window on Routing. 922000 is models.dev's input limit for gpt-5.5, which is OpenAI's API's window. Codex holds a ChatGPT plan's conversation to the context_window its own list gives (272000). There were two causes: - codex_backend.go's end() took catalog.ContextOf(model) (models.dev) as the window for a turn Codex sent natively. It now takes provider.CodexWindow(user, slug), and falls back to models.dev's window only when no list says. CodexWindow checks, in order: the window the user set on the codex provider; the account's own live list; magpie's Codex subscription's list; Codex CLI's models_cache.json. - catalog.parseCodex dropped context_window, so until the live list was fetched, a Codex subscription's models (catalog.Codex) fell back to models.dev's 922K. That reached the Providers page and Routing (WindowOf), the Entry.Context agents are told, and siwcWithCodex. It now keeps Context. Only Codex is affected. A provider on OpenAI's API that serves the same id keeps models.dev's 922K, and both tests check that. Tests: - TestCodexNativeTurnTakesCodexWindow (gateway): a native turn's Prompt.Window is 272000 from models_cache.json, 258000 from the subscription's live list, and 400000 when the user sets it. An "oai" provider's gpt-5.5 stays at 922000. - TestCodexModelsTakeCodexWindow (provider): checks WindowOf, CodexWindow (and 0 for an unlisted slug), and the catalog entry's Context, with an OpenAI API provider kept at 922000. Broken by hand: - codex_backend reverted to ContextOf: the gateway test went red, with 922000 in all three cases. - parseCodex's Context removed: the gateway test went red on its first case, and the provider test went red on WindowOf 922000, CodexWindow 0 and the catalog entry 922000. - Restored: both green. Run: - gofmt -l: clean. - go vet: darwin, GOOS=linux -tags nogui, GOOS=windows -tags nogui. - go test -tags nogui -timeout 45m ./... at 7660399a1+this: 64 packages ok. internal/agent and internal/gateway hit the 45m timeout under a load average of ~270. The running tests were 1s and 6s old (TestReseatOff, TestClaudeCodeSeenOnAnyRoute), so this was slowness, not a hang. - Rerun at the rebased head with -timeout 90m: EXIT=0, 66 packages ok, none failed (agent 3761s, gateway 3105s), on cb05dc2d1+this. - Rebased then onto |
||
|
|
ef6d5ca400 |
provider: a model's listed APIs, Cline/Kilo free mark and remote price are looked up, not the whole list copied for each, so 2,500 models' /v1/models is 0.8s again (K.Liu on Discord)
K.Liu: /v1/models with 2,000+ models took 2.8s on 127.0.0.1, where it took 1.6s before, so third-party apps couldn't show the whole list. Cause: |