Skip to content

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

provider, gateway: a Remote magpie's model it offers Fast on can be picked fast

yetone24fab123bb43
diff --git a/docs/subsystems/providers-accounts.md b/docs/subsystems/providers-accounts.md
index e58fc93a0..056f8d537 100644
--- a/docs/subsystems/providers-accounts.md
+++ b/docs/subsystems/providers-accounts.md
@@ -48,7 +48,7 @@ keys and accounts per request is in [Gateway routing and fallback](gateway-routi
| Routing groups | User-made groups from the Routing view, and auto-found groups of the same model across providers (derived, never stored). The same model is the same id as vendors agree on it (`sameModel`): lowercase, without a vendor's prefix, a version's dot as `-`, a run of spaces, `_` and `-` as one `-` (a relay listing its display name as the id, `GPT-6 Sol`, joins `gpt-6-sol`, Chill on Discord: `TestSameModelDisplayNameAsID`), and without a YYYYMMDD or Ark YYMMDD snapshot date. Every word still counts (`gpt-6`, `gpt-6-mini` and `gpt-6-sol` stay apart), as do a `:variant`, a four-digit release and OpenAI's dashed date (`gpt-4o-2024-08-06`, a pinned snapshot whose group id agents may already name). A provider kept "Only through routing groups" joins them the same way. Members are `provider/model[:effort]`. A group can nest another (`group/<id>`); `SaveGroup` refuses loops. A group given another id (`agent.RenameGroup`: the Routing page, `magpie groups rename`, the TUI) moves every agent field on `group/<old>` to `group/<new>`, spelled as the agent spells it, through the same `renameRefs` a provider's rename uses, then `SyncCatalog`; before, the agents stayed on a group magpie no longer had (lucis0116 on X, `TestRenameGroupMovesTheAgentsOnIt`). A provider's or group's display name needs no move: `store` and `SaveGroup` drop the catalog, and `SyncCatalog` writes the new labels into every agent's list. `Match` takes a glob or `re:` pattern (#766), both matched in any case (`compilePattern`; `(?-i)` inside a `re:` makes case matter). A found group follows the providers magpie has: one removed leaves it, while one switched off stays in it (`foundGroups`, `heldOffEntries`; one without a key, such as a plugin not signed in, finds no group), skipped by `membersIn` and said as switched off on the Routing page, so switching one of two providers off for a while doesn't take the group away from the agents, rules and groups set to it; it is back in its place once on again (#2671: `TestFoundGroupStaysWithAProviderOff`, `TestFoundGroupWithAProviderOff`, `TestReseatKeepsAFoundGroupWithAProviderOff`, `TestFoundGroupMemberOfASwitchedOffProvider`). A found group the user changed (an `auto-…` id stored) is read without the members of providers magpie no longer has (`withoutRemoved`, not written back, so a provider back under its id is back in it), except a manual group's pick, a rule's model, or all of them when none would be left. A switched-off provider's members stay in it, skipped by `membersIn`, and the Routing page says them as switched off (`memberJSON.providerOff`). The user's own groups keep their members. Three templates make a group in one click from the models the user has (`provider.Templates`, `AddTemplate`; the Routing page's cards before a first group and its Templates menu after, `magpie group template [kind] [name]`): `smart` sends a hard turn to the strongest model and an easy one or a compaction to a cheap one, asked by a classifier (the decision API when there is one, else the cheapest priced model that doesn't reason); `thrifty` starts on two cheap models of different providers and sends high reasoning to the strongest; `steady` fails over between the strongest model of up to three providers. A model is weighed by its maker's list price when known, else what its provider charges, else by its id's size words (`sizeOf`); one over `tooDear` (USD 100 a million output tokens) is never picked. A template that can't be made says what is missing (`Need`). It is saved under a name and id no group has (`freeGroupName`, shared with `CopyGroup`), never over one. A group is shared as text (`ShareGroup`, a group row's Copy to share): JSON marked `"magpie": "routing-group"` with a format `version` (`ShareVersion`), holding the group's members as it names them, patterns, routing, rules, classifier and settings. A group holds only `provider/model` ids, never a key, account or address, and the derived matches, found/hidden/off flags and the rules that hold by a folder (a path on the sharer's machine, `Rule.Folders`) stay behind; a pasted one is left out too. `ImportGroup` (the Routing page's Import, `POST /api/groups/import`) reads it with words or a code fence around it, refuses another text, a newer format or none (`ShareError`, said in the reader's language). A member whose provider the importer has is kept; else the same model (`AutoGroupOf`) under the first provider of theirs that serves it (`Instead`); else it is left out and named (`Missing`), with the rules that send to it, its place among the off and fast members, and a classifier gone takes the intent rules and auto effort with it. Nothing is added when no member is left; what is added gets a free name, never replacing a group. A group of patterns only that match nothing now (a plugin's models not listed) has no members: `/api/groups` says them, and an unmakeable template's, as `[]`, never `null`; the Routing page reads the response through `groupsFrom` and draws a group it still can't draw as one row saying so, so one bad group never hides the rest (#1585). | [`group.go`](../../internal/provider/group.go), [`grouptemplate.go`](../../internal/provider/grouptemplate.go), [`group_share.go`](../../internal/provider/group_share.go) |
| Allowance | `Quotas` asks every vendor at once: subscription windows (`SubscriptionUsage`), key-bought plans (`PlanQuotas`) and key balances (`KeyBalances`). The Usage page, `magpie quota --json` and `GET /v1/magpie/quotas` read it, each window with its whole-window estimate (`Holds`/`HoldsWhy`, `usage.WithWindowHolds`, which `quotaReport` reaches through the `ReckonHolds` hook since package provider can't import usage, #2333). A single card can be read again on its own (#840). A remote magpie's cards come from what it has kept (`CachedCards`, `GET /v1/magpie/quotas/cards`) and are never read there for this computer except by a card's refresh (`POST /v1/magpie/quotas/refresh`, throttled per card). What it has kept is the Usage page's cards with the readings made behind the requests since laid over them, a later one over an earlier by `readSeq` (`cards_kept.go`): each account's `LoginUsage` reading (the used-up switch, the Codex warm-up, routing's `Allowances`), and each key's `KeyAllowance` windows on its plan or balance card. A Claude account's windows Claude Code told as it answered (`NoteClaudeLimits`, kept in `claudeUsage` with their own `heardSeq`, which drops the account's `LoginUsage` reading) stand on its card over any reading started before them (`withHeardClaude`, #2206), so a magpie only requests reach still tells them. An account or key read that way and never on the page gets a card from that reading, and after a restart, before either is read again, the cards come from `quotas.json`, dated (`AsOf`). A magpie serving only other magpies has nobody on its page (#1313). Each key of a remote-magpie provider also gets a card of its own, under `<remote>/~keys`, one section per key (#1547, `remoteKeyCards` in `remote_key_limits.go`): the gateway key's limit as that magpie holds it, read from `GET /v1/magpie/limit` asked with that key alone, so a key never sees another's numbers. It shows a window per cap (tokens, spend) named for the period, used against the cap, with its reset, plus `GatewayKey` (what is left, calls, a cycle of days, used up); a key held to no limit shows `Unlimited`. It is kept for `remoteCardsFor` like the remote's cards and read again by the card's refresh (`?provider=<remote>/~keys&user=<key name>`). A read that fails keeps the last numbers, dated (`AsOf`); with none the card says why, never zero or no limit. A remote from before `/v1/magpie/limit` (404) says it is too old to tell (`errRemoteNoKeyLimit`). A remote that holds the key to a budget, models or accounts answers its cards 403 `gateway_key_held` (#1981, `errKeyHeld`): the cards kept from before are dropped and only the key's own card shows. Its owner can let the key be told the cards of what it may use (#2216, `magpie gateway-key quotas <id> on`); the remote then answers those, and 403 as before when that is none. A remote's cards are kept by provider and key (`remoteCardsID`), so a changed key never shows what the old one was told, and a read is kept only over one asked before it (`keepRemoteCards`). Cursor, Grok and a Kiro key keep the page's cards only. With Settings → Allowances → *Allowance reads* at *When I ask* (`QuotaReads == "asked"`, #1518: magpie started at login before the proxy app read by itself, direct), only a read the user asked for goes out: the Usage page or the tray panel's Allowances opened (no more than once in 30s, `quotasOpened`, #1588) or refreshed (`?asked=1`), a card's refresh (`RefreshUsage`), `magpie quota`, `magpie accounts`, `magpie quota wait` and the TUI's quotas (`Asked`). Any other read (`quotaReading` → `holdUnasked`) carries `netproxy.Hold`, so its requests fail before they leave, and every reader gives back what it last read, dated, or "not read yet" (`errNotAsked`): routing, the used-up switch, the menu bar and alerts go by that. An account refused for its quota (`StaleAllowance` → `markStaleRead`) or a key refused (`StaleKeyAllowance` → `refused`) is still read, once (`unheld`). Warm-up and check-in are not reads and are unchanged. | [`cards_kept.go`](../../internal/provider/cards_kept.go), [`quotas.go`](../../internal/provider/quotas.go), [`subscription_usage.go`](../../internal/provider/subscription_usage.go), [`planquota.go`](../../internal/provider/planquota.go), [`balance.go`](../../internal/provider/balance.go), [`quota_refresh.go`](../../internal/provider/quota_refresh.go), [`remote_quotas.go`](../../internal/provider/remote_quotas.go), [`remote_key_limits.go`](../../internal/provider/remote_key_limits.go), [`quota_asked.go`](../../internal/provider/quota_asked.go) |
| A remote magpie's prices | A local magpie asks a remote magpie's `/v1/models` with `X-Magpie-Prices` (`PricesHeader`, sent by `listHeaders`). The remote answers each model's `magpie_price`: what its own Usage page counts the model at (`EntryPriceIn`: the price its user set, else its provider's list price at its price rate; a routing group only when every member costs the same). It tells it only to a request from its own computer or one let in with a gateway key (`local` or `sharedWith`); a list that didn't ask gets no `magpie_price` (a remote request without a valid key never reaches the list: `lanGuard` refuses it); every list told to those callers also carries the same price as OpenRouter's `pricing`, for agents ([gateway routing](gateway-routing.md)). The local keeps the price with the fetched list (`catalog.Model.Price`; a value that isn't a price, or has a negative part, is dropped, the model kept) and uses it as that provider's list price (`ListPrice` → `remotePrice`). A price the local user set (`provider/model`, `provider/*`, `*/model`) still comes first, and the local provider's own price rate still applies on top. A remote from before this sends no field and the models stay priced as before; an older local sends no header and is sent nothing new. The model editor says the greyed price is the other magpie's (`remoteList`). | [`remote_magpie.go`](../../internal/provider/remote_magpie.go), [`models.go`](../../internal/provider/models.go), [`gateway.go`](../../internal/gateway/gateway.go) (`models`), [`live.go`](../../internal/catalog/live.go) |
-| A remote magpie's service tiers | A remote magpie's `/v1/models` gives each model the `service_tiers` its own Codex is offered on it (`codexTiers` → `codexcat.ServiceTiers`, from the same `CodexCatalog` and `codexcat.Entries` as its `/v1/codex/models`: Fast on a ChatGPT account's GPT model, the tiers of Codex's own entry on a relay's, none on a model it offers none). The local keeps the ids (`catalog.Model.Tiers` → `Entry.Tiers`), `codexListed` hands them on for the remote's models, and `codexcat.Entries` offers them to the local Codex with Codex's own names (`namedTiers`). The gateway sends the tier Codex asks for to a remote magpie as it was asked (`Request.OwnTier`, as for a provider added by its address; dropped and not sent again if refused), and the remote serves it as its own Codex's turn (#1234). A remote from before this sends no tiers, and its models are offered none, as before. The list gives every client the tiers, not only a magpie asking with `X-Magpie-Drawers`: Cindy shows its Fast switch on a model whose `service_tiers` hold `priority` (#1914, `TestModelsListTiersForEveryClient`). | [`codexcat.go`](../../internal/codexcat/codexcat.go), [`codex_models.go`](../../internal/provider/codex_models.go), [`codex_catalog.go`](../../internal/gateway/codex_catalog.go), [`gateway.go`](../../internal/gateway/gateway.go), [`live.go`](../../internal/catalog/live.go) |
+| A remote magpie's service tiers | A remote magpie's `/v1/models` gives each model the `service_tiers` its own Codex is offered on it (`codexTiers` → `codexcat.ServiceTiers`, from the same `CodexCatalog` and `codexcat.Entries` as its `/v1/codex/models`: Fast on a ChatGPT account's GPT model, the tiers of Codex's own entry on a relay's, none on a model it offers none). The local keeps the ids (`catalog.Model.Tiers` → `Entry.Tiers`), `codexListed` hands them on for the remote's models, and `codexcat.Entries` offers them to the local Codex with Codex's own names (`namedTiers`). The gateway sends the tier Codex asks for to a remote magpie as it was asked (`Request.OwnTier`, as for a provider added by its address; dropped and not sent again if refused), and the remote serves it as its own Codex's turn (#1234). An agent's picker offers the bolt on a remote's model whose tiers hold `priority` (`provider.CanFast` reads them with `RemoteTiers`; Ultrafast too where they hold `ultrafast`, `UltraOn`), and a fast pick of one goes on with `service_tier` `priority` on the remote's Chat or Responses: an agent on Messages, whose fast is Claude's `speed`, has it turned into the tier the remote offers (`forwardTranslated`), so Claude Code's pick reaches the remote's vendor too (littlekk88 on Discord; `TestRemoteMagpieFastPick`, red without either half). A remote from before this sends no tiers, and its models are offered none, as before. The list gives every client the tiers, not only a magpie asking with `X-Magpie-Drawers`: Cindy shows its Fast switch on a model whose `service_tiers` hold `priority` (#1914, `TestModelsListTiersForEveryClient`). | [`codexcat.go`](../../internal/codexcat/codexcat.go), [`codex_models.go`](../../internal/provider/codex_models.go), [`codex_catalog.go`](../../internal/gateway/codex_catalog.go), [`gateway.go`](../../internal/gateway/gateway.go), [`live.go`](../../internal/catalog/live.go) |
| A relay's Codex entries | A provider the user added by its address with a Responses URL may list its models in Codex's own shape (`slug`, `supported_reasoning_levels`, `shell_type`, `base_instructions`: `catalog.CodexEntry`), plainly or when asked with Codex's `client_version`, as sub2api does (ctopsc on Discord: GPT-6.1 Terra was handed models.dev's 922000 window where the relay said 272000). `fetchOne` keeps such a row whole (`catalog.Model.Codex`, with its window, max window and inputs read off it), and when the plain list has none it asks the same URL once more with `client_version` (`codexEntries`): only where the list is fetched (add, key change, Refresh), never per Codex poll. The answer only adds entries to models the plain list has; one that fails or can't be read keeps the last list's entries (failed read = unknown), one that answers plainly says there are none. `codexcat.listedEntry` hands Codex the relay's entry as given, `base_instructions` included, with magpie's slug, name, priority and " via magpie" description; the user's window, compaction, levels and image setting still win (levels keep the relay's descriptions). A saved list from before is enriched at its next Refresh. `TestCodexListedEntry`, `TestCodexListedEntryInPlainList`. | [`codex_entries.go`](../../internal/provider/codex_entries.go), [`live.go`](../../internal/catalog/live.go), [`codexcat.go`](../../internal/codexcat/codexcat.go) |
| An endpoint's catalog | A key's provider with no catalog of its own (none named, none from a preset) is priced from the models.dev catalog whose `api` is one of its endpoints (`EndpointCatalog`, `catalog.AtEndpoint`; a trailing slash and case don't count, and an Anthropic base, kept as its root, is also matched with its `/v1`). Only when exactly one catalog is at that address, and it isn't a plan's (an id with `-plan`, or a `membershipCatalogs` one): a plan lists its membership's $0, and two catalogs at one address can't be told apart. A subscription's account never gets one. A provider at AMD's own endpoint is priced from `amd`, which lists Qwen3.8-27B at $0, a price, where its maker sells no such model and it had none (#2052); a relay's endpoint matches nothing and its model stays unpriced, never priced at a reseller's guess. `magpie model price` names the catalog, and says how to give a price when none is known. | [`models.go`](../../internal/provider/models.go), [`catalog.go`](../../internal/catalog/catalog.go) |
| A membership's $0 catalog | models.dev lists every model of Kimi Code's plans (`kimi-code-plan-global`, `kimi-code-plan-cn`) and of Xiaomi MiMo's Token Plans (`xiaomi-token-plan-cn`, `-sgp`, `-ams`) at $0: what the membership charges per token, not what the model costs. `membershipCatalogs` are never read for a price (`priceCatalogs`, `makerPriceCatalogs`), so a Xiaomi MiMo model is priced at `xiaomi`'s list price at every region, and each region of the preset names its own catalog, pay as you go `xiaomi` alone (#1873). A Kimi Code provider's model is priced at the Kimi API model it is (`kimiCodeAPI`, from Kimi Code's docs: k3 and k3-256k are kimi-k3, kimi-for-coding-highspeed is kimi-k2.7-code-highspeed), and kimi-for-coding (K2.8 Preview, not on the API) is unpriced rather than free (#1370). The alias is Kimi Code's alone (`kimiCodePlans`): a relay's own `k3` keeps its own price. A catalog other than these that lists a model at $0 still prices it at $0: models.dev has truly free models (nvidia, modelscope). The Requests list names the API model it was priced as (`PricedNameFor`). | [`models.go`](../../internal/provider/models.go) |
diff --git a/internal/gateway/gateway.go b/internal/gateway/gateway.go
index cc1f04659..7c6584aa9 100644
--- a/internal/gateway/gateway.go
+++ b/internal/gateway/gateway.go
@@ -5450,6 +5450,22 @@ func (s *Server) forwardTranslated(ctx context.Context, p provider.Provider, to
r.Tier, req = tier, &r
}
}
+ if p.IsRemoteMagpie() && req.Tier == "" && req.Fast && (to == provider.Chat || to == provider.Responses) {
+ // fast mode in Claude's words (a fast pick from an agent on
+ // its API, littlekk88 on Discord) is the tier another magpie
+ // offers it at: priority, or ultrafast for a pick sent
+ // Ultrafast where it offers that. Its Chat or Responses reads
+ // service_tier alone
+ tiers := provider.RemoteTiers(p, model)
+ tier := "priority"
+ if (req.Ultrafast || isUltra(ctx)) && slices.Contains(tiers, "ultrafast") {
+ tier = "ultrafast"
+ }
+ if slices.Contains(tiers, tier) {
+ r := *req
+ r.Tier, req = tier, &r
+ }
+ }
if own := own && s.fits(p.ID, tierField, to); own != req.OwnTier {
r := *req
r.OwnTier, req = own, &r
diff --git a/internal/gateway/remote_magpie_tier_test.go b/internal/gateway/remote_magpie_tier_test.go
index 3501ecb87..63df1a2d8 100644
--- a/internal/gateway/remote_magpie_tier_test.go
+++ b/internal/gateway/remote_magpie_tier_test.go
@@ -6,6 +6,7 @@ import (
"io"
"net/http"
"net/http/httptest"
+ "slices"
"strings"
"sync"
"testing"
@@ -121,3 +122,87 @@ func TestRemoteMagpieOffersItsTiers(t *testing.T) {
t.Errorf("tier sent to the remote magpie %v, by it to its vendor %v; want priority, priority", hops, vendor)
}
}
+
+// An agent's pick of another magpie's model is switched fast where that
+// magpie offers Fast on it (its list's service_tiers, #1234), and the
+// agent's requests then go on to it with service_tier priority, which it
+// sends its vendor: Claude Code's on Anthropic's API too, translated to the
+// Chat Completions that magpie serves the model on (littlekk88 on Discord:
+// no lightning in the picker, SetFastPick refused, tier_sent empty on both
+// computers). A model it offers no tier on can't be picked fast.
+func TestRemoteMagpieFastPick(t *testing.T) {
+ var mu sync.Mutex
+ var hops []any // service_tier as the remote magpie was sent it
+ vendor := &tierUp{}
+ up := httptest.NewServer(vendor)
+ t.Cleanup(up.Close)
+ t.Setenv("XDG_CONFIG_HOME", t.TempDir())
+ t.Setenv("XDG_CACHE_HOME", t.TempDir())
+ // its vendor serves the model on Chat Completions alone, as the
+ // report's native_endpoints said
+ if err := provider.Save(provider.Provider{ID: "relay", Name: "Relay", Key: "k", Models: []string{"gpt-6.1-sol", "glm-5"}, Chat: up.URL + "/v1"}); err != nil {
+ t.Fatal(err)
+ }
+ s := New()
+ h := s.Handler()
+ remote := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if r.Method == http.MethodPost {
+ b, _ := io.ReadAll(r.Body)
+ r.Body = io.NopCloser(strings.NewReader(string(b)))
+ var v map[string]any
+ json.Unmarshal(b, &v)
+ mu.Lock()
+ hops = append(hops, v["service_tier"])
+ mu.Unlock()
+ }
+ h.ServeHTTP(w, r)
+ }))
+ t.Cleanup(remote.Close)
+ id, err := provider.Add(provider.Provider{ID: "office", Name: "Office", Preset: provider.RemoteMagpiePreset, Chat: strings.TrimPrefix(remote.URL, "http://")})
+ if err != nil {
+ t.Fatal(err)
+ }
+ office, err := provider.Find(id)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if _, err := office.Fetch(context.Background()); err != nil {
+ t.Fatal(err)
+ }
+ if !provider.CanFast(*office, "relay/gpt-6.1-sol") || provider.CanFast(*office, "relay/glm-5") {
+ t.Fatalf("CanFast: gpt-6.1-sol %v, glm-5 %v; want true, false", provider.CanFast(*office, "relay/gpt-6.1-sol"), provider.CanFast(*office, "relay/glm-5"))
+ }
+ if err := provider.SetFastPick("claude", "office/relay/glm-5", true); err == nil {
+ t.Error("a model the remote magpie offers no tier on was picked fast")
+ }
+ if err := provider.SetFastPick("claude", "office/relay/gpt-6.1-sol", true); err != nil {
+ t.Fatal(err)
+ }
+ for _, a := range []struct{ path, body string }{
+ {"/v1/messages", `{"model":"office/relay/gpt-6.1-sol","max_tokens":1024,"stream":true,"messages":[{"role":"user","content":"hi"}]}`},
+ {"/v1/chat/completions", `{"model":"office/relay/gpt-6.1-sol","stream":true,"messages":[{"role":"user","content":"hi"}]}`},
+ } {
+ mu.Lock()
+ hops = nil
+ mu.Unlock()
+ postFrom(t, s, "claude", a.path, a.body)
+ mu.Lock()
+ got := slices.Clone(hops)
+ mu.Unlock()
+ // the hop to the remote magpie, and its own to its vendor (one
+ // gateway serves both here, so the last trace is the remote's)
+ if len(got) != 1 || got[0] != "priority" || vendor.last(t) != "priority" {
+ t.Errorf("%s: sent the remote magpie %v, by it its vendor %v; want priority, priority", a.path, got, vendor.last(t))
+ }
+ }
+ // another agent's requests for it go as they are
+ mu.Lock()
+ hops = nil
+ mu.Unlock()
+ postFrom(t, s, "opencode", "/v1/chat/completions", `{"model":"office/relay/gpt-6.1-sol","stream":true,"messages":[{"role":"user","content":"hi"}]}`)
+ mu.Lock()
+ defer mu.Unlock()
+ if len(hops) != 1 || hops[0] != nil || vendor.last(t) != nil {
+ t.Errorf("another agent's request went fast: remote %v, vendor %v", hops, vendor.last(t))
+ }
+}
diff --git a/internal/provider/fastpick.go b/internal/provider/fastpick.go
index c2ab34a24..fa865de80 100644
--- a/internal/provider/fastpick.go
+++ b/internal/provider/fastpick.go
@@ -46,7 +46,8 @@ func UltraPicks(agent string) []string {
// CanUltra reports whether a fast pick of model on p can be sent as
// Ultrafast: a ChatGPT model that one of Codex's accounts lists the tier
// on (Account.Tiers), or a plugin's model, with fast mode, that the plugin
-// says its vendor serves at ultrafast (serviceTiers, #2514). A list that
+// says its vendor serves at ultrafast (serviceTiers, #2514), or another
+// magpie's model its list offers ultrafast on (#1234). A list that
// doesn't say tiers offers none.
func CanUltra(p Provider, model string) bool {
return UltraOn(p, model, UltraModels())
@@ -62,6 +63,10 @@ func UltraOn(p Provider, model string, ultra map[string]bool) bool {
m, listed := pluginModel(pp, model)
return listed && CanFast(p, model) && pluginTierOn(pp.ID, m, "ultrafast")
}
+ if p.IsRemoteMagpie() {
+ // another magpie's model it offers Ultrafast on, beside Fast
+ return CanFast(p, model) && slices.Contains(RemoteTiers(p, model), "ultrafast")
+ }
return p.Account != nil && p.Account.Agent == "codex" && CanFast(p, model) && ultra[model]
}
diff --git a/internal/provider/groupfast.go b/internal/provider/groupfast.go
index 1e5df8478..d50542137 100644
--- a/internal/provider/groupfast.go
+++ b/internal/provider/groupfast.go
@@ -88,6 +88,14 @@ func CanFast(p Provider, model string) bool {
_, ok = pluginModel(pp, model+"-fast")
return ok
}
+ if p.IsRemoteMagpie() {
+ // another magpie's model it offers its own Codex Fast on (its
+ // list's service_tiers, #1234): a pick sent fast here goes on to
+ // it with service_tier "priority", which it sends its vendor as
+ // its own Codex's turn would be (littlekk88 on Discord: the
+ // picker had no Fast for a remote magpie's model)
+ return slices.Contains(RemoteTiers(p, model), "priority")
+ }
if p.Account != nil {
switch p.Account.Agent {
case "codex":
@@ -115,6 +123,20 @@ func CanFast(p Provider, model string) bool {
return OwnFast(p, model)
}
+// RemoteTiers are the service tiers another magpie's list says it offers
+// on model (#1234), nil for a provider that isn't one.
+func RemoteTiers(p Provider, model string) []string {
+ if !p.IsRemoteMagpie() {
+ return nil
+ }
+ for _, m := range p.liveByID(model) {
+ if len(m.Tiers) > 0 {
+ return m.Tiers
+ }
+ }
+ return nil
+}
+
// OwnFast reports whether model has a fast mode only as the user's own
// provider may serve it (#1615): a GPT model on a provider they added by
// its address, on an OpenAI API, which magpie can't tell serves priority
@@ -186,7 +208,7 @@ func cleanFast(entries []Entry, g *Group) error {
return fmt.Errorf("%s is a group: its models are sent as it says, so it takes no :%s", model, FastWord)
}
if p, m, ok := resolveIn(entries, model); ok && !CanFast(p, m) {
- return fmt.Errorf("%s has no fast mode magpie can ask for (ChatGPT and OpenAI GPT models, a GPT model on a provider you added by its address, Cursor's with a fast one, a plugin's it says are served at priority, and Claude Opus 4.8 and 5 on an Anthropic key have)", model)
+ return fmt.Errorf("%s has no fast mode magpie can ask for (ChatGPT and OpenAI GPT models, a GPT model on a provider you added by its address, Cursor's with a fast one, a plugin's it says are served at priority, another magpie's it offers Fast on, and Claude Opus 4.8 and 5 on an Anthropic key have)", model)
}
out = append(out, f)
}