8a4e32febef69bb797cdf3003ec1395e725d5d63
10
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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
|
||
|
|
a0ba8e1f2e |
grok: each model's context_window follows Long conversations, and one set by hand stays through a sync (uk.jent)
uk.jent (Discord #feedback) reported that magpie writes every Grok Build model's context_window as the model's whole window. They wanted about 300K without editing dozens of models, and they lost hand edits on each sync, because SetTOMLTables replaces the [model."magpie/..."] tables whole. Grok Build now uses Long conversations, the mechanism Codex and Claude Code already use. grokWindow gives: - min(window, Compact) when the model or provider has its own threshold; - otherwise settings.Working(window): 272K by default on longer windows, the typed size, or the whole window with Full context. What magpie wrote is stashed under grok:<path>:windows, and grokOwnWindow uses it to tell a hand edit apart: - A value that differs from what magpie last wrote is the user's, and it stays. - In a config written before the record, a value other than the model's whole window is the user's. - Disconnect forgets the record. The agent sheet's Long conversations row now shows for Grok Build (AGENT_PREFS). Its texts, the provider editor's hint, the Context tab's note and `magpie model compact` now name Grok Build, in en/zh/zh-TW/ja/de. setCompact and setAsync now share prefWrite. That dedupe keeps app.js under its budget, which is not raised. Behaviour change: a Grok Build model whose window is over 272K now gets 272K by default, as Codex does, unless Full context is on. Run on mote, at this head (c893c2229, rebased on |
||
|
|
00d44d6928 |
routing: Codex's composer predictions story says their model is picked in Codex's row on the Agents page (#3425, chiperman)
Routing's Kind description for composer_predictions still sent users to Settings › General › Codex composer predictions. That setting moved to Codex's row on the Agents page. chiperman's commit (5e372e168) fixed the Routing text in five languages. It is ported here with their zh, zh-TW and ja; the de wording is mine. Grepping for other texts that still name the old Settings place for a setting that moved into an agent's row found four more, now fixed: - app.js compactField, the provider editor's "Compact at": empty follows Long conversations, now "in their settings on the Agents page (else in Settings)". The field's text is one string now, and the header comment no longer repeats it, so app.js stays inside its budget (unchanged). - gateway sealedWayOut: "Codex subagents on any model" is in Codex's settings on magpie's Agents page, not "magpie's Settings". - gateway codex_titles: "Codex composer predictions are off" and "Codex titles are off" answers name the same place. - cli `magpie model` help text. Each gateway message has a test that fails on the old wording, and the GUI files assert the new place and the absence of the old one. Run on origin/main |
||
|
|
4a3e07f1cf |
model: magpie model spec sets a model's window, output, vision and levels at once
Dani Ariyanto on Discord (#feedback, 10-24): a custom provider's models (kenari/*:free) had no window, reply limit, vision or reasoning known, and there was no one place to say them. magpie model spec <provider/model> what it has, and whose each value is magpie model spec <provider/model> [--context <n>] [--output <n>] [--vision on|off|auto] [--reasoning <levels>|off|auto] magpie model spec '<provider>/*' --context <n> --output <n> magpie model spec <provider/model> --reset magpie model specs It writes the stores magpie model context/output/images/efforts write (providers.json contexts; settings.json modelOutputs, modelImages, modelEfforts, modelReasonless), so every reader that went by those goes by a spec: entryFor/EntryOf/Served, /v1/models, max_tokens, the GUI's /api/providers badges and chips, and the agents' model lists. Every part is checked before anything is written; a refused command writes nothing. Agents are told once. Readers that bypassed the stores and now honour them: - provider.Efforts returns the kept levels, so the gateway fits a request to them (fitEffort): xhigh asked of a model kept to low-high goes as high. This reverses #92 ( |
||
|
|
ea9454d2d8 |
usage: count two ids of one model as one, magpie model alias (SlouchyQuill507 on Discord)
A vendor names one model two ways (deepseek-v4.1-flash and deepseek-flash),
and Usage, Usage > Sessions and `magpie usage` showed two rows. Now:
magpie model alias deepseek-v4.1-flash deepseek-flash
magpie model alias deepseek-v4.1-flash (what it is counted as)
magpie model alias deepseek-v4.1-flash --reset
magpie model aliases
kept as settings.json "usageAliases" {from: to}. Off until one is written.
Ids match as routing groups match them (provider.sameModel: vendor/ prefix,
case, "_", snapshot date), at every provider; a chain is followed to its
end; an alias to itself, a loop, or a flag as an id is refused. A loop
written into the file by hand counts each model under its own id.
Display only: requests, agents' model lists, /v1/models, routing groups,
Same as and prices never read it. Each call is priced by the id it was
made under and only then counted under the alias; the alias's own price
is never put on the other id's calls, and a merged row is priced only
when every id in it is. Applied in usage summarize/direct (Models
groups), the gateway sessions projection (alias read before
gatewayCache's lock; the cache key hashes usageAliases), and
sessions.List/Get/Find/Stats (read before storeMu/mu, merged into new
slices so the memo is untouched; ModelEffort rows merged too). A failed
settings.json read keeps the last aliases read, and SetUsageAlias refuses
to write over an unreadable file (EditUsageAliases under fileMu). The GUI
settings save carries usageAliases. No GUI control.
Not aliased: the Requests ledger's per-request model and its model
filter, which show each call's own id.
Run (worktree at
|
||
|
|
357ffac7be |
usage: a model's Same as prices its calls when no list does (#2344, liuweifeng)
A model a provider serves under its own id (a WorkBuddy kimi-k3-1, a relay's renamed gpt) had no price unless the user typed one, even when the user had already told magpie in the editor's "Same as" box which model it is. Its calls showed no API-price cost in Usage, window holds had no price to weigh, and `magpie model price` said unpriced. Now, when neither the user's prices, the provider's list nor models.dev's maker price covers a model, provider.SamePriceIn takes the maker's list price of the model it is the same as (settings.ModelSameAs), and the provider's price rate still applies. A price the user set, or a list that prices the model, always wins; nothing is inferred without a Same as. The same fallback is used by priceOf (Usage costs, re-priced when the ledger is read, so past calls pick it up), usage's apiPricer (window holds), the model editor's greyed list price, and `magpie model price`, which names where the price came from. The "Same as" tooltip says so in en, zh, zh-TW, ja and de. Run: - go test -p 1 -tags nogui ./internal/provider ./internal/usage ./internal/cli ./internal/gui (focused: TestSameAsPricesAnUnlistedModel, TestHoldsPriceTheModelItIsTheSameAs, TestModelEditorShowsTheSameAsPrice, TestModelPriceCmdSaysWhereThePriceCameFrom, plus the packages): ok - GUI (chromium + webkit): provider-same-as, i18n-keys, model-price-edit, 11/11 pass - gofmt -l clean; go vet -tags nogui for darwin, linux, windows: clean Broken by hand, each went red: - SamePriceIn dropped from priceOf: "kimi-k3-1 ... false; want $0.3" - usage's apiPricer fallback removed: "wasn't its API price: <nil>" - the GUI editor branch removed: "list <nil>" - the CLI source line disabled: TestModelPriceCmd... FAIL - the zh tooltip left untranslated: provider-same-as.test.cjs 0/2 A prefix-stripping branch passed when removed (MakerPrice already resolves vendor-prefixed ids like moonshotai/kimi-k3), so it was dropped. Not tried: a real WorkBuddy account's usage after the change. Full suite: SUITE_LINE |
||
|
|
f074996d93 |
provider, gateway, gui: a model with none of its levels ticked is sent no reasoning field, on every route and in a routing group (yuexian7)
yuexian7 on Discord: models.dev lists their model as reasoning, and the
vendor answers any reasoning parameter with 422 while the same request
without it works. In a routing group they couldn't set an effort per
model, and the model editor refused to untick the last level ("Keep at
least one level"). The learned refusals (
|
||
|
|
f71155591e |
provider: a provider at a vendor's own endpoint is priced from that endpoint's models.dev catalog (#2052, mengyianx)
A custom provider added by its address alone, with no catalog named, was priced only by the model's maker. Qwen3.8-27B, whose maker (Alibaba) sells no such model on any of its seven models.dev catalogs, read "no price is known for it" even at AMD's own endpoint, where models.dev's amd lists it at $0, a price. - catalog: models.dev's provider "api" is read; AtEndpoint names the catalogs at a base URL (trailing slash and case ignored). - provider: EndpointCatalog is the one catalog models.dev lists at one of a key's provider's endpoints (an Anthropic base, kept as its root, also with /v1), used by ListPrice when the provider has no catalog of its own. Never for a subscription's account, never when two catalogs share the address (minimax / minimax-coding-plan), never a plan's catalog (an id with -plan, or membershipCatalogs), whose $0 is the membership's. A user's price and a named catalog still come first; a relay's endpoint matches nothing and its model stays unpriced (no reseller guess). - cli: `magpie model price p/m` with no price gives the two commands that set one (p/m and */m); a price from an endpoint's catalog names it. - gui: the Catalog field's hint says it also sets list prices (en, zh, zh-TW, ja, de). - docs: reference.md's "What a model costs", providers-accounts.md row. What was run: - Reporter's exact case, built binary (go build -tags nogui), sandbox HOME with a copy of this machine's models.dev cache (2026-10-14, same amd entry as the report), providers 001 (relay), 002 and amd at https://developer.amd.com.cn/radeon/api/v1: 001/gpt-5.5 $5/$30, tiers, as before 001/Qwen3.8-27B no price, now with the two commands to set one 002/Qwen3.8-27B $0/$0, "what models.dev's amd lists at its endpoint" amd/Qwen3.8-27B $0/$0 The two suggested commands were run and took effect. - TestEndpointCatalogPrices / TestEndpointCatalogOnlyItsOwn, fixture testdata/endpoint_catalog.json trimmed from the real models.dev cache. Break checks, each FAILs with the case named: ListPrice not using EndpointCatalog -> 002/amd/001 at AMD unpriced, EffectivePrice(002, Qwen3.8-27B) unpriced plan exclusion removed -> "a plan's endpoint: EndpointCatalog() = alibaba-coding-plan", qwen3.5-plus at $0 instead of $0.4/$2.4 single-match rule removed -> "an endpoint two catalogs share: EndpointCatalog() = minimax" Account check removed -> "a subscription's account ... = amd" Anthropic /v1 match removed -> thinkingmachines unmatched - GUI: internal/gui/tests/catalog-hint.test.cjs, chromium and webkit, en zh zh-TW ja de, widths 1100 and 420: 20/20 pass, plus i18n-keys; with the old app.js/i18n.js it fails "one hint names list prices". - go test -tags nogui -timeout 45m ./internal/catalog ./internal/provider ./internal/cli: ok (provider 244s, cli 125s, catalog 3s). gofmt -l clean; go vet (darwin), GOOS=linux go vet -tags nogui and GOOS=windows go vet -tags nogui on those packages: clean. |
||
|
|
841af36bfc |
gateway: models the user disabled are refused on every route, and leave every list (#1867)
oxsean asked for one place to turn a model (claude-fable-5) off for good:
not reached by a direct request, an old session, a routing group member,
a fallback, a sub-agent, count_tokens or a decision model.
What changed:
- settings.DisabledModels: patterns, an exact id or a glob (* any run, /
included; ? one), matched ignoring case against provider/model, the
bare id and its last segment (provider/disabled.go). Empty by default,
so nothing changes for anyone who doesn't set it.
- Lists: buildEntries (entriesOff) leaves a disabled model out of the
catalog, so /v1/models, agents' model files and pickers, Codex's list
and every group go without it; membersIn skips it as a member, Deciders
as a decision model; codexModels drops Codex's own disabled slugs and
codexListTag changes so Codex refetches.
- Requests (gateway/disabled.go): 403 "model <id> is disabled in magpie"
in each API's error shape, at #882's choke points: serve (idOff),
perKeyBarred (no candidate: group next member, provider Fallback),
count_tokens and Gemini :countTokens, serveSystemOne,
serveDecisionGroup and postDecide, draw/video/embeddings, and
codexBackend for Codex's own bare models. A group with a member left
goes on without it; one with none left is refused naming them. A bare
id the catalog no longer has is refused as disabled, not 404. A Codex
sub-agent pick onto a disabled model stays on its lead's model.
- An unreadable settings.json is never "none disabled": the list read
last stays; with none read, every request is refused; nothing is
written over the file.
- CLI: magpie model disable <model|glob>..., enable ..., disabled
(list-disabled).
- GUI: Settings > Models > Disabled models: each pattern with the models
it matches now and Enable; Disable... opens the model picker, which
also takes a typed glob. Says only requests through magpie are covered.
POST /api/settings/disabled-models; POST /api/settings keeps the list.
Strings in zh, zh-TW, ja, de.
- docs/subsystems/gateway-routing.md: Disabled models section.
What was run (worktree at origin/main
|
||
|
|
23e764d0e0 |
cli: magpie's commands move from the root into internal/cli; the root keeps only main.go
The root held 89 .go files (30 commands, 59 tests). They move as they are to internal/cli (package cli), with git mv so history follows them. The only code change is main() becoming cli.Main(version): the root's new main.go keeps `var version` in package main, so -ldflags "-X main.version=…" in the Makefile, the Dockerfile and magpie-releases, and every workflow, work unchanged. go-winres's rsrc_windows_*.syso still land next to package main in the root. Tests that read testdata by a root-relative path now go up one level (../plugin/testdata/fake, ../sessions/testdata). Five subsystem doc links point at internal/cli/. Run: - go build ./..., gofmt -l, go vet on darwin, linux and windows (nogui) - builds with tags production, dev, "production nogui"; windows -H windowsgui; linux CGO_ENABLED=0 - make release-cli TARGETS="darwin/arm64 linux/amd64 windows/amd64 android/arm64" VERSION=9.9.9-tidy: all four built, binary prints "magpie 9.9.9-tidy" - docker build --build-arg VERSION=7.7.7-tidy: container prints "magpie 7.7.7-tidy" - go test ./internal/cli (default and nogui): 152 tests, the same count as the root on main - go test ./...: all packages pass (agent, gateway, library, provider timed out at 10m under other sessions' load and passed rerun alone with -timeout 40m; none of them changed) - the built binary in a sandbox HOME: version, help, ls, providers, claude, and an unknown command's error |