ac4af582301a4e8a29245dbba767eba31334ddf9
224
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ae58ec9b44 |
providers: a key's provider can have its model list off
axelburks on Discord: Ark's pay-as-you-go list names models that can't be asked for, and each one is asked by an endpoint id the user made. A key's provider can now have its list off (Provider.ListOff): nothing asks its vendor for a list (Fetch, Refetch, List, RefreshLists, a test, a new key's prefill, a resting key's probe), a list fetched before and models.dev's are not read, and only the ids added by hand are served. The editor shows it as "Fetch the model list", ticked by default; unticked, Fetch models and Forget go. A save that doesn't name listOff keeps it. CLI: `magpie provider set <id> list=off`. Accounts and plugins list as their sign-in does, so they don't take it. Broken by hand: ListAsks returning false for a list-off provider turns TestListOffAsksNoListAndServesTheIDsAdded red; dropping the keep in the save turns TestProviderSaveListOff red. Run, on this stack over origin/main |
||
|
|
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) |
||
|
|
6ac1e04244 |
provider: a Claude model on Copilot has its 1-hour cache write priced as Copilot bills it, at the 5-minute write (#3435)
Copilot bills a cache write at one price however long it is kept. Its copilot_usage counts a 1-hour write as the cache_write a 5-minute one is, and GitHub's "Models and pricing for GitHub Copilot" (docs.github.com/en/copilot/reference/copilot-billing/models-and-pricing) lists one "Cache write" price per Claude model, no 1-hour tier (Opus 5.5: input $4, cached input $0.20, cache write $5, output $20). magpie gave every Claude model's list price Anthropic's 1-hour write, 2x input (catalog.OneHourFor), so copilot/claude-opus-5.5 was priced at $8 per million for an hour's write where Copilot bills $5: on the reporter's request, $0.125456 against Copilot's own $0.078443. A Copilot price (tariffOf, cacheWritesAlike) now has no 1-hour write of its own, so an hour's write is billed as a 5-minute one (catalog.Price.OneHour), its tiers alike, copied as they may be the catalog's. This holds for a call read after Copilot was signed out too (tariffOf's unknown-provider path, MakerPrice), which the reporter's patch left at 2x. A price the user gave for a Copilot model keeps the 1-hour write they gave, and one they left out isn't filled with 2x input (userPrice, so UserBasePriceIn reads it alike). Every other provider is as before: Anthropic, Bedrock, Vertex and relays bill the hour at 2x, so the rule is scoped to Copilot's id, not taken off every non-Anthropic provider. Usage rows are priced as they are read (Record.CostAt), so calls already recorded read at the new price too. docs/reference.md and ModelPrice's comment say so. Run on mote (go1.26.8, macOS) at |
||
|
|
fe61503e60 |
provider: a Remote magpie whose computer took another address is found on the network
luckymanjc (Discord) uses computer A's magpie from computer B over the
LAN. A's router hands it a new DHCP address after a boot, and B's Remote
magpie, saved at the old one, reached nothing until the address was
typed in again.
When B can't connect to a Remote magpie at all (a dial error, not an
answer), the list fetch (models.go) and the gateway's request (forward
in gateway.go) now call provider.SeekMoved (remote_moved.go). It dials
every address of the old one's /24 and of up to four of B's own private
/24s at A's port (500ms each, 128 at once). The first that lists
/v1/models 200 for the provider's key, and whose list this magpie didn't
make (magpie_via), is A: a LAN caller always needs a gateway key, so
another magpie answers 401. That address is saved as the provider's and
the request is made again there. A name or a public address is never
looked around, an address the user changed meanwhile stands, and a
provider is looked for once a minute at most, callers at once sharing
one look.
Run:
- mote-run go test -count=1 -run 'TestRemoteMagpie|TestLANNeighbours|TestDialable|TestRemoteSelf' ./internal/provider ./internal/gateway: ok
- mote-run go vet, GOOS=windows and GOOS=linux go vet of both packages: ok; gofmt -l clean
- Live: A was a real magpie on mote (10.0.0.121:3511), B a -tags nogui
build in WSL magpie-desktop (127.0.0.1:3522), sandbox HOMEs. B's
provider was saved at the dead 10.0.0.250:3511. B's start fetch found
A ("found at 10.0.0.121:3511, saved there") and a chat answered 200 in
4.2s. Then, with B running, the address was set dead again: a request
to office/group/rot found A and answered 200 in 4.4s, saved at .121.
Broken by hand, each red: the gateway hook off (502), the fetch hook off
(fetch error), the self check off (saved at this magpie itself).
Not tried: a real Windows A; a mDNS name (.local) that changed address
(left to the name); A on a different /24 than B. On Linux a dial to a
dead LAN address took ~54s (no route to host) before the look starts;
not changed here.
Reported-by: luckymanjc. (Discord)
|
||
|
|
978284dd69 |
gateway: a transport failure or a plain 502 is not told as too long
Filed as #5486. ne9ko9 runs Codex through magpie to a custom OpenAI Responses relay (gpt-6-astra, effort max). Three failures reached Codex as HTTP 400 "prompt is too long: about 385K/404K tokens, more than gpt-6-astra's context window of 272000": a plain 502 "Upstream service temporarily unavailable", a TCP connect timeout (dial tcp … connectex) and a TCP read timeout. Codex took them as context_window_exceeded and ended the turn instead of asking again, although the same session had just been answered at 454K and 474K, and Codex's own window was 828,400. tooLongUnsaid now: - reads a 5xx as an overflow only for Devin (busyOverflows: p.ID or its plugin's host), the vendor |
||
|
|
cd9c52c16e |
library: a Remote magpie's MCP router is a Library server of its own
With another magpie as a provider (preset remote-magpie), its router's
MCP servers took adding that same magpie again under Library -> MCP.
Now the gateway's info (GET /v1) says "mcp_hub": true to a caller it
serves MCP to while its router is on with a server that isn't itself
another magpie's router. A fetch of a Remote magpie's models asks that
info with the provider's key, only while the library would still give
it a server, and the library then adds one: named for the provider,
http at <root>/mcp/magpie/hub with Authorization: Bearer <key>, kept to
this computer (local), on for the agents given the hub's entry.
- Offered once (bridgesOffered in library.json): removed or switched
off by the user, it stays so until the provider is removed and added
again.
- A server the user already has at that magpie's router (same origin,
the router's path) is the one; none is added beside it.
- The provider removed takes its server out (adoptBridges, at Sync and
the View read); providers.json unreadable takes nothing out; the
provider's address or key changed changes the server's; edited to
another address or key it becomes the user's own (keptBridge).
- No loop: every dial to a URL under /mcp/magpie/hub carries
X-Magpie-Router, and a request with it is given no such server,
neither listed (library Tools, gateway hubServersOf) nor run (Call,
hubToolNamed). A server carried in by sync is never a bridge.
- No GUI change: it is a server row as any other.
Run (mote, at base
|
||
|
|
773902a77b |
provider: Find copies the provider it gives; a list asks each group once
In the same live profile (v0.1.2906, two idle minutes, 269 MB): - provider.Find copied every provider through All, each account's keys and headers, to give one (9.3 MB); All's copies were 4.6 MB of their own. sharedAll is the providers held, for reading; Find and resolveIn copy only the one they give, and the pricers read sharedAll. - buildModels asked a group's members up to five times (its compaction, its price twice, its protocols, its tiers), each walking the members and resolving each (GroupFinder 7.9 MB, membersFound 6.3 MB). provider.FoundOnce answers each group once per build; every caller only reads the members. Run (mote, at this tree): - gofmt -l internal, go vet ./..., GOOS=windows and GOOS=linux go vet ./internal/agent/ ./internal/provider/: clean - go test -count=1 -timeout 45m ./... (all three commits' tree): 85 packages ok, internal/gateway 748s, internal/provider 193s. Two red: internal/gui's TestMainWindowCorners/macOS_26_SDK, mote's macOS 27 (#3949, filed before, untouched here), and internal/agent's TestCodexEffortOptionsReadTheKeptList, whose bar counted the environment's copy (see the effort test's comment), fixed in its test. - then go test -count=1 -timeout 45m ./internal/agent/ with that fix: ok (200.1s) Broken by hand (mote, -run): - Find through All again: 167 allocations against a bar of 60, red; green it is 6 (TestFindCopiesTheOneItGives, which also checks that a change to what Find gives reaches neither the next Find nor All). - FoundOnce forgetting what it found: group:a walked 5 times, red (TestFoundOnceAsksEachGroupOnce). Not tried: the numbers on the live app after this build. |
||
|
|
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. |
||
|
|
baf70992f6 |
usage: a call the vendor answered with another model is priced as the model that served it (#5340)
The ledger priced a call at the model asked for and fell back to the
model the reply named (Served) only when the asked-for one had no price
(#1498). That order is right for a relay that sells kimi-k3 as
moonshot-kimi-k3 and bills by the name it sold, but it also priced a
real substitution: claude-opus-5-5 asked, claude-opus-5 served. The
vendor bills for the model that ran. kaimo455's ledger had 836 such
rows, every one at the asked-for rate: $374.06 reported against
$493.28 at the served model's rate. gateway-key cost limits (KeySpent,
NewCoster) and budgets read the same pricer.
Pricer now prices a call the ledger marks swapped at the served model's
price. That covers a price the user set for the served model and every
other layer of BasePriceIn. A price the user set for the model asked for
still wins, 0 included (new provider.UserBasePriceIn is BasePriceIn's
user layer alone). When the served model has no price, the asked-for
one's stands. Renames, vendor aliases, serving names and region
deployments price as before, and rate windows still read each record's
own time. apiPricer, the API price behind a subscription window's whole,
follows the same rule: the served model's API price first, then the
asked-for one's.
Review changes on top of ggbdpq's patch:
- The swap is judged the way the ledger's Swapped column judges it: on
the model id and on the name that went out (SentNameIn over the
user's ModelWires). A model the user sends under the served one's name
was answered as asked, so it keeps its own price. The patch judged the
model id alone, so such a row was priced as swapped while the Requests
page said it wasn't. The pricers' memo keys now include the effort,
because the sent name depends on it.
- apiPricer (window holds) got the same rule. The patch left it on the
old order.
Tests:
- TestLedgerPricesASwappedCallAsTheModelThatServed (patch, plus a
ModelWires case) checks the ledger and the Requests page.
- TestLedgerPricesARenamedModelAsTheOneServed: the sol row (sol asked,
kimi-k3 served, both priced) is a genuine swap, so it now prices at 3,
not 2.
- TestHoldsPriceTheModelTheReplyNamed: claude-opus-4-7 answered by
gpt-5.5 is priced at gpt-5.5's API price. Answered by an unpriced name,
it keeps opus's.
Run on mote at this tree, on origin/main
|
||
|
|
acde144a7a |
providers: a vendor of embedding and rerank models alone is detected on /embeddings and /rerank (heatonz)
heatonz on Discord (#help, 11-05): a custom provider whose models are only
embedding and rerank models couldn't be added. Detect APIs ("检测协议")
picked the first listed model, an embedding model, and asked it to chat on
every API, so nothing answered.
- tiny: an embedding or rerank model (catalog.ServesOf) on Chat is asked
where the gateway's retrieve sends it: the OpenAI base's /embeddings
({"model","input"}) or /rerank ({"model","query","documents"}). tested
adds no extra body there, as the gateway sends none.
- detectModel asks each API a model that chats when the list has one, so
a chat vendor's detection is unchanged. A retrieval model is a last
resort on Chat only. Responses, Anthropic and Gemini say why they weren't
asked (DetectModels too).
- testModel: a saved provider with nothing to chat with tests on a
retrieval model its list keeps apart (LiveServing). testOne asks such a
model on Chat and never moves it to another API.
- provider.ListAll is List with Serves models kept. /api/provider/list and
the provider's JSON carry a `retrieval` count. The add form's Fetch models
and the saved editor say "Only embedding and rerank models are listed.
They need no pick: ask them on /v1/embeddings and /v1/rerank." in place
of "the list is empty". One new string, in zh, zh-TW, ja and de.
- app.js stays under TestCoreScriptBudget with no raise: +42 bytes, paid
for by two add-form comments cut.
- The gateway already routes /v1/embeddings and /v1/rerank to such a
provider (#765, resolveRetrievalModel by prefix or KindGroup), so nothing
changed there.
Run (mote, at this tree on origin/main
|
||
|
|
cfadcde168 |
provider: a model list OpenCode's key is refused is asked again bare, so the picker says what the vendor serves (#4900)
What changed: OpenCode's model lists are public - the vendor answers its
/models without a key. When a provider's keyed ask of the list is
refused (an expired or wrong key), the same list is asked once more
without credentials, and what the vendor serves is saved as the
provider's list. The picker then shows the vendor's word instead of
falling back to the models.dev catalog, which files free rows under
opencode-go that Go doesn't serve (cat-jam-free, minimax-m3.1-flash-free,
step-5-preview-free, longcat-2.5-preview-free) while missing the free
rows it does (beam-free). The retry is kept to OpenCode's own hosts
(IsOpenCode): no other vendor's list is known to answer bare, and a
partial public list would stand in for the keyed one. Multi-key
providers, account (sign-in) lists and the add form's List are not
covered.
Reviewed and ported (on origin/main
|
||
|
|
2f59545d29 |
gateway: a key not given a group listing alone is listed the members it may use (luckymanjc)
luckymanjc on Discord (#general, 11-05): on a second computer, through
Remote magpie, his three Codex accounts offered GPT-6-Luna alone, with
the key his Remote magpie uses held to "Codex 的全部模型" (codex/*),
GPT-6-Luna and the accounts. His screenshot of that key's picker, on the
host, offered GPT-6-Luna alone under Codex too.
Cause: a routing group listing alone (Group.Unlists, "the group alone")
keeps its members out of Catalog(), so out of /v1/models and the key
picker (/api/caller-keys/models), as the group stands in for them there.
Since
|
||
|
|
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
|
||
|
|
1826c4bd99 |
providers: a Remote magpie that is this magpie says so and is left out, unless kept (hanslin1666)
B uses A through a Remote magpie provider, and sync carries that
provider to A, where it points at A. Each of its models was one of A's
own, listed again beside it and taken by A's found groups, and a request
through it passed through A's gateway twice.
A fetch of a Remote magpie's list now reads its models' magpie_via: when
the magpie that listed them (the last entry) is this magpie's own
catalog.Self, remote-self.json keeps the provider id and the address it
answered at (noteSelf). Another lister, or a list with no via, takes
the record away; an empty list or a failed fetch changes nothing; a
provider moved to another address is not self until a fetch there says
so. The file is this computer's own, never in a backup or sync.
Such a provider is left out (SelfLeftOut in On, SwitchedOff and
remoteMagpies): not in /v1/models, the catalog or a found group. A
request naming one of its models, an agent's pick synced from B, is
served here with the remote's id taken off (ThroughSelf in Resolve and
ResolveRoute), once through the gateway. A 404 for it says why and how
to keep it.
The Providers row shows "This magpie" (greyed while left out), with the
reason as its title; the editor has a note and a "Use it anyway" tick
(KeepSelf, POST /api/provider/keepself). KeepSelf belongs to the user
and to this computer: Mirror and Restore keep the local value (false for
a provider new here), davsync's hashes blank it, and a provider save
keeps it. Strings in en, zh, zh-TW, ja, de.
Docs: providers-accounts.md (two magpies row), sync-backup.md (what
stays on each computer).
Run at this tree on origin/main
|
||
|
|
7b5e773873 |
provider: a model at a window (claude-opus-5-5@300k) is priced as its model, so Cursor's sized ids have a cost
RyuJeXu on X (tweet 2117971061103100279), building an iOS board on magpie's
usage data: "cursor的用量好像不计费呀". Cursor calls showed no cost.
Cause: the Cursor plugin lists each model once per context size
(claude-opus-5-5@300k, @1m, gpt-5.5@272k, ...), lists them all at cost 0
(no price, pluginPrice), and its reply echoes the asked id, so usage rows
carry the sized id. pricedNames only took a window off grok- ids, so every
other sized id fell through the maker catalogs with no price. The plain ids
(claude-opus-5-5) were priced at the maker's list price all along.
Fix: pricedNames also tries the id with an "@<digits>k|m" window taken off
(modelWindow), for every provider. The window names the context size, not
a different model; long-context tiers still follow the call's own prompt
tokens through Price.At. Dated ids (claude-opus-4-5@20251101) and ids with
anything else after the @ are left alone. The regexp runs only for an id
with an @, since every listed model is priced on each Providers poll.
Tests:
- internal/provider/cursor_price_test.go: a moved Cursor provider prices
@300k, @1m, upper case, a maker-prefixed id and gpt-5.5@272k/@1m as the
plain model, through ListPrice, MakerPrice, PricedName(For), and its
tier at 300K prompt tokens; a dated id, "@272", "@", "@272kb", an
unknown model and auto stay as they were.
- internal/usage/cursor_window_cost_test.go: a Cursor row for
claude-opus-5-5@300k costs what the plain id does ($6 each), auto stays
unpriced, the page total is $12.
- grok_price_test.go: gpt-6-astra@500k under grok is now priced ($10/$50);
grok-4.7-build@500k still isn't.
Run (all through mote-run, go1.26.8, base
|
||
|
|
1a67ca614e |
provider: Fetch models refreshes each key's own models, keeping what the user un-ticked (young02036)
young02036 on Discord: a provider holds several keys, each at a group of a relay's that serves different models. Each key's own list was read only when the key was added (PrefillNewKeys); Fetch models merged every key's list into the provider's (fetchPerKey marks each model with the keys that list it) but never changed a key's own models, so a model a group took on later was never sent to its key and one it gave up still was. Fix: refetch, which every Fetch goes through (the editor's button, the CLI, the TUI, the automatic re-list), takes each key's marks before and after the fetch and carries the difference into that key's AccountModels (key_models_refresh.go): a model the key's list has now and didn't before is ticked for it, one it had and has no more is taken out. A model the user un-ticked that the list had before and still has stays un-ticked; one the user ticked that the list never had stays ticked. Only keys with a list of their own are touched (a key serving every model still does), a key with no marks before or now (one key on, just added, a list that failed) is unknown and left alone, nothing is ever narrowed to an empty list, and a key whose models the user changed while the lists were asked keeps the user's. The provider's own picks (what agents get) are not touched. No GUI change: the editor's Fetch already redraws the key rows from the saved provider. Test: TestFetchRefreshesEachKeysModels, against an httptest relay whose per-key lists change between fetches: add a key (prefill), un-tick by hand, groups change, fetch; un-tick again and tick a model the list lacks, fetch twice; a key's list failing; the provider's picks unset. Red on the old code (the refreshKeyModels call removed): "sk-a after a fetch: [gpt-5.5 deepseek-v4], want [gpt-5.5 kimi-k3]", "sk-c after a fetch: [deepseek-v4 qwen3-max], want glm-5 ticked", and the gateway's AccountServes check. Broken by hand: ticking every listed model instead of only those new to the key turns the un-tick, hand-tick and failed-list cases red (4 errors). Run on mote at this tree (on |
||
|
|
47b7ba3030 |
models: a model its provider lists at $0 says free in the pickers and Routing (jiangguochao666 on X)
jiangguochao666 asked for each provider's free models to show in Routing and the model settings, to route to them. The green free tag was shown only for a plan's free model or a model with "free" in its name. provider.PricedFree says a model is free only when its price for that provider is known to be $0: - A price the user set comes first (provider/model, provider/*, then the model's own key). A $0 one makes it free, and any other price, a paid tier included, makes it paid. - Otherwise the provider's own catalogs decide. A $0 from a plan's catalog (-plan, membership catalogs) is the plan's per-token price, not free. A $0 from only the model's maker is not free either: a relay serving Zhipu's free glm-4.7-flash may charge for it. - No known price means not free. FreeModel (Free first, Cheapest first routing) is unchanged. From the local models.dev cache this tags: - every model of NVIDIA NIM and ModelScope; - the :free / -free models of OpenRouter, OpenCode Zen and Go, Kilo, AIHubMix, ZenMux, Vercel, Requesty and other relays; - Zhipu's and Z.ai's glm-4.x-flash. No coding or token plan is tagged. Where it shows, with the hover "free: listed at $0 on this provider": - an agent's model picker (agent.Option.Zero); - the provider editor's model chips, and its Free only button (modelJSON.Zero); - Routing's Add a model and classifier pickers (modelRef.Zero). The word is new in en, zh, zh-TW, ja and de. Tests, each red on the old code: - TestPricedFreeIsTheProvidersOwnZero: own, plan, maker-only, unpriced and user prices. - TestPickerSaysAZeroPricedModelIsFree: Option.Zero, cleared at once by a price the user saves. - TestZeroPricedModelsSayFree: the editor's and Routing's JSON. - zero-priced-free.test.cjs: the three surfaces, in Chromium and WebKit, at 1100 and 420px, in all 5 languages. It checks the tag's text, hover and fit, that the paid model has no tag, that a plan's free model keeps its own hover, no sideways scroll and no page errors. Broken by hand (each restored, diff checked): - The source check ignored (maker and plan $0 count): the provider test goes red on the plan model and the relay's glm-4.7-flash. - PricedFree always false: the provider, agent and gui tests go red. - The user's price ignored: the provider and agent tests go red. - The badge's o.zero / m.zero and Routing's zero dropped in app.js and routing/client.js: zero-priced-free goes red, "the $0 model has no free tag in the agent's picker". Run at this commit's tree (base |
||
|
|
d1cdce1302 |
provider: the group alone keeps subscription models out of agents' lists (shaoyang.)
shaoyang. on Discord (#general, 11-03): with a routing group's Model lists set to the group alone (its card's 成员模型不单独列出), the model list fetched still had every model of the group. Cause: |
||
|
|
7c115f6f5b |
provider: picks gone from a list for over an hour serve the list (maxleebeta)
maxleebeta on Discord: with WorkBuddy and WorkBuddy AI both signed in, the Agents page's model picker had no WorkBuddy AI model, and its Providers row read "已登录 · 1 个图像模型 · Free plan" where WorkBuddy's read "1 个模型". WorkBuddy AI's /v3/config (read 2026-11-03 with the owner's account) no longer lists deepseek-v4.1-flash, its free model until now; hy3 is at x0.00 instead. The China build still lists deepseek-v4.1-flash. A pick a plugin's list stops listing goes to Delisted ( |
||
|
|
3e61d814e5 |
gateway: an AI Studio key speaks the Gemini API too, and searches by googleSearch
cocoasoda (Discord) asked for a native Gemini API mode on the Gemini API provider, so it can search with Google Search on the API credit a Gemini subscription comes with. The Google Gemini preset (and any provider whose Chat URL is AI Studio's OpenAI-compatible one) now gets AI Studio's Gemini API base, https://generativelanguage.googleapis.com/v1beta, at the same key, filled in by normalize, so existing providers get it on load. A Gemini URL of the provider's own is kept; other hosts, Vertex and sign-ins get nothing. Ordinary turns stay on Chat as before. What changes: - A Gemini client (Gemini CLI) is relayed natively, its googleSearch tool included, instead of being translated onto Chat. - A web search with no tools of the client's own (Claude Code's WebSearch) goes to the Gemini API with tools [{"googleSearch":{}}], and the grounding comes back as the client's search result. - A turn with function tools stays on Chat: Gemini doesn't take googleSearch beside function declarations, so before this the switch to Gemini dropped the search silently. Its model is given magpie's search tool, and the same key answers it by a tool-less googleSearch request (searchesOwn / ownSearcher, as Google sign-ins do since #757), on the user's own credit, not another provider's. - The model list isn't asked twice: AI Studio's OpenAI-compatible list is its Gemini API's list. Run on mote at this change on |
||
|
|
952309abcf |
provider: a provider of keys' picks saved before PickedFrom are served as they are (yuancjun)
yuancjun (#help on Discord, magpie web on Linux at v0.1.2679) found that the provider editor saved every model when one was picked, and sent the fix from their fork (yuancjun/magpie, fix/legacy-picks-serve-all, 2d82267d2). Ported here, with the Save side added. withNewlyListed reads picks saved before PickedFrom was kept as "held every model" when they hold every model released up to the newest pick, and adds every model released after it. A pick of one OLD model reads the same way, so every newer model was served beside it, the editor showed them all as picked, and the next Save wrote them all down. With 10 models released 2026-01..10 and "models":["m0"] with no "pickedFrom", Exposed() was 10. PickedFrom is nil too for a provider whose picks were saved before its list was fetched (an import), not only for old ones. - A provider of keys (no Account) with no PickedFrom: its picks are served as they are (yuancjun's change). A subscription keeps the date rule: its list is the catalog's and Select all is a state its editor offers (TestClaudePicksOfEveryModelTakeOnesListedSince). - listedWith: such a provider's next Save keeps the list with its picks, the same picks too (it used to keep was.PickedFrom, nil, so a key provider whose every model was picked before PickedFrom would never be given a model listed later). A subscription's same-picks Save still keeps what it had. Every path that writes picks reads them through Picks(): the GUI editor (PicksOf in /api/providers' chosen), the TUI's model toggles (pages.go). The CLI's `provider set models=` and the importers write the ids given, and their Save goes through listedWith. Users whose picks were already saved as every model can't be told from a real Select all: those picks have PickedFrom kept and are served as saved. They unpick in the editor (Picked only, or Select none, then the models wanted). A provider that showed every model but was never saved since is back to its own picks at once. TestLegacyPicksServeWhatWasPicked (yuancjun's, plus a Save as the editor does it) and TestLegacyPicksOfEveryModelGetPickedFromAtSave. Run on mote at this commit: go test ./internal/provider ./internal/tui ok; go vet GOOS=linux and GOOS=windows ./internal/provider ok; gofmt -l clean. Broken by hand: the Account==nil branch off, the first test is red with all 10 served [m1..m9 m0]; the listedWith change off, both tests are red (PickedFrom [] after the Save; m3 not added). Not tried: a real relay with a real providers.json from before PickedFrom. |
||
|
|
4dfdd0cd63 |
provider: a provider switched off is asked for nothing, its plugin's model list included
ChangQiu on Discord switched a provider off long ago, and magpie still reached it. Routing, fallback, usage and balance reads, warmups, check-ins and keepalive were already held back (On(), leftAlone, KeepListsFresh). These were not: - The plugin host's providers listing ran every plugin's models hook, which asks the vendor, and its sign-in renewal (fresh), for every plugin provider, on or off. Go now passes the ids switched off (plugin.ListingOff, provider.pluginsOff: the provider's id and the plugin's own id, read from providers.json alone). host.js lists such an id without running a hook (info(..., quiet)), so its row stays and keepListed keeps the last list. - Sync (POST /api/sync, `magpie sync`) fetched every ready provider's list. Both now go through provider.RefreshLists, which skips one switched off. - Saving or switching on in the GUI fetched the list even for one left off; PrefillNewKeys asked one switched off too. What still asks one switched off, by the user's own click: the TUI's refetch, the provider Test button and `magpie provider models <id>` refetch. Tests: TestOffPluginProviderAskedNoModels (the fake plugin's models endpoint counts its hits: 0 while off, the list kept, asked again once switched on), TestPrefillAsksNoProviderSwitchedOff, TestPluginsOffNamesThePluginsOwnIDs and TestRefreshListsAsksNoProviderSwitchedOff. Run on mote at this head (first at |
||
|
|
d1a94f5792 |
provider: a Codex pick the ChatGPT list dropped is not offered (#4772)
Cause: the owner's codex provider keeps picks (providers.json "models")
made while ChatGPT listed gpt-5.5. ChatGPT has since stopped listing it:
the backend's /codex/models for the Pro account (client_version 0.165.0,
asked 11-01) and the saved Plus account's list both have gpt-6.1-sol,
gpt-6-astra, gpt-6.1-terra, gpt-6-sol, gpt-6-luna, gpt-5.6-sol/terra/luna
and no gpt-5.5, and Codex CLI 0.165.0's models_cache.json has none
either. ExposedOf offers a pick the vendor's list lacks as typed in by
hand, and an account's refetch never drops gone picks (dropGonePicks is
for key providers), so codex/gpt-5.5 stayed first in /v1/models. The
backend refuses any model its list leaves out: a real request for
gpt-5.5 on the Pro account answered 400 model_not_found "The 'gpt-5.5'
model is not supported when using Codex with a ChatGPT account", while
gpt-5.6-luna answered 200. Not plan-specific: Plus and Pro alike.
Fix: a ChatGPT account (listedOnly) is treated as Copilot's already is:
with its list fetched, a pick the list doesn't have is left out of what
agents are offered. The pick itself stays saved and comes back when the
list has it again. The list is the pool's (codexPoolModels), so a model
only a saved account has is still offered and routed to it
(Account.Lists).
Run (mote, at this tree on origin/main
|
||
|
|
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). |
||
|
|
3ee6c2d948 |
providers: a provider list looks at the stamps, plugin logins, client shapes and accounts once a request
/api/providers took ~25ms of CPU a call with the owner's real config (25 providers, plugins signed in), polled by every open window. Its profile had file system calls at about half, each repeated for every provider the list shows: - StampNow stat'ed providers.json, settings.json and the catalog for every provider (KeptListing); under a request's Hold it is looked at once. - plugin.ListedAt was asked for every plugin provider's Listed(); once a request (heldOf "plugin-listed"). - pluginLogins took logins.json's lock, a file opened across magpies, for every plugin even with nothing to change. It now settles the list as read first, and takes the lock and settles again from a fresh read only when something changes. - clientShape read and parsed client-shapes.json for every relay a list shows (TestsAs); parsed once until the file changes (filememo), a copy given out. - Logins(agent) took the same lock for every provider, twice with its account models; listed once an agent a request, a copy each, listed anew after a write (writePrivate's filememo.Forget). Run (on mote unless named): - go test ./internal/provider ./internal/gui -timeout 45m: provider ok (102s) with the new tests; gui red on TestMainWindowCorners (macOS 27, #3949) and on TestSettingsSaveKeepsWhatItDoesNotSend, red on main since |
||
|
|
2b067434d7 |
provider: a Kimi Code membership's k3.1-pro and k3.1-pro-highspeed are priced at the Kimi API's (#4635)
hlyx1's fix (#4635, branch hlyx1/magpie kimi-code-k31-pro-price), asked to be expedited by matrix0487 on Discord. Kimi Code's plans serve k3.1-pro and k3.1-pro-highspeed, which models.dev's kimi-code-plan-* catalogs list at the membership's $0. Neither id was in kimiCodeAPI, so a membership's call on either was unpriced on Usage. They now map to kimi-k3.1-pro and kimi-k3.1-pro-highspeed, like k3 to kimi-k3, and the Requests list names that model (PricedNameFor). Checked: Kimi Code's own /models answer (internal/catalog/testdata/ kimi-code-cn-models-2026-10-31.json) lists k3.1-pro "K3.1 Pro" and k3.1-pro-highspeed "K3.1 Pro Highspeed". Kimi's pricing page (platform.kimi.ai/docs/pricing/chat, read 2026-11-01) and models.dev's live moonshotai entry both give kimi-k3.1-pro $2 in / $10 out / $0.20 cached / $2 5m write, and kimi-k3.1-pro-highspeed $4 / $20 / $0.20 / $4. The fixture's new entries match models.dev's api.json in id, name, cost and canonical_model_id. The alias stays Kimi Code's (kimiCodePlans): the test's relay catalog now lists a k3.1-pro of its own at $0.50/$1, which keeps that price, and PricedNameFor(relay, k3.1-pro) stays k3.1-pro. Docs: docs/reference.md, docs/subsystems/providers-accounts.md. Run on mote (Go 1.26.8), at this change rebased on |
||
|
|
ce20d5658f |
provider: Catalog's list is made once with room for every entry
catalogKeeping cloned the groups' entries at their size and grew the
list by append for every provider's model, about twice the list it
gave. It is now made once with room for the groups and every entry.
Real accounts (sandbox copy of the owner's HOME, network blocked), 40
polls of /api/state, /api/providers and drift, pprof alloc_space
between two heap snapshots,
|
||
|
|
61b536d788 |
provider: MemberGroups and GroupKept are built once while a request holds
The providers' page asked MemberGroups for each provider and GroupKept
for each model, and each call built the groups again from every
provider's entries: 11.6 MB of what twenty window polls allocated with
real accounts (m2463 profile). Both now go through heldFrom, as the
other catalog reads do: built once per Hold, kept across requests
while the stamp stays, shared and only for reading.
Test: TestMemberGroupsBuiltOnceWhileHeld. 20 looks under one Hold,
each asking MemberGroups 12 times, build it once at most; a group
saved after (g5) is in the next look.
Run on mote, at this tree on
|
||
|
|
0aafcc0fd0 |
provider: which models a provider has no API for is found once per list
NoAPIFor found the protocols the provider speaks for every model it was asked about, and APIs did again through ModelAPI, so a list of N models built 2N Speaks slices. The providers' page, ExposedOf and servable ask it for each model of each provider: 16 MB of what twenty window polls allocated with real accounts (m2463 profile). NoAPI() finds the protocols once and gives a func for each model; APIs and ModelAPI take them through apisAmong and modelAPIAmong. NoAPIFor, APIs and ModelAPI answer as before. Test: TestNoAPIFindsTheProvidersAPIsOnce. 100 models of a relay, half listed on chat: Speaks looked up once (5 at most, for another test's look), the chat half kept, NoAPIFor the same for each. Run on mote, at this tree: - gofmt, go vet (darwin, windows, linux): ok - the new test with TestExposedOnlyOnTheAPIsTheProviderHas and TestListedAPIsCost, 3 times: ok - broken by hand (NoAPI back to a per-model NoAPIFor): red, "100 models looked up the provider's APIs 200 times" - go test ./internal/provider: ok - go test ./internal/gui (before the apisAmong step, which touches internal/provider only): every test ok except the known TestSettingsSaveKeepsWhatItDoesNotSend (#4514), TestMainWindowCorners (#3949) and TestColdTurnsTaken (#4510) Not run: an A/B with the real-account sandbox for this change alone. |
||
|
|
f598edf6d5 |
providers: a provider's model lists are kept across polls with the catalog
The Providers page's state built each provider's Available,
ExposedOf(Available) and NewestInFamily(Available) lists again on every
poll. Over twenty polls of the real-account sandbox that was 159 MB of
the 371 MB providerInfoWith allocated (Available 72, NewestInFamily 60,
ExposedOf 27). provider.KeptListing keeps the three lists in keptOf, the
cross-request cache that drops them when the catalog, providers.json,
settings or a plugin changes (StampNow) and after keptFor, and only while
a request holds. providersState passes the kept Listing; providerInfo,
for one provider after an edit, still builds a fresh one. The lists are
clipped, so an append makes the caller's own.
TestProvidersListingKeptAcrossPolls: twenty polls with nothing changed
build the listing 0 times and match a fresh Listing; after a Save of the
provider's models the next poll shows the new ones. With keptOf swapped
for a direct call by hand it is red: "built the listing 20 times, want 0".
Run on mote at this tree (on
|
||
|
|
05f6ca39b3 |
provider, gui: settings only read go through the shared copy
settings.Load clones the whole Settings, every provider's model prefs included. CompactsOf, OutputsOf, ModelNames, ModelEfforts, settings.SavedAddr and the GUI's providerInfoWith only read it, and providerInfoWith took a copy for each provider: 16 MB of what twenty window polls allocated in a real-account sandbox, more with each model a user has set prefs for. They read settings.Shared() now. ModelEfforts hands back a clone of the slice it finds, so a caller's change never reaches the shared settings. TestModelPrefsReadTheSharedSettings: 3000 other models' prefs; the values are right, a caller's change to ModelEfforts' list doesn't reach the settings, and each look allocates at most a tenth of Load's. Red on the old code: ~6058 allocations a look against 6056 for a Load. Run at this head on mote: go vet (darwin, GOOS=windows, GOOS=linux without the gui package) ok; go test ./internal/settings and ./internal/provider ok; ./internal/gui red only in TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners (#3949), both red on main. |
||
|
|
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. |
||
|
|
f1d6f4137c |
gui: a provider's row reads the vendor's list once
providerInfoWith read p.Available() four times for one row: for the picks (Picks), for what is exposed (Exposed, twice: the exposed set and the picks the list doesn't know) and for the newest of each family. Each read builds the list whole with its names, levels and plugin models. In a profile of v0.1.2432 against the owner's real config (20 rounds of the window's polls), providersState was 1.34 GB of 2.62 GB allocated, Exposed 390 MB, Picks 155 MB and the row's own Available 146 MB of it. Provider gains ExposedOf(avail) and PicksOf(avail), Exposed and Picks of a list the caller has read already; Exposed and Picks call them with p.Available(), so every other caller is unchanged. The row reads the list once and hands it to both. TestProviderInfoReadsTheListOnce: a 2000-model catalog provider with three picks, one of them unlisted, read the way the page's request reads it (provider.Hold and filememo.Hold). The row's Chosen equals Picks(), its exposed count equals len(Exposed()) and the unlisted pick goes first. A row takes 28.6 MB against the list's 8.0 MB (each model's own price, window and protocol look-ups besides); on the old code 54.4 MB, red at the 5x bar. Run on mote at 27401edd6 (go test -timeout 45m): internal/provider ok 161s. internal/gui: three reds, each already filed and failing the same on main: TestSettingsSaveKeepsWhatItDoesNotSend (#4514), TestMainWindowCorners (#3949), TestColdTurnsTaken (#4510). go vet darwin and windows ok, gofmt -l clean. |
||
|
|
4a7d1c63ac |
provider: Resolve keeps the listed-by map and finds a group without copying the catalog
A live magpie's heap profile (v0.1.2404, 53 minutes) allocated 1.3 GB
in isMagpie -> provider.Resolve, from the window's drift poll asking
every 15s for each model value an agent's settings name:
- a bare model no entry has ("gpt-5.5") built listedBy, every
provider's whole model list, again on each request: heldOf only kept
it for one second inside a Hold (835 MB);
- a group ref copied the whole Catalog() to find one group (425 MB).
listedBy now goes through keptOf, the Stamp-keyed store the catalog
already uses, so it is built again only when providers.json, a group or
a setting changes. A group ref is looked up in the groups' own entries
first, and the full catalog stays the fallback.
TestResolveKeptAcrossRequests: three providers with 40 models each and
a group, each request in its own Hold. "group/g", "nope" and "m-b2"
take 44, 43 and 28 allocations once built (bar 60), they resolve right,
and a provider saved since is resolved by the next request. Broken by
hand: heldOf("listed", listedBy) put back, red; the Catalog() copy
first put back, red.
Run at this tree on mote: gofmt -l clean; go vet ./internal/provider
for darwin, linux and windows ok; go test -count=1 -timeout 45m
./internal/provider ok (126.0s), ./internal/agent ok (199.3s),
./internal/gateway ok (595.0s).
|
||
|
|
3d063e34fd |
providers: the editor names a routing group listed alone that keeps a model from agents (hayden4608)
hayden4608 on Discord: with a provider's "Only through routing groups" switched off, its models still weren't on the Agents page. Switching it off does bring them back to every list (tried in a sandbox HOME on mote: POST /api/provider/save unlisted:false, then /api/agent-models/codex, /api/state's Codex options and provider.Catalog all list them; nothing caches the old list). What still keeps them out, with the switch off, is a routing group whose Model lists is "The group alone" (Group.Unlists, #1783): its members leave every agent's list. The editor said nothing of it, so the switch looked broken. The provider's JSON now carries keptBy (provider.GroupKept: model -> the names of the groups listed alone that keep it out, a signed-in subscription's models excepted as Catalog excepts them), and the editor says under the models, and on each chip, which group keeps which model out and that its Model lists is changed on the Routing page. Words in zh, zh-TW, ja and de. unlistedByGroups returns the groups' names now instead of a bool; Catalog and Unlisted read it as before. Not confirmed for hayden's own setup: the other reasons a model is missing there are Codex's list in "Only models I pick" (the editor already names that agent) and GitHub sync bringing the other device's providers.json back (newer wins per part). The reply asks which. Run on mote at |
||
|
|
7b09d2c951 |
provider: a model can be listed by an id of the user's at its provider, asked for by its own
zeewell on X (tweet 2116404121930432888): relays serve one model under
ids of their own (deepseek-v4.1-flash-1017, grok-4.6@500k). They want to
give each one their own id at the provider layer. magpie then lists,
routes, groups and finds groups by that id, and the upstream request
still carries the vendor's id.
Choice: a new per-model map, settings' ModelIDs
("<pid>/<local>": "<own id>"), served through the wire names that
already exist. ModelSameAs was not widened. It means "same as another
vendor's model": it lends specs and joins found groups. Making it rename
models everywhere would change every existing user's ids and refs.
ModelWires was not reinterpreted either, for the same reason. ModelIDs is
ModelWires turned round: a wire keeps magpie's id and changes the one
sent, and this keeps the one sent and changes magpie's. Settings.Wires()
merges each entry in as a wire name (wrapped by a "<pid>/*" wire). Every
place that sent a ModelWires name (gateway, usage ledger, request page,
UpstreamName, UpstreamNameAs) reads Wires(), so the upstream id needs no
new path. An explicit ModelWires entry for the same id wins.
- Listed by the local id: Available, liveIDs/liveByID, Serving and
ListPrice translate through OwnModelID. /v1/models, agents' lists,
Resolve, routing groups and found groups (auto/<local>, merged with
every other provider serving that id) all see the local id.
- Only a provider of the user's own (Account == nil) takes one. An
account's or a plugin's request is built from its list's id, which no
wire reaches.
- Two variants of one provider given one id: the latest given it wins,
and the earlier one is listed by its own id again. The CLI names it.
The editor refuses two rows given one id in one save. A model of the
provider's own id that a variant is listed by (plain grok-4.6 beside
grok-4.6@500k) is not listed while the variant has it.
- The user's values are never overridden. SetModelID moves picks,
contexts, fallbacks, groups' members/rules/fast/placed/off/weights/
classifier/pick, the pickers' lists, every per-model setting
(Settings.MoveModel) and gateway keys' models (provider.ModelMoved,
set by access) to the new id, but only where nothing is under the new
id yet. Agents' own files are not rewritten: an old provider/<own id>
still resolves and is sent as it is. Group match patterns and key
patterns stay as written.
- Key limits: a key held to either id passes for both (modelAllowed:
the ref, OwnModelID, ListedModelID). Group members use the same check.
- Usage: model = the listed id, served = the vendor's id from its reply.
The price is the own id's first.
CLI: magpie model id <provider/model> [<id>|--reset], magpie model ids.
GUI: Providers > a provider's editor > Names & levels > "Listed as",
beside Same as. It is staged with the editor's Save and taken back by
Restore default, in zh, zh-TW, ja and de. Accounts have no box.
Docs: providers-accounts.md, gateway-routing.md, and site start.html in
en, zh and ja.
Run (mote-run, at this tree rebased on
|
||
|
|
0407d69e84 |
provider: a group of Kimi models keeps always_thinking, dynamic tools and its default effort
jiabubu on Discord (#feedback): one Kimi Code model put in a routing group so it lists first lost "always thinking" and "dynamic tool loading" in Kimi Code, which the same model straight from its provider has. buildGroupEntries never set AlwaysThinks, DynamicTools or DefaultEffort on a group (the Entry comment said "a group has none of them"), so kimiModelTables wrote the group's table without always_thinking and dynamically_loaded_tools, and default_effort fell back to high. groupSharedKimi now gives a group each of the three when every member's entry says the same, and none of it when one member doesn't or has no entry: a group request can reach any member (rule targets are members too, ruledEntry's of()), so Kimi Code must not shape a request for a member that can't take it. The capability words are Kimi Code 2.4.1's own (catalog-runtime.ts capabilityFromDeclared), already written for direct models; kimi-cli still gets neither. Tests: TestGroupSharesKimiFacts (provider: all share, one without, efforts differ) and TestKimiCodePlanCapabilities now writes a one-member group "top" (the reporter's case: always_thinking, dynamically_loaded_tools, default_effort max) and a group "mix" with a relay model (neither word). Run on mote (mote-run, sandbox HOME): - At 83a630d69 (on |
||
|
|
45de2ddb96 |
provider: a provider the user counts free goes first under Free first (jiabubu on Discord)
jiabubu asked on Discord #help for a way to mark a provider, model or key
as free, so that Free first routing spends it first. Their example is
ModelScope, which has a free daily quota. Until now routes.Seat.Free
came only from the vendor catalog's Free flag, and there was no way for
the user to set it.
Provider.CountFree ("Free for me" in the provider editor's Advanced fold,
`magpie provider set <id> free=yes|no` in the CLI) makes FreeModel true
for every model of that provider. Routing therefore treats it like a
vendor's free model: Free first uses it before paid ones, and Cheapest
first weighs it at nothing, because PriceAt, which only routing reads,
returns 0 for a free model. Prices shown (ListPrice and the model list)
and the costs Usage counts (EffectivePrice) are unchanged. The mark says
what to spend first, not what a call cost, and a quota that runs out
still bills at the listed price. Key and account (subscription)
providers both carry it, through withPicks, the account literal and the
copy merge.
Tests:
- internal/gateway TestFreeFirstSpendsTheProviderTheUserCountsFree:
- a Free first group [paidv/m, mine/m] sends its first call to mine
once mine is marked, and the trace row says Free;
- EffectivePrice is still the listed 3/15;
- Cheapest picks mine first;
- unmarked, paidv goes first again.
- internal/gui TestProviderSaveKeepsCountFree: the preset and typed-in
providers save the mark and clear it, and /api/providers reports it.
- internal/cli TestProviderSetFree: free=yes and free=no work; the value
shows in `provider <id>`; free=maybe, an empty value and --help are
refused and change nothing.
- GUI internal/gui/tests/provider-count-free.test.cjs covers the
ModelScope preset, a custom provider saved with the mark, and a Codex
account. It runs chromium and webkit, in en, zh, zh-TW, ja and de, at
widths 900 and 440. It checks the Advanced fold, the check and save
POST bodies, that the row fits with no sideways scroll, and that each
string has a translation in I18N.
Core script budget: rebased 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).
|
||
|
|
4f2d5fc7e0 |
routing: a group can put its cheapest member first, by each one's price at that hour
liyuanzheng (#general) and lam_em (#feedback) both asked for the same thing. Off-peak, DeepSeek's own API should come first for deepseek-flash. At DeepSeek's peak (weekdays 01-04 and 06-10 UTC, billed 2x since v0.1.2173), another provider should come first, Ollama say. A schedule editor would make the user copy DeepSeek's hours into magpie. Instead, a group gets one more routing, "Cheapest first" (`cheap`). Each request sorts the members by what they cost right then: input + output price per million, at the peak rate when it is peak hours. A tie goes to the lower cache-read price. Free models count as 0. A member with no known price keeps its listed place after the priced ones. Prices come from the same priceOf the usage ledger bills with, so the user's own ModelPrices, list prices and maker prices all count, and so does a provider's rate windows. - routes: Seat carries Priced/Cost/CacheCost; Strategy.ByPrice; Cheapest is a stable sort, so equal prices keep the user's order. - gateway: weighRouted prices each seat at priceClock() (time.Now; a test holds it) through the new provider.PriceAt. The trace's Weighed row gets a price (input/output/cacheRead/peak) so Routing can say why. - It is a group's alone, like Manual. A provider saved with it drops it, and `magpie provider set … routing=cheap` refuses it. Groups take it in the GUI menu (one more item, no new controls), the TUI and `magpie group set <id> routing=cheap` (aliases cheapest, price, cost). - Routing's mode line says why the first one is first, e.g. "Cheapest first: deepseek-v4-flash costs least on ollama-cloud now — $0.150 in, $0.600 out a million tokens.", with peak and unpriced variants. en/zh/zh-TW/ja/de. - Docs: gateway-routing, plugin-runtime, reference (it also points at Time window and Pause rules for a fixed schedule) and the site's start pages (en/zh/ja). Run, at |
||
|
|
8921ef8056 |
provider: the Command Code plan prices DeepSeek V4.1 Flash, with its peak hours (treeman on Discord)
treeman_26897 (#help): in the price editor the Command Code plan's
deepseek/deepseek-v4.1-flash showed empty boxes, and typing a price lost
the peak/off-peak split.
What was wrong, on the plan (served by its plugin since the retire):
- No price at all. models.dev's DeepSeek now lists V4.1 Flash only as
deepseek-flash, by the dated canonical deepseek/deepseek-v4.1-flash-1017,
so no maker price matches the undated id, and the plugin's own model list
gives cost 0 (none). Its calls were counted unpriced, at nothing, and the
editor had no list price to show. models.dev's own "commandcode" catalog
does list it ($0.15/$0.60, cache read $0.003); the Command Code API-key
preset already read it through its endpoint, the plan didn't.
ListPrice now falls back to that catalog for the plan (vendorListPrice),
after the maker's price, so a model DeepSeek prices keeps DeepSeek's.
- No peak hours. PeakOf judged the vendor by the provider's URLs, and a
plugin provider's are plugin://, which matched nothing. plugin:// URLs
are now left out, so the plan is told by its id as before.
- A user's own price was flat at every hour. It is now the off-peak base,
doubled in the peak hours of a vendor that bills by the hour (DeepSeek,
Command Code's DeepSeek V4, OpenCode Go's two), as the vendor does to
its own price. Chosen over a second "peak price" field: smaller, no new
UI. The editor's hint says it ("Off-peak price, the list's or one set
here: ... doubles it", en/zh/zh-TW/ja/de).
Behaviour change for existing users: a price already set on such a model
now counts double in those hours on the Usage page. It was not left
alone because the vendor itself doubles whatever the off-peak price is;
a price set for every other model is unchanged (tested: OpenCode Zen and
an OpenAI model hold at every hour).
Tests:
- TestCommandCodePlanPrice (new, models.dev's bytes of 2026-10-30): the
plan's plugin provider lists 0.15/0.6/0.003, 0.30 at peak; DeepSeek V4
Pro keeps DeepSeek's 0.66; a set price is 0.1 off-peak, 0.2 at peak; a
relay doesn't take Command Code's catalog.
- TestPeakOf: the plan with plugin:// URLs, its flash-fast, another plugin.
- TestPriceOfPeak: a set price doubles at peak; Zen and OpenAI set prices
don't.
- model-price-edit.test.cjs: the hint names a price set here.
Broken by hand (each red, then put back):
- peak.go at origin/main: TestPeakOf plugin case and four
TestCommandCodePlanPrice checks red.
- vendorListPrice off: "list price ... false", "unpriced".
- the user price's Peak line removed: TestPriceOfPeak (3 keys) and
TestCommandCodePlanPrice (2 keys) red.
- origin/main's app.js with the new GUI test: model-price-edit red.
Run:
- mote-run go test ./... -timeout 45m -count=1 at
|
||
|
|
9e73f69af4 |
providers: rate windows bill a provider's hours at its own rate (#2463)
A provider can have up to 8 rate windows: days, a span that may cross midnight (on this computer's clock), and a rate. Inside a window a call costs the base price times the rate. The base is the user's model price as set, or the list price times PriceRate with the vendor's own peak (DeepSeek, Command Code, OpenCode Go) already in it. The author gave this order as the spec: a 0.8 window on a shared DeepSeek key takes 0.8 off the peak price at peak. The editor's hint says not to set the official peak hours again as a window, in every language. Each call is priced at its own time on the Usage page and its CSV, in the Requests tab's rows, and against a gateway key's cost limit. The Sessions page, group templates and the model list written into an agent's own config use the base price. /v1/models prices at now. Ported from YangHonghang's 2c9d459ff (rate-windows-2463-v2). The Go pricing, its tests and the translations are theirs. Changed here: - No budget raised. Their commit raised appScriptBudget and coreScriptBudget; core_budget_test.go is main's again. The editor's window rows, time menus, validation and hint moved to ratewindows.js, which app.js imports when the field is drawn (as signsheets.js is). The sliding-thumb and modalDepth comments were cut down to make room. The core is 1,535,528 of 1,536,586 and app.js 1,312,242 of 1,315,316. Until the script has loaded, a save leaves rateWindows out, and the server keeps the saved ones. - Their unrelated TestAssetsHaveNoConflictMarkers is dropped (one commit, one goal). - The row badge shows only for a provider with windows. Before, every provider with a price rate alone got a new ×badge. Its title is shorter, and so are its translations. - AgentPricer (agent model files: Pi, omp, OpenCode cost) uses the base price. Nothing rewrites those files when a window opens or closes, so a price taken at Sync stayed on outside the window. - internal/budget gets a TestMain through testenv, so the new test runs in a home of its own. - old-webkit's list of lazily loaded scripts names ratewindows.js. - The draft keeps each window as a shallow copy, and a day chip replaces its days array, so the saved provider is never changed. - The GUI test waits for the lazy script's hint, not a fixed 300ms. It also checks the peak note in each language. Run first on |
||
|
|
88e6fb9cf7 |
provider: a signed-in subscription's models stay in every agent's list with a group listing alone on
士奇 on Discord (Simplified Chinese GUI, the third report of this): with routing groups off, Hermes Agent's and WorkBuddy's model lists had the ChatGPT subscription's GPT models. With routing groups on, they were gone. Cause: the user's group names those models and lists itself alone (Group.Unlists, the routing plugin's option for that, #1783). While the group is on, catalogKeeping drops what it names from Catalog(), and every agent's list starts from Catalog(). With groups gated off the group's Unlists goes away, so the models came back. |
||
|
|
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 |
||
|
|
7946256933 |
agents: omp, OpenCode and Crush get each model's price, and a group of mixed prices is priced at its first member (taotao7 on Discord)
taotao7 (#help, msg 1565576524193857678): omp on magpie's group/* models
counted every call at 0. omp's custom provider prices a call by the cost
in models.yml alone (omp 18.9.1: pi-catalog src/models.ts
calculateUsageCost, USD per 1M tokens; models-config-schema-bundle.ts
cost {input, output, cacheRead, cacheWrite}). magpie wrote no cost into
omp's models.yml for any model; an ordinary id still got one from omp's
bundled reference match, a group/* id matched none. And a group whose
members cost differently had no price in magpie's agent list at all
(EntryPricer prices only one-price groups), so Pi had none either.
- provider.AgentPricer: as EntryPricer, but a mixed-price group is priced
at the member it sends to first (a manual group's pick, else the first
not switched off); a fast or unpriced first member leaves it unpriced.
Chosen over "the member it routes to most" because that needs usage
history and would rewrite agents' files as traffic shifts; the first is
what an In order / Manual group sends to while it answers. Read at each
Sync, so it follows the members. The gateway's /v1/models keeps
EntryPricer.
- omp: models.yml model entries carry cost.
- Siblings: Pi, mothx, alma, penguin, plugged already wrote m.Price and
now get group prices too. OpenCode got no cost at all: now cost
{input, output, cache_read, cache_write} (OpenCode 2.0.25). Crush:
cost_per_1m_in/out/in_cached(write)/out_cached(read) (Crush 0.39.3).
- docs/subsystems/agent-wiring.md says so.
Run (mote): TestGroupModelsCarryTheirFirstMembersPrice ok; full
go test -timeout 45m ./... at load ~150-210 from other work: agent and
provider ok, 77 ok; reds TestTOMLBigFileParsesInLinearTime (#4109) and
the Antigravity turned-away tests + TestCodexSpentGrokFailingIsTold
(#4362), both filed against main. GOOS=linux/windows go vet of agent and
provider ok. Real omp 18.9.1 in a sandbox HOME: `omp models list --json`
reads group/mix with cost {1,2,0.1,1.25}, pricingStatus fixed.
Broken by hand: route.go back on EntryPricer -> red (group/mix cost
nil); omp's Cost line dropped -> red (a/cheap cost nil).
Not tried: a real omp turn through the gateway showing the cost; OpenCode
and Crush showing a session's cost in their UIs (keys read from their
binaries' strings only).
|
||
|
|
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 |
||
|
|
10c85e1fe9 |
provider: Ark's plan models that see images are sent them, not their descriptions (tongzhenbao on X)
tongzhenbao on X (10-29): an image sent to a Volcengine model took 100+ s to the first token. Ark's Coding and Agent Plans list no models (/models is empty for them), so their models come from arkPlanModels with no word on images, and the gateway judged them by models.dev (catalog.SeesImages). That says no for doubao-seed-2.1-pro (resellers tie), doubao-seed-2.1-lite and ark-code-latest, so blindTo held them blind and every image was first described by the vision model (visionTimeout 3 min, up to 4 at once) before the model was asked at all. Not a regression of today: SeesImages answers the same at |
||
|
|
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.
|
||
|
|
c201fe2266 |
usage: Codex's auto-review through a ChatGPT sign-in costs nothing (silverzhou)
silverzhou (Discord): codex-auto-review has been free for a long time,
but magpie still estimates a cost for it. OpenAI's Codex lead
(thsottiaux, "Day 2.1"): "We have made Auto-review free for all users
signed in through a ChatGPT account."
provider.ListPrice now prices codex-auto-review at $0 on the "codex"
provider, the one that holds only ChatGPT sign-ins, unless that sign-in
is on the Free plan: cybercaius measured auto-review spending the Free
allowance, which is why the gateway's freeOnChatGPT already left Free
out. That rule now has one owner, provider.ChatGPTReviewFree, and
freeOnChatGPT calls it. The plan is read from Codex's current sign-in;
an unreadable plan or a Codex signed out since counts as a paid plan
(priceOf's unknown-model branch answers $0 for it too).
Still priced, since nothing says those are free: codex-auto-review sent
with an API key (openai, chatgpt-api), through a relay, or a review
magpie made follow the session's model (the row's served model is that
model). A price the user set for the model wins over the $0.
PricedNameFor names the model itself, so the Requests list no longer
says "priced as gpt-5.6-luna". The usage summary cache key carries the
Codex plan, so a plan change re-prices cached views.
Old rows: prices are applied when the log is read, so every past
codex-auto-review row through a ChatGPT sign-in reads $0 after the
upgrade: Usage's Overview and Requests, the tray, the ledger and key
limits' estimated-cost caps (their in-memory sums are rebuilt at start).
Nothing is rewritten on disk.
Left alone: a Codex window's holds (apiPricer) still count these calls,
filed as #4181. docs/subsystems/providers-accounts.md has the rule.
Run at this tree (rebased on
|
||
|
|
0daf363325 |
gateway: a key resting after an outage is asked again in the background
heatonz on Discord: a key or provider paused after a failure stayed out
for its whole rest, even after its vendor was back. Only Try now got it
back early. probeOne asks only the resting candidate that comes back
soonest, so a key behind ready ones was never asked again early.
What changed:
- gateway/rest_probe.go: the background ask, with no setting.
- Which rests it asks: a key's own rest from a failure that names no
time (a 5xx, a 408, no connection), resting by backoff, at a vendor
whose model list is asked over the network (provider.ListAsks).
- How it asks: the vendor's model list, with the key and its p.Via
proxy. A list costs no allowance.
- When: 1m into the rest, then 2m, 5m and every 10m, each ask at least
half a step before the rest ends. The rest is lifted as soon as the
list answers, the way Try now lifts it (unsink, trace).
- Cost: one list per resting key per step, so at most 4 lists in a
10-minute rest.
- The loop runs from ListenAndServe. A Server whose loop isn't running
(a test's) queues nothing. A loop that ends waits for the asks under way.
- Not asked: a Retry-After or ratelimit reset header, quota or credit, a
rate limit, a refused key, a 4xx, one model's rest, a subscription's
account, a plugin. Those still end on time.
- Rate limits are left out on purpose. A model list answers while chat
still gets 429, so lifting early would undo Sink and go around the
vendor's limit.
- A list answers for the vendor, not for every model behind it. A key
that fails again within 30 minutes of a lift is not asked again until
it answers a real request (probeAnswered in served).
- Rest.Probed / KeyRest.Probed. The provider's key row and Routing's
words for the try add "checked in the background, back as soon as it
answers", in en, zh, zh-TW, ja and de.
- app.js stays under its budget with no raise: a shared hhmm helper, and
resetUsedWhen folded into the identical stamp.
- docs/subsystems/gateway-routing.md describes it.
Tests:
- rest_probe_test.go:
- lifted after one failed ask and one answered, asked with the resting
key;
- no ask again after a missed lift;
- each excluded rest: never queued, 0 asks;
- no loop, no queue; the loop waits for its asks, and a cut-short ask
doesn't lift.
- gui/tests/rest-probed.test.cjs: 5 languages x 1100/420px x chromium and
webkit, 40/40. Red on origin/main's assets.
Broken by hand on mote, each red:
- no lift: test 1 times out;
- no status check: refused key and bad request get asked;
- Retry-After ignored;
- no miss guard;
- no asks.Wait() in the loop's exit.
Run:
- go test -race -count=5 -run TestRestProbe ./internal/gateway: ok.
- mote: internal/gateway ok (636s); internal/provider ok.
internal/gui TestMainWindowCorners/macOS_26_SDK is red on macOS 27,
unrelated, #3949.
- Linux Go full suite (wsl-run, -timeout 45m) at 6cbd77608 (the same
change on
|