Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

groups: a found group's id and name come from models.dev's one spelling (XYenon)

yetone9b833205f77d
diff --git a/docs/subsystems/gateway-routing.md b/docs/subsystems/gateway-routing.md
index 0f2c38406..f221f90b1 100644
--- a/docs/subsystems/gateway-routing.md
+++ b/docs/subsystems/gateway-routing.md
@@ -31,7 +31,7 @@ backfilled; see [Gateway Session Aggregation](gateway-sessions.md).
| TLS | `--tls-cert`/`--tls-key` (`MAGPIE_TLS_CERT`, `MAGPIE_TLS_KEY`) make `ListenAndServe`, `Relisten` (both through `Server.listen`) and `magpie web`'s page (`ServeTLS`) wrap the listener in `tlsListener`. A connection from another computer is `tls.Server` at once, so its plain HTTP gets net/http's 400. One from this computer (`fromThisComputer`: loopback, or a peer address equal to the local one) is sniffed on its own goroutine, 10s at most (`sniffWait`), and 0x16 makes it TLS, so `URL()`, the agents, MCP servers, `ServedBy` and the healthcheck keep `http://127.0.0.1`. `certFiles.get` reloads the pair when either file's mtime or size changes; a pair that doesn't load keeps the one served (logged once per change). `tlsConfig` refuses half a pair or files that don't load before binding. HTTP/1.1 only over TLS (hijack, Codex's websocket). `Scheme()` gives the scheme of `LANURLs`, a scheme-less `MAGPIE_PUBLIC_URL` and the page's network links. Host and Origin checks (`foreignPage`, `rebound`) don't depend on the scheme. | [`tls.go`](../../internal/gateway/tls.go), [`lan.go`](../../internal/gateway/lan.go) |
| HTTP surface | `Handler` routes `/v1/chat/completions`, `/v1/responses`, `/v1/messages` (each also without `/v1`), `/v1/models`, Gemini's `/v1beta/models/…`, the Codex backend path, `/v1/codex/models` (Codex's catalog shape for a Codex elsewhere with a gateway key, `codexCatalog`, kept to the key's models by `keyAllowed`; #1281), Ollama's `GET /api/version`, `GET /api/tags` and `POST /api/show` (`ollama.go`, for a client that takes a custom endpoint only as an Ollama server: Visual Studio's and VS Code's Copilot, wani on Discord; the list is `catalogFor`'s, so a key's models alone, `/api/show` tells `capabilities` (`completion`, `tools`, `vision` from `Images`, `thinking` from `Thinks`) and `model_info` with `general.architecture` `magpie`, `general.basename`, `magpie.context_length` (32768, VS Code's own default, when the window isn't known, since VS Code would take a 0) and the `general.parameter_count` and `magpie.embedding_length` the ollama CLI before 0.7 reads unchecked; a name ending `:latest`, as the ollama CLI asks, is the bare id unless a model is really called that (`ollamaName`); the client then chats on `/v1/chat/completions`, or on Ollama's own `POST /api/chat` and `POST /api/generate` (`ollama_chat.go`, Zed's Ollama provider, super_lalalalala on Discord), which `ollamaChatBody` turns into a `/v1/chat/completions` body handed to the same `handle(provider.Chat)` on a clone of the request, so they are routed, held to a key's models and counted as it is: `messages` with `images` (base64, its type sniffed, as data-URL parts; a tool message's in a user message after it), an assistant's `thinking` as `reasoning_content` and its `tool_calls` given ids where Ollama sent none, a tool result matched to its call by `tool_call_id`, else `tool_name`, else in order (one with no call is a 400), `tools`, `format` (`json` or a schema), `think` (a level is `reasoning_effort`), and `options`' `temperature`, `top_p`, `seed`, `stop`, the two penalties and a positive `num_predict` as `max_tokens` (`num_ctx`, `top_k` and the rest of Ollama's own are dropped); `ollamaWriter` turns the reply into Ollama's NDJSON lines (streamed unless `stream:false`, then one object), tool calls with their `arguments` as an object and an `id`, and a last `done` line with `done_reason` and the token counts, and an error into `{"error":"…"}` with the status `/v1` would give; a request with no messages or prompt is answered `done_reason:"load"`, as Ollama does to warm a model), `/mcp/{name}`, `/mcp/magpie/web-search`, `/mcp/magpie/vision` and `/mcp/magpie/image` with its `/mcp/magpie/image/files/{name}` (magpie's own web search, image recognition and image generation as MCP servers, below) and the `/v1/magpie/*` status endpoints. `/v1/magpie/heap` (`heapProfile`, [`heap.go`](../../internal/gateway/heap.go), for `magpie heap`) is held tighter than the rest by `heapRefused` in the handler itself, so it holds where `Handler` is served without `lanGuard` too: only a loopback caller that isn't proxied (`local`), carries no browser mark (`fromBrowser`) and names a loopback `Host` (`loopbackHost`) gets the profile; a gateway key never lets anything else in. `/v1/magpie/cpu` (`cpuProfile`, [`cpu.go`](../../internal/gateway/cpu.go), for `magpie cpu`) records a CPU profile for `?seconds=` (30, from 5 to 120) and is held to the same callers by `cpuRefused`, which shares `profileRefused` with `heapRefused`; one profile records at a time (`cpuRecording`), a second is answered 409, and a caller that hangs up stops it. `/v1/magpie/goroutines` (`goroutineDump`, [`goroutines.go`](../../internal/gateway/goroutines.go), for `magpie goroutines`, #3362) answers every goroutine's stack and wait as text (`runtime/pprof`'s `goroutine` profile at debug 2) to the same callers, through `goroutinesRefused`, and is answered ahead of everything below (`dumpFirst`, around `Handler`'s wrappers and around `lanGuard` in `Front`), since it is asked for while magpie hangs: the allow list reads settings.json under its lock, and `holdCatalog` takes `provider.Hold`'s and `filememo`'s, so a stuck holder of any of them would hold the dump too; a caller `goroutinesRefused` lets in is one those let in anyway, and any other goes through them as before (`TestGoroutineDumpAnswersWhileRequestsWait`). `/v1/alpha/search` (also without `/v1`, and on the Codex backend path for a magpie model) is Codex's web.run search (`alphaSearch`, `codex_search.go`): a ChatGPT account's model goes to the ChatGPT backend's `/alpha/search` on the account's sign-in, the next account asked on 401, 403, 429 or 5xx; any other model's `search_query` is searched by `webSearch`, and when nothing answers the reason is a 200 with `output`, since Codex ends the turn on any failed web.run (anton on Discord). A GET on `/v1/responses` (a client opening Responses over a WebSocket) is answered 426, a plain one 405: Responses is relayed over HTTP only. Every route is wrapped in `counted`, `corsGuard`, `callerGuard`, `withCaller` and `keyLimited`; `/v1/messages`, `/messages` and `/v1/messages/count_tokens` in `keepsSignIn` too. `corsGuard` (#1051) serves CORS only to the origins listed in Settings › Network › Web pages (`settings.CORSOrigins`, cleaned to `scheme://host[:port]` by `settings.CleanOrigins`, which refuses a wildcard). A browser extension's own pages, popup and service worker are listed the same way by their origin, which is the browser's scheme and the extension's id: `chrome-extension://<id>` (Chromium, the id 32 letters a–p), `moz-extension://<uuid>` (Firefox, the Internal UUID about:debugging shows, not the add-on id) and `safari-web-extension://<uuid>` (Safari, which picks a new UUID on each launch, so a listing lasts until Safari restarts); the id must have that browser's shape, cased any way, and nothing else is taken — no bare scheme, no wildcard, no path (SkyAerope on Discord: an extension without host permissions is held to CORS like a page). A content script's fetch carries the page's origin, not the extension's. A listed extension is treated exactly as a listed page, below; one not listed passes as before (other schemes, below) with no CORS headers. For a listed origin it answers the preflight (204) and adds `Access-Control-Allow-Origin`, and every other request from it needs an enabled gateway key (`access.Authenticate`), even on loopback, or gets a 401. It takes the key from the caller `lanGuard` recorded too, since on the running server `lanGuard` has already put magpie's own token in the key's place. Any other web page is refused 403 on every route (`foreignPage`): on loopback a call needs no key and the body's Content-Type isn't checked, so a page the user visits could otherwise send a "simple" `text/plain` POST and spend their subscriptions blind. Only an `http`/`https` Origin is judged, and one on this computer (`localhost`, `*.localhost`, `127.0.0.0/8`, `[::1]`, any port) or the request's own origin (its host and port equal to `Host`, such as a page on the gateway's LAN address) passes, as does usemagpie.ai on `/v1/magpie/omarchy`. Other schemes (`app://`, `file://`, `tauri://`, `vscode-webview://`, `chrome-extension://`) come from desktop apps, webviews and extensions that don't enforce CORS, and pass keyless as before; `null` is not one of them, since any web page sends it from a sandboxed frame and an opened file sends it too, so a call with it needs an enabled gateway key as a listed origin's does, and is answered 403 without one (no CORS headers either way, so a frame or a local page still reads no reply). A page at a subdomain of localhost (`localhostSubdomain`, #2256) needs a key the same way: Chrome and Firefox resolve `*.localhost` to loopback themselves, but Safari and other WebKit views ask the system resolver, which before macOS 26 asks the network's DNS (WebKit bug 160504), so a resolver that answers serves such a page from anywhere. `tauri.localhost` and `wails.localhost` stay keyless on Windows only, where Tauri's and Wails' webviews serve themselves at those names; on macOS and Linux those apps use `tauri://` and `wails://`. A request with no Origin (every agent's) passes through with no CORS headers, as before. A page whose own name resolves to 127.0.0.1 (DNS rebinding) would count as same-origin here, so `lanGuard` refuses it first (`rebound`, 403): a loopback request carrying a browser's marks (`Origin`, `Sec-Fetch-Site`/`Sec-Fetch-Mode`, a `Mozilla/` user agent) whose `Host` isn't this computer's (an IP, `localhost` but not a subdomain of it, which WebKit asks the DNS for (#2256), a container runtime's name for the host such as `host.docker.internal`, `MAGPIE_PUBLIC_URL`'s or `MAGPIE_ADDR`'s host, the machine's own name) needs an enabled gateway key. Agents send none of those marks and pass under any name. Before any of that, `lanGuard` lets in one request without a key from anywhere: `POST /_magpie/claude-mcp/<token>` with the token of a Claude subscription run now live (`ownCallback`, see [the Claude subscription bridge](claude-subscription-bridge.md)), the run's MCP helper calling back to a `MAGPIE_ADDR` that isn't loopback (#1546). Next, before the key or `rebound` is looked at, the allow list (lc on Discord, magpie in Docker on a public host): with `MAGPIE_ALLOW_IPS` or Settings › Network › Allowed addresses (`settings.AllowIPs`, this computer's own, never brought by a sync or restore: see [sync and backup](sync-backup.md#what-stays-on-each-computer); the variable wins and the page then only shows it) naming IPs and CIDR ranges, a request whose connection (`RemoteAddr`, IPv4-mapped IPv6 unmapped, zone dropped) is outside them is refused 403 naming its address, even with an enabled gateway key (`refuseNotAllowed`). Loopback and this computer's own interface addresses always pass. A forwarding header is never taken for the address, so a proxy or tunnel on this computer passes (it arrives from loopback) and its clients are limited at the proxy. An entry that doesn't parse lets nothing in and is logged once; the list stays on. Settings' list is read with `settings.LoadChecked`: a settings.json that can't be read, or doesn't parse with no last good generation, is unknown, never "no list", so the list read last in this process stays in force (`lastAllow`), and with none read yet only this computer passes, the 403 saying settings.json couldn't be read; logged once. No file, or an empty one, is no list. The Settings page's saves read with `LoadChecked` too and refuse such a file, as `settings.Save` does. `magpie web`'s server is wrapped in the same check (`AllowGuard`), and its port hands the gateway's client routes (`ClientPath`) to `Server.Front`, the same lanGuard-over-Handler the gateway's listener serves, each marked by `FromPagePort` so `local` is false for it (`viaPagePort`; `lanGuard` refuses it 403 while magpie isn't shared, saying to call the gateway's own address, and asks a gateway key otherwise): a raw TCP forward or a proxy with no forwarding header reaches that port from loopback, so no request there counts as an agent here (`TestClientPathCoversHandler` fails when a route Handler adds is in neither `ClientPath` nor its list of routes that stay on the gateway's port). Settings refuses a list that would leave out the address the page saving it is open from (`KeepsOut`); the page names that address, which behind Docker or a proxy is the proxy's, and offers to add it to the refused list (`allowSays`, Mathresearcher on Discord). | [`gateway.go`](../../internal/gateway/gateway.go), [`allow.go`](../../internal/gateway/allow.go), [`internal/settings/allowips.go`](../../internal/settings/allowips.go), [`cors.go`](../../internal/gateway/cors.go), [`codex_catalog.go`](../../internal/gateway/codex_catalog.go), [`ollama.go`](../../internal/gateway/ollama.go), [`ollama_chat.go`](../../internal/gateway/ollama_chat.go), [`internal/settings/origins.go`](../../internal/settings/origins.go) |
| Model resolution | `serve` resolves the model the agent asked for: Claude tier stand-ins, a routing group (`provider.GroupFor`: its id, the model's id however a vendor spells it, else the one group whose name it is, unless a provider serves a model by that id; the user's own groups only while the `groups` plugin is on, [the plugin runtime](plugin-runtime.md#gateway-extension-points-p3-router-strategy)), auto stand-ins, the agent's own stand-in (`StandIn`: Codex's config.toml `model` when magpie is its provider — in a WSL distro, the distro's own, of the ones running now — for a name it sends that magpie doesn't serve, such as its auto-review's `codex-auto-review`), itself taken through `GroupFor` and auto stand-ins so a config naming a group bare reaches it, then `provider.Resolve`. A Codex memory call or auto-review (`x-openai-subagent: guardian`, or `codex-auto-review`) that still names no served model goes to the model Codex's last turn was answered on (`codexMemoryStandIn`, per agent and gateway key; a memory call first waits beside the turn it was started with, through `codexLeads`, see the side turns below), so a Codex on magpie through another provider table, a profile or another computer isn't answered 404 (Adam on Discord, `TestCodexAutoReviewReachesItsTurnsModel`). A bare model id several providers serve (MOMO on Discord: `glm-5.3` under opencode-go and a6api) is never refused: with found groups on (the default) `GroupFor` takes it to the group magpie found for it (`auto-<slug>`), its members in the Providers order, routed and failed over as any group, a conversation staying with the member that answered it while its cache is worth it (affinity); with them off, `Resolve` takes the first provider in the Providers order that exposes it, with no fallback. magpie writes only `provider/model` ids into agents' configs (`magpieModels`), so a bare id is one the user wrote. `/v1/models` lists bare ids only when the user asks for them ([Model ids without the provider](#model-ids-without-the-provider)). Every reply says who answered in `X-Magpie-Provider` and `X-Magpie-Model` (`noteMember`), and the usage log and the Routing page keep it. A model id with `~` and no slash that resolves as nothing else is the one served id (a provider's model or a group) whose slashes it spells as `~` (`unflat`, `provider.Unflat`; MiniMax Code's spelling, #1387), taken back in `validateModel` before key limits, middleware and usage see it; two ids spelled alike are neither. A Claude model id whose version is dashed (`relay/claude-opus-4-6-us`, with or without `:level` and `[1m]`) that is not served as spelled is the one served id it dashes (`provider.ClaudeUndashed`; the spelling magpie gives Claude Code, which reads a dotted version as Claude Opus 4), taken back in `validateModel` and `unprefixed` the same way. An unknown model gets a 404 naming why: a switched-off provider, a disabled group or an empty group. Otherwise it names up to three ids nearest to what was asked (`provider.Closest`: words of a model's display name count before words of its id, and a provider's id or name only alongside them, so "Zen-Space-Bunny" is told `opencode-zen-free/space-bunny-free`, MOMO on Discord), then the ways a model can be named, then every id (`unknownModel`; chat and embeddings). | [`gateway.go`](../../internal/gateway/gateway.go), [`internal/provider/group.go`](../../internal/provider/group.go), [`internal/provider/flat.go`](../../internal/provider/flat.go), [`internal/provider/claudedash.go`](../../internal/provider/claudedash.go) |
-| A found group's two ids | A group magpie found is listed (`/v1/models`, the catalog, the lists written into agents, the pickers, the CLI and TUI) as `auto/<model>`: the model's id as a vendor spells it, dots kept and with no vendor prefix (`auto/claude-opus-5.5`; `provider.Group.Ref`, `spelledIn`, preferring a spelling models.dev lists), so a client that looks the part after the slash up on models.dev finds it (ZeroClover on X). Its old id `group/auto-<slug>` is served forever. Inside magpie the group keeps that one id: `validateModel` takes `auto/<model>` (with `:level` or `[1m]`) back to it with `provider.CanonicalRef` before key limits, routing, affinity and the usage log see the request, and the request body is rewritten to it, so both ids count as one group. A gateway key naming either id, `group/*` or `auto/*` passes for both (`allows` in `key_models.go`). `SaveGroup` stores a member, rule or classifier picked as `auto/<model>` by the old id. An agent field magpie set to `group/auto-<slug>` moves to `auto/<model>` on the next `SyncCatalog` (`agent.renameFoundGroups`), but only while its value is still what applied.json says magpie wrote; a value the user set or changed stays. A pick of the group by its old id written now (`Agent.Apply`) is written as `auto/<model>`. An agent's hidden, picked and ordered models saved by the old id hold for the new one (`PublicRef` in `visible.go`), and a bare model id still reaches its found group (`bareTarget`). Claude Code is given a dotted Claude version dashed, so it may send `auto/claude-sonnet-4-5`: that is the same group, and `Reseat` still moves an agent off it once the group is gone (`samePick`). `auto` is no provider id: `Save` and `Rename` refuse it for a new provider, and a plugin's `auto` is `auto-plugin` (`PluginID`). A provider of the user's saved as `auto` before keeps its models: while it exists, `auto/<x>` is its model and found groups list as `group/auto-<slug>` (`autoRefsOn`). Hand-made groups stay `group/<id>`. | [`internal/provider/autoref.go`](../../internal/provider/autoref.go), [`key_models.go`](../../internal/gateway/key_models.go), [`internal/agent/autoref.go`](../../internal/agent/autoref.go) |
+| A found group's two ids | A group magpie found is listed (`/v1/models`, the catalog, the lists written into agents, the pickers, the CLI and TUI) as `auto/<model>`: the model's id as a vendor spells it, dots kept and with no vendor prefix (`auto/claude-opus-5.5`; `provider.Group.Ref`, `spelledIn`), so a client that looks the part after the slash up on models.dev finds it (ZeroClover on X). The spelling is the one models.dev gives the model most (`catalog.Spelling`, its `normal` index: `glm-5.3-flash` whether the members serve `glm-5-3-flash`, Ark's dated id or `glm-5.3-flash`), so it no longer follows the order the providers were added in; for a model models.dev doesn't know, the first member's spelling it lists, else the first member's. The group's name comes from the same choice (`autoGroups`): the name models.dev gives that spelling (`catalog.NameOf`), else a vendor's own name for it, else the spelling itself; they were picked apart, a name of `glm-5-3-flash` beside `auto/glm-5.3-flash` (XYenon on Discord, `TestFoundGroupIDAndNameAreOneSpelling`). A found group the user changed keeps the name they saved. Every spelling it was listed by before is still the group (`CanonicalRef`), and `PublicRef` takes one to the spelling now. Its old id `group/auto-<slug>` is served forever. Inside magpie the group keeps that one id: `validateModel` takes `auto/<model>` (with `:level` or `[1m]`) back to it with `provider.CanonicalRef` before key limits, routing, affinity and the usage log see the request, and the request body is rewritten to it, so both ids count as one group. A gateway key naming either id, `group/*` or `auto/*` passes for both (`allows` in `key_models.go`). `SaveGroup` stores a member, rule or classifier picked as `auto/<model>` by the old id. An agent field magpie set to `group/auto-<slug>`, or to an `auto/<model>` spelt otherwise than the group is listed now, moves to `auto/<model>` on the next `SyncCatalog` (`agent.renameFoundGroups`, `TestFoundGroupMovedOffAnOldSpelling`), but only while its value is still what applied.json says magpie wrote; a value the user set or changed stays, and is still served. A pick of the group by its old id written now (`Agent.Apply`) is written as `auto/<model>`. An agent's hidden, picked and ordered models saved by the old id hold for the new one (`PublicRef` in `visible.go`), and a bare model id still reaches its found group (`bareTarget`). Claude Code is given a dotted Claude version dashed, so it may send `auto/claude-sonnet-4-5`: that is the same group, and `Reseat` still moves an agent off it once the group is gone (`samePick`). `auto` is no provider id: `Save` and `Rename` refuse it for a new provider, and a plugin's `auto` is `auto-plugin` (`PluginID`). A provider of the user's saved as `auto` before keeps its models: while it exists, `auto/<x>` is its model and found groups list as `group/auto-<slug>` (`autoRefsOn`). Hand-made groups stay `group/<id>`. | [`internal/provider/autoref.go`](../../internal/provider/autoref.go), [`key_models.go`](../../internal/gateway/key_models.go), [`internal/agent/autoref.go`](../../internal/agent/autoref.go) |
| Candidates | `plan` lists one provider's candidates: one per key or account on, then each `Fallback` model, with resting ones last (`restLast`). A fallback the user unchecked in its own provider's model list is skipped, as a group's member is (`provider.ResolveRoute`, #3911; `fallback_unpicked_test.go`), and so is it where fallbacks are read for careful accounts, native compaction, redaction and Codex's own turns. A fallback can be a routing group (`group/<id>`, 01huadalang on Discord): `planPaused` hands its members to `planLevel` as a request to the group would (`planFallbackGroup`), in the group's own routing and sink, its pause rules applied in `serve`, and its trace rows marked `Fallback` with the group in `Via`. Its turn rules (`ruleFor`, which may ask a classifier) are not applied: the plan is made before the primary is tried, and a classifier call on every request the primary answers costs too much. Each provider/model is tried once a round: a member that is the primary, an earlier fallback or another fallback group's is left out where it came second, so a group holding this provider is no loop (groups have no fallbacks of their own, and a member's are not followed). A group that is gone is passed over. Every place that reads fallbacks (careful accounts, native compaction, redaction, Codex's own turns, Claude's review) reads a group's members through `provider.FallbackModels`. `fallback_group_test.go`. `planGroup` and `planLevel` weigh a group's members together. A nested group plans by its own routing (#576); one left on the default (Smart) in a group that pools (Smart, In turn, Least used, Weekly pace, Free first, Speed first, a plugin's) takes the outer group's, as a provider left on the default does (`provider.Group.Within`, set on `Member.Via`, so the trace's `Subs` and the Routing page read the routing that applies, #3847). In a group In order, By weight or Manual it stays Smart. `TestFreeFirstReachesAGroupInItLeftOnTheDefault`. So does a member whose provider routes other than Smart (`ownRouting`): weighed as one by its first not resting (`firstAwake`), tried whole in its own order; `leastHeld` leaves such a group's order alone too. A provider on Smart, or routed as the group is, is pooled with the group's other keys and accounts. `group_own_routing_test.go`. A member's own fallbacks are not the group's. | [`fallback.go`](../../internal/gateway/fallback.go) |
| Order of keys and accounts | `Routing`: smart (""), `order`, `rotate`, `usage` (least used, with an `usageHalfLife` of 1h), `pace`, `weight`, `free` (free first) or `fast` (speed first). `weighRouted` reads each candidate into a `routes.Seat` and asks the strategy serving its routing (`routes.Find`, the router strategy point of [the plugin runtime](plugin-runtime.md#gateway-extension-points-p3-router-strategy)) for the order: Smart is `routes.Smart`, the core's; the others are `routes.Builtin`, registered by the built-in plugin `rotation`. With it off a routing no strategy serves is tried in its listed order, and `routingOf` treats it as `order` wherever the core asks about a routing (a turn's mark, `goesRound`, `sinks`, a rotate group's sessions, a group's heads). Smart, `usage` and `pace` weigh a subscription by its allowance (`allowances`), and a key by its own usage windows when magpie reads them (`keyAllowance`: a sub2api key given a 5-hour, day or 7-day limit, or a key bought as a plan, such as Kimi Code's or a GLM Coding Plan's); any other key has none. Among accounts a plugin reads as prepaid wallets (a window's `balance`, #3950), Smart, `usage` and `pace` put the one with more left first where they would otherwise tie, only within one provider and unit (`routes.Seat.Left`/`LeftIn`, see [provider plugins](provider-plugins.md#a-wallets-balance)): each kind is ordered in the places its own seats take, so a group weighing several providers' accounts as one pool orders each provider's wallets too (#4095, `TestGroupWalletsGoByWhatTheyHaveLeft`). `free` weighs by what a model costs there and nothing else: only a strategy with `routes.Strategy.ByFree` set (`routes.FreeFirst` is the one) has `weighRouted` fill `routes.Seat.Free`, from `provider.FreeModel` — the vendor's own `catalog.Model.Free` word, else a list price of $0 on every count — so a pool routed any other way never reads a model list for it, and one routed `free` spends the members whose model costs nothing before those that spend the allowance or credits, each tier in its listed order (nothing free is left behind a paid one, and a pool with no free model behaves as `order`). A group routed `free` weighs its members whole, each over its own accounts or keys as its provider routes them. `fast` weighs by speed lately and nothing else: only a strategy with `routes.Strategy.BySpeed` set (`routes.Fastest`) has `weighRouted` fill `routes.Seat.TTFT` and `TPS`, from `speedOf` ([`speed.go`](../../internal/gateway/speed.go)): per `restID` (account or key, and model), a decayed average (half-life 20m) of a streamed answer's ms to its first content and of its output tokens a second as `usage.DecodeOf` counts them, written once as an answer ends (`noteTrySpeed`, beside `servedCandidate`) and read with one map lookup per candidate, never from the usage history; past an hour since its last answer a seat counts as not measured, the records are capped at 4096, and a restart forgets them. `routes.Fastest` ranks the awake by their first token plus 200 tokens at their pace (a seat with no pace at the measured seats' middle pace), keeps seats within a tenth of their band's fastest in listed order, and of a pool's requests with seats both measured and not, gives every fifth to one not measured (round the unmeasured, `probes`, so one is never starved); resting seats go after the awake, used-up ones (`UsedShare`) after those, and rests and failover are as for any routing. The trace's rows carry `lateTtft`/`lateTps` for the Routing page's story ("answered fastest lately — first token in 0.8s"). A non-streamed reply tells nothing (no first token), so a pool that never streams stays in listed order bar the probes. A group routed `weight` (#1910) takes its members, not their keys, by smooth weighted round robin: `planLevel` makes each model member (its keys ordered by its own provider's routing) and each nested group one unit, and `weightedUnits` puts the round's pick (`routes.Round` over `group/<id>`, keyed by the member's spelling, `Group.Weights`, 1 if unset) first and the rest in member order for failover; a unit whose head rests leaves the round, while one whose accounts are only near their limit (Smart's 90% band, not resting) keeps its share, the band ordering only its own accounts (`TestWeightedGroupGivesALowGroupItsShare`; Creat.wu on Discord read the Routing page's "kept for when the others can't" as the member passed over, so the page now tells a member behind another by a group's weights or order as such, `memberSplit` in the routing plugin's `client.js`), and a kept conversation moves the round's charge to the member that kept it (`wrrSeat`, `routes.MoveRound`). A lone key or account is weighed against nobody, but what it has left is still read into the trace (`weighRouted`), so the Routing page shows it as it does for several (#1016); all but used up, it keeps its conversation rather than being said to move (`affine`). A failure rests a candidate (`failure`, `failureOf`). | [`routing.go`](../../internal/gateway/routing.go), [`weighted.go`](../../internal/gateway/weighted.go), [`internal/routes/`](../../internal/routes), [`internal/provider/routing.go`](../../internal/provider/routing.go) |
| Limits | Each key or account (a candidate's `who()`) has at most `MaxConcurrency` requests out at once (its own `AccountConcurrency` over it); one more waits in its lane's queue, bounded by `QueueLimit` and `QueueWait` and turned away with a 429 past either (`lanes.take`). One with no limit still counts its requests out in a lane of `Limit` 0, which never waits, so `Lanes` (`/v1/magpie/concurrency`, the GUI's `/api/lanes`) says how many run there too and the Providers page's pill shows it (chentuoyan on Discord, `TestLanesCountWithNoLimit`); a limit set while they are out counts them. `MaxRPM` (coeo91 on Discord: OpenRouter's free models take 20 a minute) bounds how many requests it sends the vendor in any rolling 60 seconds (`rpms`), counting each for a second more (`rpmSlack`), since the vendor counts a request when it arrives and the first on a new connection arrives later by its dial: one more waits for room in the minute, in the order they came, after it has its slot and right before it is sent. A wait that would be longer than 2 minutes (or the provider's `QueueWait`, when shorter: `rpmWait`) is turned away at once with a 429 whose `Retry-After` is when the minute has room; nothing rests for it. An agent gone while it waits gives its place back. Every request that reaches the vendor counts: each try of the candidate loop (a retry, the next key, a fallback) waits in `serve`, and the requests a try makes on the way and the gateway's own asks (count_tokens, System One's decisions, embeddings, drawing, Kimi's search) are counted by `rpmTransport` on `s.client` (`metered`, `paidFor`). count_tokens never waits: a candidate with no room is skipped, and the local estimate answers. A full lane or a minute with no room gives way to a ready key or account of the provider or the group (`laneMate`, `ready`); a fallback is never asked for want of either. A plugin's account sends through its own transport, so only its tries are counted, not a plugin's own extra requests. Set in the provider editor (Concurrency, Requests per minute, Queue size, Queue wait) or with `magpie provider account-concurrency`, `queue` and `rpm`; a subscription's are kept with its picks, and every account of it keeps them, those on beside the first as well (`withPicks`, called by `All` and `AlsoOn`; #1899: a second WorkBuddy AI account had none, and queued 62s with the wait set to 1s). | [`concurrency.go`](../../internal/gateway/concurrency.go), [`rpm.go`](../../internal/gateway/rpm.go), [`internal/provider/concurrency.go`](../../internal/provider/concurrency.go) |
diff --git a/internal/agent/autoref.go b/internal/agent/autoref.go
index 29a48377e..07843ca82 100644
--- a/internal/agent/autoref.go
+++ b/internal/agent/autoref.go
@@ -13,10 +13,14 @@ import (
// checks its model against its list (OpenCode) would find it gone. On its
// next write of the agent's lists (SyncCatalog), magpie moves each field
// it set to the old id onto the new one; a field the user set themselves,
-// or changed since magpie set it, stays as they left it.
+// or changed since magpie set it, stays as they left it. So does a field
+// magpie set to an auto/<model> spelt as the group is listed no longer
+// (auto/glm-5-3-flash, now auto/glm-5.3-flash: the spelling follows
+// models.dev's, Group.Spelled), which the gateway serves as ever.
// setToFoundGroups are the agents magpie set a field of to a found
-// group's group/auto-<slug>, by id: those renameFoundGroups looks at, so
+// group's group/auto-<slug> or auto/<model>, by id: those
+// renameFoundGroups looks at, so
// a sync reads no other agent's files for it. None while a provider of
// the user's is called auto, and auto/<model> is its.
func setToFoundGroups() map[string]bool {
@@ -28,7 +32,7 @@ func setToFoundGroups() map[string]bool {
var out map[string]bool
for id, ap := range appliedLoad() {
for _, v := range ap.Fields {
- if strings.Contains(v, provider.GroupPrefix+"auto-") {
+ if strings.Contains(v, provider.GroupPrefix+"auto-") || strings.Contains(v, provider.AutoPrefix) {
if out == nil {
out = map[string]bool{}
}
@@ -41,8 +45,8 @@ func setToFoundGroups() map[string]bool {
}
// renameFoundGroups moves a's fields that magpie set to a found group's
-// group/auto-<slug> onto the group's auto/<model>, the agent's prefix and
-// suffix kept. It answers whether it moved any.
+// group/auto-<slug>, or to an auto/<model> it is listed by no longer,
+// onto the group's auto/<model> now, the agent's prefix and suffix kept. It answers whether it moved any.
func (a *Agent) renameFoundGroups() bool {
if a.Native != nil || len(a.Fields) == 0 {
return false
@@ -73,16 +77,20 @@ func (a *Agent) renameFoundGroups() bool {
}
// publicValue is v, an agent's value for a field, with a found group's
-// group/auto-<slug> in it as the group's auto/<model>: its prefix
-// (magpie/), an effort or [1m] after the id, and the agent's own suffix
-// kept. ok is false when v names no such group, or one magpie has no
-// group for now.
+// group/auto-<slug>, or an auto/<model> spelt otherwise than the group is
+// listed now, in it as the group's auto/<model>: its prefix (magpie/), an
+// effort or [1m] after the id, and the agent's own suffix kept. ok is
+// false when v names no such group, one magpie has no group for now, or
+// the group as it is listed already.
func (a *Agent) publicValue(v string) (string, bool) {
model, suffix, one := a.split(v)
if !one {
return v, false
}
i := strings.Index(model, provider.GroupPrefix+"auto-")
+ if i < 0 {
+ i = strings.Index(model, provider.AutoPrefix)
+ }
if i < 0 || i > 0 && model[i-1] != '/' {
return v, false
}
diff --git a/internal/agent/autoref_test.go b/internal/agent/autoref_test.go
index e3780c093..2cd30c18f 100644
--- a/internal/agent/autoref_test.go
+++ b/internal/agent/autoref_test.go
@@ -2,8 +2,10 @@ package agent
import (
"encoding/json"
+ "os"
"testing"
+ "github.com/yetone/magpie/internal/catalog"
"github.com/yetone/magpie/internal/edit"
"github.com/yetone/magpie/internal/provider"
)
@@ -80,3 +82,73 @@ func TestFoundGroupRenamedOnlyWhereMagpieSetIt(t *testing.T) {
t.Fatalf("the user's own %q became %q", old, got)
}
}
+
+// A found group's auto/<model> follows the spelling models.dev gives the
+// model most (XYenon on Discord), so one magpie listed before as
+// auto/glm-5-3-flash is auto/glm-5.3-flash now. An agent magpie set to the
+// old spelling is moved onto the new one on the next catalog sync, as one
+// set to group/auto-<slug> is: OpenCode checks its model against the list
+// magpie writes, which names the group by its new spelling only. One the
+// user set to it themselves keeps their value, which is still the group.
+func TestFoundGroupMovedOffAnOldSpelling(t *testing.T) {
+ syncHome(t)
+ os.WriteFile(catalog.CachePath(), []byte(`{
+ "zai": {"models": {"glm-5.3-flash": {"id":"glm-5.3-flash","name":"GLM-5.3-Flash"}}},
+ "fireworks": {"models": {"glm-5.3-flash": {"id":"glm-5.3-flash","name":"GLM-5.3-Flash"}}}}`), 0o644)
+ catalog.Reset()
+ for id, m := range map[string]string{"ark": "glm-5-3-flash", "spare": "glm-5.3-flash"} {
+ if err := provider.Save(provider.Provider{ID: id, Name: id, Key: "k", Chat: "http://127.0.0.1:1/v1", Models: []string{m}}); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if got := provider.PublicRef("group/auto-glm-5-3-flash"); got != "auto/glm-5.3-flash" {
+ t.Fatalf("the found group is listed as %q", got)
+ }
+ a, err := Find("opencode")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := a.Apply("model", "spare/glm-5.3-flash"); err != nil {
+ t.Fatal(err)
+ }
+ // what magpie wrote and recorded while the group was listed by the
+ // first provider's spelling
+ old := "magpie/auto/glm-5-3-flash"
+ if err := edit.SetJSON(a.Path, edit.KV{Path: "model", Value: old}); err != nil {
+ t.Fatal(err)
+ }
+ record(a.ID, "model", old)
+ SyncCatalog()
+ if got := a.Values()["model"]; got != "magpie/auto/glm-5.3-flash" {
+ t.Fatalf("magpie's own value became %q, want magpie/auto/glm-5.3-flash\n%s", got, readFile(a.Path))
+ }
+ if got := appliedOf(a.ID).Fields["model"]; got != "magpie/auto/glm-5.3-flash" {
+ t.Errorf("applied.json holds %q", got)
+ }
+ // set as it is listed now: left alone
+ SyncCatalog()
+ if got := a.Values()["model"]; got != "magpie/auto/glm-5.3-flash" {
+ t.Errorf("the group as it is listed became %q", got)
+ }
+
+ // the user's own: no record of the field
+ appliedMu.Lock()
+ m := appliedLoad()
+ delete(m, a.ID)
+ appliedSave(m)
+ appliedMu.Unlock()
+ if err := edit.SetJSON(a.Path, edit.KV{Path: "model", Value: old}); err != nil {
+ t.Fatal(err)
+ }
+ SyncCatalog()
+ if got := a.Values()["model"]; got != old {
+ t.Fatalf("the user's own %q became %q", old, got)
+ }
+ // and a pick of the old spelling written now is the group as listed
+ if err := a.Apply("model", "magpie/auto/glm-5-3-flash"); err != nil {
+ t.Fatal(err)
+ }
+ if got := a.Values()["model"]; got != "magpie/auto/glm-5.3-flash" {
+ t.Errorf("a pick of the old spelling was written as %q", got)
+ }
+}
diff --git a/internal/catalog/catalog.go b/internal/catalog/catalog.go
index d1792ce50..bc94579df 100644
--- a/internal/catalog/catalog.go
+++ b/internal/catalog/catalog.go
@@ -1189,6 +1189,16 @@ func NameOf(id string) string {
return n
}
+// Spelling is the spelling models.dev gives a model most, of every bare
+// id it knows that is the same model (SameModel): glm-5.3-flash for
+// glm-5-3-flash, GLM-5.3-Flash or Ark's glm-5-3-flash-260828, as most of
+// its providers spell it (the normal index normalFor reads). Lowercase,
+// without a vendor's prefix; "" when it knows the model by no spelling.
+func Spelling(id string) string {
+ load()
+ return normal[SameModel(id)]
+}
+
// Named gives a model the list names by its id alone the name models.dev
// knows it by (NameOf), so one model reads the same under every provider:
// a GLM Coding Plan's glm-5-turbo, which Zhipu's catalog doesn't list, is
diff --git a/internal/provider/autoref.go b/internal/provider/autoref.go
index f8cf84722..6a30ecbd3 100644
--- a/internal/provider/autoref.go
+++ b/internal/provider/autoref.go
@@ -129,11 +129,15 @@ func (g Group) Ref() string {
}
// PublicRef is the id agents are given for ref: a found group's
-// group/auto-<slug> as its auto/<model> (Group.Ref), its effort and [1m]
-// mark kept; any other ref as it is, a found group magpie has none of now
-// too.
+// group/auto-<slug>, or an auto/<model> spelt otherwise than it is listed
+// now (auto/glm-5-3-flash for auto/glm-5.3-flash), as its auto/<model>
+// (Group.Ref), its effort and [1m] mark kept; any other ref as it is, a
+// found group magpie has none of now too.
func PublicRef(ref string) string {
s := strings.TrimSpace(ref)
+ if strings.HasPrefix(s, AutoPrefix) {
+ s = CanonicalRef(s)
+ }
s, marked := strings.CutSuffix(s, "[1m]")
gid, ok := strings.CutPrefix(s, GroupPrefix)
if !ok || !strings.HasPrefix(gid, "auto-") || !autoRefsOn() {
@@ -155,12 +159,18 @@ func PublicRef(ref string) string {
}
// spelledIn is how the model of a found group's id is spelt by a vendor
-// (Group.Spelled): of the members whose model merges into the group by its
-// own id (mergeKey), the first models.dev lists by that very spelling, else
-// the first; failing those, the model the user said a member is the same
-// as (settings' ModelSameAs). Without a vendor's prefix ("anthropic/").
-// "" for a group whose id is not auto-…, or none of whose members is its
-// model: one the user made, whatever it is called, stays group/<id>.
+// (Group.Spelled): the spelling models.dev gives the model most
+// (catalog.Spelling: glm-5.3-flash whether the members serve glm-5-3-flash
+// or glm-5.3-flash, XYenon on Discord), so the id doesn't follow the
+// order the providers were added in, and the group's name is the one
+// models.dev gives that spelling (autoGroups). Failing that, of the
+// members whose model merges into the group by its own id (mergeKey), the
+// first models.dev lists by that very spelling, else the first; failing
+// those, the model the user said a member is the same as (settings'
+// ModelSameAs). Without a vendor's prefix ("anthropic/"). "" for a group
+// whose id is not auto-…, or none of whose members is its model: one the
+// user made, whatever it is called, stays group/<id>. Every spelling it
+// had before is still the group (CanonicalRef).
func spelledIn(g Group, same map[string]string) string {
if !strings.HasPrefix(g.ID, "auto-") {
return ""
@@ -188,6 +198,11 @@ func spelledIn(g Group, same map[string]string) string {
// an id a relay lists as its display name ("GPT-6 Sol") is no id to
// put in an agent's config: the one vendors agree on is, below
spaced := func(s string) bool { return strings.ContainsFunc(s, unicode.IsSpace) }
+ for _, m := range slices.Concat(own, alike) {
+ if s := catalog.Spelling(m); s != "" && !spaced(s) && "auto-"+Slug(sameModel(s)) == g.ID {
+ return s
+ }
+ }
spacedOnly := len(own)+len(alike) > 0
own, alike = slices.DeleteFunc(own, spaced), slices.DeleteFunc(alike, spaced)
for _, s := range own {
diff --git a/internal/provider/autoref_spelling_test.go b/internal/provider/autoref_spelling_test.go
new file mode 100644
index 000000000..0c42187c0
--- /dev/null
+++ b/internal/provider/autoref_spelling_test.go
@@ -0,0 +1,138 @@
+package provider
+
+import (
+ "os"
+ "path/filepath"
+ "testing"
+
+ "github.com/yetone/magpie/internal/catalog"
+)
+
+// glmCatalog lists GLM-5.3 Flash as models.dev does: glm-5.3-flash under
+// most providers, named GLM-5.3-Flash, and Volcengine Ark's dashed
+// glm-5-3-flash under one, named otherwise.
+const glmCatalog = `{
+ "zai": {"models": {"glm-5.3-flash": {"id":"glm-5.3-flash","name":"GLM-5.3-Flash"}}},
+ "fireworks": {"models": {"glm-5.3-flash": {"id":"glm-5.3-flash","name":"GLM-5.3-Flash"}}},
+ "openrouter": {"models": {"z-ai/glm-5.3-flash": {"id":"z-ai/glm-5.3-flash","name":"GLM-5.3-Flash"}}},
+ "volcengine": {"models": {"glm-5-3-flash": {"id":"glm-5-3-flash","name":"GLM 5.3 Flash"}}}}`
+
+// glmDottedOnly lists it under the dotted spelling alone.
+const glmDottedOnly = `{
+ "zai": {"models": {"glm-5.3-flash": {"id":"glm-5.3-flash","name":"GLM-5.3-Flash"}}},
+ "fireworks": {"models": {"glm-5.3-flash": {"id":"glm-5.3-flash","name":"GLM-5.3-Flash"}}}}`
+
+// spellingHome is a sandbox HOME with the models.dev catalog cat, and
+// models the providers' own, one provider each, in the order they are
+// added.
+func spellingHome(t *testing.T, cat string, models ...string) {
+ t.Helper()
+ isolate(t)
+ home := t.TempDir()
+ t.Setenv("HOME", home)
+ t.Setenv("USERPROFILE", home)
+ t.Setenv("XDG_CONFIG_HOME", filepath.Join(home, ".config"))
+ t.Setenv("XDG_CACHE_HOME", filepath.Join(home, ".cache"))
+ if err := os.MkdirAll(filepath.Dir(catalog.CachePath()), 0o755); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(catalog.CachePath(), []byte(cat), 0o644); err != nil {
+ t.Fatal(err)
+ }
+ catalog.Reset()
+ t.Cleanup(catalog.Reset)
+ for i, m := range models {
+ id := string(rune('a' + i))
+ if err := Save(Provider{ID: id, Name: id, Key: "k", Chat: "http://127.0.0.1:1/v1", Models: []string{m}}); err != nil {
+ t.Fatal(err)
+ }
+ }
+}
+
+func foundGroup(t *testing.T, id string) Group {
+ t.Helper()
+ for _, g := range Groups() {
+ if g.ID == id {
+ return g
+ }
+ }
+ t.Fatalf("no group %s in %+v", id, Groups())
+ return Group{}
+}
+
+// A found group's id and its name come from one choice (XYenon on
+// Discord): the spelling models.dev gives the model most, and the name it
+// gives that spelling, whichever provider was added first and however it
+// spells the model. They were picked apart: the name was the first
+// provider's id (glm-5-3-flash) beside auto/glm-5.3-flash, and the id
+// itself followed the providers' order. Every spelling it was listed by
+// before is still the group, and a name the user gave it stays theirs.
+func TestFoundGroupIDAndNameAreOneSpelling(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ cat string
+ models []string
+ }{
+ // the reporter's: the first provider's spelling, which models.dev
+ // doesn't list, was the name, and the one it lists the id
+ {"a spelling models.dev lacks first", glmDottedOnly, []string{"glm-5-3-flash", "glm-5.3-flash"}},
+ {"Ark's dashed spelling first", glmCatalog, []string{"glm-5-3-flash", "glm-5.3-flash"}},
+ {"Ark's dated id first", glmCatalog, []string{"glm-5-3-flash-260828", "glm-5.3-flash"}},
+ {"the dotted spelling first", glmCatalog, []string{"glm-5.3-flash", "glm-5-3-flash"}},
+ {"no provider serves models.dev's spelling", glmCatalog, []string{"glm-5-3-flash", "GLM-5.3-Flash-260828"}},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ models := tc.models
+ spellingHome(t, tc.cat, models...)
+ g := foundGroup(t, "auto-glm-5-3-flash")
+ if g.Ref() != "auto/glm-5.3-flash" || g.Name != "GLM-5.3-Flash" {
+ t.Fatalf("the group is %q named %q, want auto/glm-5.3-flash named GLM-5.3-Flash", g.Ref(), g.Name)
+ }
+ // what agents may hold from before: each still the group
+ for _, old := range []string{"auto/glm-5-3-flash", "auto/glm-5.3-flash", "group/auto-glm-5-3-flash"} {
+ if gid, ok := GroupIDOf(old); !ok || gid != "auto-glm-5-3-flash" {
+ t.Errorf("GroupIDOf(%q) = %q %v", old, gid, ok)
+ }
+ if _, _, ok := Resolve(old); !ok {
+ t.Errorf("%s isn't served", old)
+ }
+ }
+ for in, want := range map[string]string{
+ "auto/glm-5-3-flash": "auto/glm-5.3-flash",
+ "auto/glm-5-3-flash:high": "auto/glm-5.3-flash:high",
+ "auto/glm-5-3-flash[1m]": "auto/glm-5.3-flash[1m]",
+ "group/auto-glm-5-3-flash": "auto/glm-5.3-flash",
+ "auto/glm-5.3-flash": "auto/glm-5.3-flash",
+ "auto/no-such-model": "auto/no-such-model",
+ "a/" + models[0]: "a/" + models[0],
+ } {
+ if got := PublicRef(in); got != want {
+ t.Errorf("PublicRef(%q) = %q, want %q", in, got, want)
+ }
+ }
+ })
+ }
+
+ t.Run("the user's name", func(t *testing.T) {
+ spellingHome(t, glmCatalog, "glm-5-3-flash", "glm-5.3-flash")
+ g := foundGroup(t, "auto-glm-5-3-flash")
+ g.Name = "Flash"
+ if err := SaveGroup(g); err != nil {
+ t.Fatal(err)
+ }
+ g = foundGroup(t, "auto-glm-5-3-flash")
+ if g.Name != "Flash" || g.Ref() != "auto/glm-5.3-flash" {
+ t.Errorf("the user's group is %q named %q", g.Ref(), g.Name)
+ }
+ })
+}
+
+// A model models.dev doesn't know keeps the spelling the members give it,
+// and its name is that id, not another provider's spelling of it.
+func TestFoundGroupUnknownToModelsDevNamedByItsID(t *testing.T) {
+ spellingHome(t, glmCatalog, "acme-9-1", "acme-9.1")
+ g := foundGroup(t, "auto-acme-9-1")
+ if g.Ref() != "auto/acme-9-1" || g.Name != "acme-9-1" {
+ t.Errorf("the group is %q named %q", g.Ref(), g.Name)
+ }
+}
diff --git a/internal/provider/group.go b/internal/provider/group.go
index d0f263e41..90ce8ca4b 100644
--- a/internal/provider/group.go
+++ b/internal/provider/group.go
@@ -713,6 +713,17 @@ func autoGroups(entries []Entry, same map[string]string) []Group {
g.Name = own(e) // a vendor that names it, over one that only lists its id
}
}
+ // the name goes with the id agents are given (auto/<Spelled>): the
+ // one models.dev gives that spelling, else, where no vendor names
+ // it, that spelling itself, not the first provider's (XYenon on
+ // Discord: glm-5-3-flash beside auto/glm-5.3-flash). A group the
+ // user changed is stored with their name, never this one.
+ g.Spelled = spelledIn(g, same)
+ if n := catalog.NameOf(g.Spelled); g.Spelled != "" && n != "" {
+ g.Name = n
+ } else if g.Spelled != "" && g.Name == es[0].Model {
+ g.Name = g.Spelled
+ }
out = append(out, g)
}
return out