diff --git a/docs/reference.md b/docs/reference.md index 801f2727b..55761d328 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -2264,7 +2264,7 @@ result for every request: who went first, and why. of a window (100% In order). *Stays: Strict* does, and asks no other: the conversation stays on its account, resting, spent or past its cap, and its errors go to the agent. - With *Stays: Session* or *Strict* under Smart, Least used first or + With *Stays: Session* or *Strict* under Quota first, Least used first or Use before expiry, a new conversation goes to the account the fewest other conversations of the last 30 minutes are on (of those not resting and under 90%), so sessions side by side each keep an account of their own; @@ -2274,13 +2274,13 @@ So routing decides who goes first only for a conversation nobody has answered yet. An account that has used 90% goes behind the others for new conversations, but a conversation already on it stays there until 98%. -**The routings.** Smart, Least used first and Use before expiry go by the share +**The routings.** Quota first, Least used first and Use before expiry go by the share used of the fullest window that counts the model, the 5-hour window -included. Smart and Use before expiry put an account behind the others once a +included. Quota first and Use before expiry put an account behind the others once a window is at 90% or more, and behind those once one is at 98% or more, each of these groups ordered by the share used. -- **Smart** (the default): of the accounts under 90%, the one whose +- **Quota first** (the default): of the accounts under 90%, the one whose allowance renews soonest goes first, because what it has left is lost at the reset. It is not load balancing: every new conversation goes to that account too, the others showing "one renewing sooner goes first" on the @@ -2343,7 +2343,7 @@ each of these groups ordered by the share used. counts. Accounts whose pace is within a tenth of the highest in their band count as alike, and among them the one magpie sent the fewest tokens lately goes first. A - Claude or ChatGPT account not known goes first once, as in Smart (a + Claude or ChatGPT account not known goes first once, as in Quota first (a ChatGPT one while another is known); another unknown account counts as a fresh week. A ChatGPT account whose usage page can't be read is known from the week its answers tell, until a @@ -2381,16 +2381,16 @@ each of these groups ordered by the share used. are kept for the long requests only they can take. A member whose window the request is longer than is left out before it is asked, as under every routing, and asked only once every one with room is out of its - allowance. Members of one size go as Smart orders them, a member all but + allowance. Members of one size go as Quota first orders them, a member all but used up still goes after those with room, and one whose window isn't known goes after every known one. The window is the one you set for the model, else the model list's. The Routing page says why the first went first: "Composer 2.5's 200K context window is the smallest that holds this request". -The routings besides Smart are the built-in plugin `rotation` (Routing +The routings besides Quota first are the built-in plugin `rotation` (Routing strategies in Plugins › Built-in). It stays on while a provider or group is -routed by one of them. Turned off, the pickers offer Smart alone, and a +routed by one of them. Turned off, the pickers offer Quota first alone, and a provider or group still set to one of them is tried in its listed order. Your own routing groups are the built-in plugin `groups` (Routing groups in @@ -2406,12 +2406,12 @@ depends on the routing: | --- | --- | | In order | Everything: the first takes every request it can. | | In turn | Where the rotation goes next. | -| Smart | Only between accounts whose windows all renew in the same hours, or whose shares used are equal. | +| Quota first | Only between accounts whose windows all renew in the same hours, or whose shares used are equal. | | Least used first | Only between accounts with the same share used and the same tokens sent lately. | | Use before expiry | Only between accounts in the same pace band that magpie sent the same tokens lately, in practice none since magpie started. | | Speed first | Only between those within a tenth of each other's speed, and among those not measured lately. | | Cheapest first | Only between those that cost the same now, and among those with no known price. | -| Small context first | Only between those whose context windows are the same size, after Smart's order, and among those whose window isn't known. | +| Small context first | Only between those whose context windows are the same size, after Quota first's order, and among those whose window isn't known. | For Claude Code and Codex, *Make first* also signs the agent in to that account, because the account the agent is signed in to is first. With diff --git a/docs/subsystems/gateway-routing.md b/docs/subsystems/gateway-routing.md index ddff68b0b..f146be53d 100644 --- a/docs/subsystems/gateway-routing.md +++ b/docs/subsystems/gateway-routing.md @@ -54,9 +54,9 @@ another for the conversation instead of listing every id | 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 the asking agent's own subscription in magpie serves (a provider whose `Account.Agent` is the agent: Codex's ChatGPT accounts for Codex, Claude's for Claude Code) goes to that subscription first, found groups on or off (`ownFirst`, `provider.OwnRoute`; freefcw on X: Codex's bare `gpt-6-astra` went to Devin through `auto-gpt-6-astra`, whose soonest-renewing member came first, and with found groups off to the first provider in the order). Not for a group the user made or changed by that name, a found group magpie set one of the agent's fields to (`SetToGroup`, `agent.SetToGroup` over the agent's applied record, #750's bare spelling included), a gateway key held to some models, or a client magpie doesn't know as an agent; an auto stand-in and `agent.Reseat` prefer the agent's own subscription the same way (`AutoStandInFor`, `sameModel`). Otherwise a bare model id several providers serve (MOMO on Discord: `glm-5.3` under opencode-go and a6api): with found groups on (the default) `GroupFor` takes it to the group magpie found for it (`auto-`), 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, an agent with a subscription of its own in magpie is refused it with a 400 naming the providers' ids and `magpie group auto on` (`provider.OffSpread`, `offSpreadRefused`): off, magpie picks no vendor for it. Any other client still gets the first provider in the Providers order that exposes it (`Resolve`), with no fallback. A provider the user keeps out of found groups (Routing's "Leave out a provider", `provider.SetAutoGroupSkip`, `autoGroupSkip` in providers.json; chenxiang0010 on Discord) is in none of them, so a model one other provider serves is no group; the groups the user made or changed keep it. A request still naming a found group that took away goes to its model from a provider not kept out (`AutoStandIn`), and an agent set to it is moved there (`agent.Reseat`). 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/`: 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-` is served forever. Inside magpie the group keeps that one id: `validateModel` takes `auto/` (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/` by the old id. An agent field magpie set to `group/auto-`, or to an `auto/` spelt otherwise than the group is listed now, moves to `auto/` 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/`. 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/` is its model and found groups list as `group/auto-` (`autoRefsOn`). A model its vendor lists with the maker's name left off is merged by the model it is (`mergeKeyIn`, `catalog.Unprefixed`): Kimi Code's `k3.1-pro`, whose entry in the provider's own models.dev catalog names `moonshotai/kimi-k3.1-pro`, is in `auto/kimi-k3.1-pro` with OpenCode Go's and Devin's `kimi-k3.1-pro` (tmr11235 on X, who had to add it by hand). The canonical alone never merges a model, as models.dev gives Kimi Code's `k3.1-pro-highspeed` the canonical `kimi-k3.1-pro` and `k3-256k` `kimi-k3`: the id must be the canonical's with a maker's name (letters) taken off the front, or go on past it to a model models.dev knows by that name before the whole id (`k3.1-pro-highspeed` is `kimi-k3.1-pro-highspeed`; `k3-256k` stays its own). A relay whose catalog says nothing of its `k3.1-pro` is not merged on a guess. The id such a model had a group by before (`auto-k3-1-pro`, Kimi Code with Kimi Code China) is the group's `Former`, so an agent still set to `auto/k3.1-pro` is served (`TestFoundGroupTakesAModelListedWithoutItsMaker`, `TestFoundGroupOfUnprefixedIDsAloneIsTheModels`). Hand-made groups stay `group/`. | [`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 model's own id at a provider | A model the user lists by an id of theirs at a provider (a signed-in account's and a plugin's too; settings' `ModelIDs`, `magpie model id `, the editor's "Listed as"; [Providers and accounts](providers-accounts.md#runtime-path)) is that id everywhere the gateway names it: `/v1/models` and the lists written into agents (`Available`), `Resolve`, the routing groups and the group magpie finds for it (`auto/`, with every other provider serving that id), a gateway key's models, `X-Magpie-Model` and the usage log's `model`. Only the upstream request differs: every place that sends a wire name reads `settings.Wires()`, which is `ModelWires` with each `ModelIDs` entry turned round (`"/"` → the vendor's own id, wrapped by a `/*` wire), so the body, a Vertex path and the usage log's endpoint carry the vendor's id; an explicit `ModelWires` entry for that id wins. The vendor's reply names its own id, which the usage log, recent calls and the Routing page keep as `served`; the agent gets the id it asked for back in the reply, in every protocol, streamed or whole (`memberWriter` in [`member.go`](../../internal/gateway/member.go), `replyNamingOf`: the reply's `model`, Responses' `response.model`, Anthropic's `message.model`, Gemini's `modelVersion`; issennknight on Discord, whose agent warned that `deepseek-v4.1-flash` came back as `deepseek-v4.1-flash-1017`). The same holds for a group or a `provider/model` id the vendor knows by another name. A reply whose vendor sent the wire name as asked keeps the vendor's name (a dated `-20261017` included). Settings' `replyModel` (Settings › Models › Replies › Model name in replies) picks for every request: `""` the model asked for, `member` the group's member, `vendor` the vendor's own name, as before the asked-for name, each for every agent, Claude Code, Claude Desktop and Codex included (ZoeCats on Discord: in v0.1.2760 `member` still gave those three the model asked for; `TestPluginReplyNamesMember` holds it on a plugin too). A file from before it with `memberModel` on reads as `member`, and `memberModel` is written beside `replyModel` for an older magpie (`normal` in settings.go; `Merge` in settingsapi takes an older page's `memberModel` only when its switch moved). A request's `X-Magpie-Response-Model` (`asked`, `member` or `vendor`) overrides the setting for that request, for every agent (`TestReplyNamesAskedModel`, `TestGeminiReplyNamesAskedModel`, `TestReplyNamesMember`, `TestReplyModelFoldsMemberModel`, `TestReplyModelSaves`). A request still naming `provider/` (an agent's file magpie didn't rewrite) resolves and goes out as it is. A key held to either id passes for both (`modelAllowed` checks the ref, then `OwnModelID`, then `ListedModelID`); a group member passes the same way. An id is given to a model of the provider's chat list or its picks; the image, video and embeddings routes send no wire name, so they are not served under one (`TestLocalModelIDOnEveryRoute`). At an account or a plugin the account's own say of the model is read by the vendor's id: a plugin's API and fetch, Claude Code's `--model`, Antigravity's variant, and which accounts list it and at what levels (`TestLocalModelIDAtAPlugin`, `TestLocalModelIDAtAClaudeAccount`, `TestLocalModelIDAtAnAntigravityAccount`). | [`internal/provider/localid.go`](../../internal/provider/localid.go), [`internal/settings/settings.go`](../../internal/settings/settings.go), [`key_models.go`](../../internal/gateway/key_models.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/`, 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, Use before expiry, 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), `fast` (speed first), `drain` (until used up) or, a group's only, `cheap` (cheapest first), `expiring` (free quota by expiry) or `fit` (small context 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. A Remote magpie is weighed by the card of the provider serving the model there, as last read from it (`provider.RemoteAllowance`: the model's longest provider path with a card, `claude` for `claude/claude-sonnet-5-5`, the account there with the most left for the inner model): before #6708 (zzh11223311 on X) a group of Remote magpies had every member not known (used 0 in the trace) and went by tokens and stickiness alone. It never waits: when the routing weighs the remote against another and its cards are older than 30 seconds, they are read again in the background (one read at a time per remote; the remote answers from the cards it keeps), so a request to one Remote magpie alone sends it nothing more (`TestRemoteMagpiesWeighedByTheirCards`). A remote too old to tell what routing reads of its windows stays not known. A Remote magpie is still not an account for cap holds and Codex credits (`candidate.allowance`). 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 user's word that the whole provider costs them nothing (`Provider.CountFree`: the editor's Free for me, `magpie provider set free=yes`; jiabubu on Discord, ModelScope's free daily quota), else 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. Whatever a group's routing, the Routing groups page tags a member `provider.FreeModel` counts free "free", on the group's card and beside its provider in the editor (`groupsState`'s `memberInfo[].free`, jiabubu on Discord, `TestGroupMemberSaysFree`, `group-member-free.test.cjs`). `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. `cheap` (a group's only: `provider.normalize` drops it from a provider, whose keys and accounts all bill one price, and the CLI refuses it there) weighs by price now and nothing else: only a strategy with `routes.Strategy.ByPrice` set (`routes.Cheapest`) has `weighRouted` fill `routes.Seat.Priced`, `Cost` and `CacheCost`, from `provider.Provider.PriceAt` at `priceClock()` — the price Usage would count a call made then (the user's `ModelPrices`, else list or maker price, at the price rate and `RateAt`'s window, a `FreeModel` at 0), doubled in its vendor's peak hours by `catalog.Price.In` (`PeakOf`: DeepSeek's API, Command Code's and OpenCode Go's DeepSeek models, each at DeepSeek's hours; Ollama Cloud's deepseek-v4.1-flash and deepseek-v4-pro, dated tags too, at its own 12:00–18:00 UTC weekdays, `catalog.PeakOllama`). `routes.Cheapest` sorts stably by a million in plus a million out, a tie (within a millionth) by cache read, and unpriced seats after every priced one in listed order; rests and failover are as for any routing. The trace's rows carry `price` (`input`, `output`, `cacheRead`, `peak`) for the Routing page's story ("costs least on Ollama now — $0.150 in, $0.600 out a million tokens"). `TestCheapestFirstGroupFollowsPeakHours` holds the clock at a peak and an off-peak hour, and `TestCheapestFirstGroupFollowsOllamaOffPeak` at each edge of Ollama Cloud's hours, a Saturday, and in far zones. A group routed `expiring` (`provider.FreeExpiring`, `routes.FreeExpiring`; wowbbs on Discord, five check-in accounts of WorkBuddy, MiniMax, Trae and Qoder in one group) spends free quota before paid, the soonest lost first. Its strategy sets `ByFree` and `ByPlan`, so `weighRouted` fills `Seat.Free` (the model is free there, as for `free`) and `Seat.FreePlan` (`provider.FreePlan` of the account's `Plan`: free, trial, 免费, 试用, 体验, 體驗; for a Remote magpie member, of the plan on the subscription card it is weighed by, `provider.RemoteSeat`, which has no `Account` here: #6708, `TestRemoteMagpieFreePlanSpentFirst`). It orders three tiers: the free ones with quota left, by `routes.Expires` (the earliest of a window's renewal and a credit's `RunsOut`, `Lapse` included) truncated to the hour, a stable tie in listed order and an unknown expiry after every known one; then the paid ones as `Smart` orders them among themselves; then the used up and resting, by when they come back. A paid account takes a request only when no free one has quota left, and failover walks the same tiers. The trace's rows carry `free` and `expires` for the Routing page's story ("its free quota is lost soonest, in 1d 2h"). It is a group's only: `provider.normalize` keeps it off a provider, and `magpie provider set … routing=expiring` is refused like `cheap`. Nothing changes for a group not routed `expiring`. `TestGroupSpendsFreeQuotaSoonestToExpireFirst` (gateway), `TestFreeExpiringSpendsSoonestFreeFirst` (routes) and routing-free-expiring.test.cjs hold it. A plugin whose usage doesn't say when free credits lapse (Trae, Qoder's add-on pools) is ordered after the ones that do. A group routed `fit` (`provider.SmallFirst`, `routes.SmallFirst`; yg6888 on X, Cursor's Composer at 200K and Grok 4.7 at 256K never answering in a Smart group of 1M models) goes by each member's context window: its strategy sets `ByWindow`, so `weighRouted` fills `Seat.Window` from `windowIn` (the provider's own `Contexts`, else the catalog's, read once per weighing), and `routes.SmallFirst` takes Smart's order and sorts it stably into three bands: a seat of a provider set to be used first, then the rest with room, then the all but used up (`seatTier` 2); within a band the smaller known window first and an unknown one after every known one, a tie in Smart's order. It never picks one too small: `roomy` has already left out every member whose window the request is estimated past (and keeps it as the last resort as for any routing), so the first left is the smallest that holds the request. The trace's rows carry `context` for the Routing page's story ("its 200K context window is the smallest that holds this request"). A group's only: `provider.normalize` drops it from a provider, whose keys serve one window, and the CLI refuses it there. Nothing changes for a group not routed `fit`; `TestSmallContextFirstGroupKeepsTheBigOneForLongRequests` (gateway), `TestSmallFirstOrdersByWindow` (routes) and routing-small-first.test.cjs hold it. 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/`, 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`). `weight` on a provider spreads its keys by each key's `Weight` and a subscription's accounts by each account's (`AccountWeights`, rubbzha on X): `keyWeight` gives a seat its `Weight`, 1 when none is set, and `routes.Weighted` takes them by smooth weighted round robin, a resting one leaving the round and a kept conversation staying as Stays says (`TestWeightedKeys`, `TestAccountWeightSharesRequests`). 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`). `drain` (dzxx0496 on Discord: free accounts one after another, the first not taking the requests back once it renews) stays on one seat per pool (`routes.Drain`, which remembers the seat's `Key` per pool) until it is used up — a known window at 100% (`provider.SpentShareOf`, as In order) or resting out of quota or credit (`routes.Seat.Spent`, filled by `spentRest` from `restingOf`'s `failQuota`/`failCredit`) — then goes on to the next not used up in listed order and stays there, wrapping round; the others follow it in listed order for failover. A rate limit or a failure only rests the seat, tried last meanwhile, and the pool comes back to it; with every seat used up it stays put, and a seat that leaves the pool leaves it on the first not used up. A group routed `drain` pools its members' accounts and keys under `group/`, as Smart does. A restart forgets where each pool was, and it starts again at the first not used up (`TestDrainKeepsTheOneThatTookOver`). 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`) that isn't resting: its lane is free only because nothing is sent there. A request already waiting in a lane doesn't stay bound to it: whenever a slot is given back in any lane or a rest is lifted (`lanes.freed`, signalled by the releaser, `Unrest` and `UnrestAll`), and when the soonest rest among the others runs out (at most every `laneRecheck`), it goes to the first key or account after it in the planned order that has a free slot with no queue, minute room, isn't resting and isn't a reserve now (`waitMate`, `keepAtOnce` re-derived over the provider's candidates, `errMoved`). So one that took a seat while those before it rested, then became a reserve once they were back, doesn't keep requests waiting behind its own long turns (01huadalang on Discord: three ZCode accounts at three at once, the first two back from a 405 while the waiting ones stayed on the third until its requests were cut by hand; `TestWaitingRequestGoesToAccountBackFromRest` under Smart and In turn, with Stays on and off, `TestWaitingRequestTakesSlotGivenBackElsewhere` under every routing). Strict stays leaves no other candidate, so the request waits for its own. A fallback is never asked for want of a slot or a minute (`TestFullMemberGivesWay`). 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) | +| 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/`, 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 (Quota first) in a group that pools (Quota first, In turn, Least used, Use before expiry, 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 Quota first. `TestFreeFirstReachesAGroupInItLeftOnTheDefault`. So does a member whose provider routes other than Quota first (`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 Quota first, 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), `fast` (speed first), `drain` (until used up) or, a group's only, `cheap` (cheapest first), `expiring` (free quota by expiry) or `fit` (small context 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: Quota first is `routes.Quota first`, 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). Quota first, `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. A Remote magpie is weighed by the card of the provider serving the model there, as last read from it (`provider.RemoteAllowance`: the model's longest provider path with a card, `claude` for `claude/claude-sonnet-5-5`, the account there with the most left for the inner model): before #6708 (zzh11223311 on X) a group of Remote magpies had every member not known (used 0 in the trace) and went by tokens and stickiness alone. It never waits: when the routing weighs the remote against another and its cards are older than 30 seconds, they are read again in the background (one read at a time per remote; the remote answers from the cards it keeps), so a request to one Remote magpie alone sends it nothing more (`TestRemoteMagpiesWeighedByTheirCards`). A remote too old to tell what routing reads of its windows stays not known. A Remote magpie is still not an account for cap holds and Codex credits (`candidate.allowance`). Among accounts a plugin reads as prepaid wallets (a window's `balance`, #3950), Quota first, `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 user's word that the whole provider costs them nothing (`Provider.CountFree`: the editor's Free for me, `magpie provider set free=yes`; jiabubu on Discord, ModelScope's free daily quota), else 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. Whatever a group's routing, the Routing groups page tags a member `provider.FreeModel` counts free "free", on the group's card and beside its provider in the editor (`groupsState`'s `memberInfo[].free`, jiabubu on Discord, `TestGroupMemberSaysFree`, `group-member-free.test.cjs`). `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. `cheap` (a group's only: `provider.normalize` drops it from a provider, whose keys and accounts all bill one price, and the CLI refuses it there) weighs by price now and nothing else: only a strategy with `routes.Strategy.ByPrice` set (`routes.Cheapest`) has `weighRouted` fill `routes.Seat.Priced`, `Cost` and `CacheCost`, from `provider.Provider.PriceAt` at `priceClock()` — the price Usage would count a call made then (the user's `ModelPrices`, else list or maker price, at the price rate and `RateAt`'s window, a `FreeModel` at 0), doubled in its vendor's peak hours by `catalog.Price.In` (`PeakOf`: DeepSeek's API, Command Code's and OpenCode Go's DeepSeek models, each at DeepSeek's hours; Ollama Cloud's deepseek-v4.1-flash and deepseek-v4-pro, dated tags too, at its own 12:00–18:00 UTC weekdays, `catalog.PeakOllama`). `routes.Cheapest` sorts stably by a million in plus a million out, a tie (within a millionth) by cache read, and unpriced seats after every priced one in listed order; rests and failover are as for any routing. The trace's rows carry `price` (`input`, `output`, `cacheRead`, `peak`) for the Routing page's story ("costs least on Ollama now — $0.150 in, $0.600 out a million tokens"). `TestCheapestFirstGroupFollowsPeakHours` holds the clock at a peak and an off-peak hour, and `TestCheapestFirstGroupFollowsOllamaOffPeak` at each edge of Ollama Cloud's hours, a Saturday, and in far zones. A group routed `expiring` (`provider.FreeExpiring`, `routes.FreeExpiring`; wowbbs on Discord, five check-in accounts of WorkBuddy, MiniMax, Trae and Qoder in one group) spends free quota before paid, the soonest lost first. Its strategy sets `ByFree` and `ByPlan`, so `weighRouted` fills `Seat.Free` (the model is free there, as for `free`) and `Seat.FreePlan` (`provider.FreePlan` of the account's `Plan`: free, trial, 免费, 试用, 体验, 體驗; for a Remote magpie member, of the plan on the subscription card it is weighed by, `provider.RemoteSeat`, which has no `Account` here: #6708, `TestRemoteMagpieFreePlanSpentFirst`). It orders three tiers: the free ones with quota left, by `routes.Expires` (the earliest of a window's renewal and a credit's `RunsOut`, `Lapse` included) truncated to the hour, a stable tie in listed order and an unknown expiry after every known one; then the paid ones as `Quota first` orders them among themselves; then the used up and resting, by when they come back. A paid account takes a request only when no free one has quota left, and failover walks the same tiers. The trace's rows carry `free` and `expires` for the Routing page's story ("its free quota is lost soonest, in 1d 2h"). It is a group's only: `provider.normalize` keeps it off a provider, and `magpie provider set … routing=expiring` is refused like `cheap`. Nothing changes for a group not routed `expiring`. `TestGroupSpendsFreeQuotaSoonestToExpireFirst` (gateway), `TestFreeExpiringSpendsSoonestFreeFirst` (routes) and routing-free-expiring.test.cjs hold it. A plugin whose usage doesn't say when free credits lapse (Trae, Qoder's add-on pools) is ordered after the ones that do. A group routed `fit` (`provider.SmallFirst`, `routes.SmallFirst`; yg6888 on X, Cursor's Composer at 200K and Grok 4.7 at 256K never answering in a Quota first group of 1M models) goes by each member's context window: its strategy sets `ByWindow`, so `weighRouted` fills `Seat.Window` from `windowIn` (the provider's own `Contexts`, else the catalog's, read once per weighing), and `routes.SmallFirst` takes Quota first's order and sorts it stably into three bands: a seat of a provider set to be used first, then the rest with room, then the all but used up (`seatTier` 2); within a band the smaller known window first and an unknown one after every known one, a tie in Quota first's order. It never picks one too small: `roomy` has already left out every member whose window the request is estimated past (and keeps it as the last resort as for any routing), so the first left is the smallest that holds the request. The trace's rows carry `context` for the Routing page's story ("its 200K context window is the smallest that holds this request"). A group's only: `provider.normalize` drops it from a provider, whose keys serve one window, and the CLI refuses it there. Nothing changes for a group not routed `fit`; `TestSmallContextFirstGroupKeepsTheBigOneForLongRequests` (gateway), `TestSmallFirstOrdersByWindow` (routes) and routing-small-first.test.cjs hold it. 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/`, 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 (Quota first'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`). `weight` on a provider spreads its keys by each key's `Weight` and a subscription's accounts by each account's (`AccountWeights`, rubbzha on X): `keyWeight` gives a seat its `Weight`, 1 when none is set, and `routes.Weighted` takes them by smooth weighted round robin, a resting one leaving the round and a kept conversation staying as Stays says (`TestWeightedKeys`, `TestAccountWeightSharesRequests`). 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`). `drain` (dzxx0496 on Discord: free accounts one after another, the first not taking the requests back once it renews) stays on one seat per pool (`routes.Drain`, which remembers the seat's `Key` per pool) until it is used up — a known window at 100% (`provider.SpentShareOf`, as In order) or resting out of quota or credit (`routes.Seat.Spent`, filled by `spentRest` from `restingOf`'s `failQuota`/`failCredit`) — then goes on to the next not used up in listed order and stays there, wrapping round; the others follow it in listed order for failover. A rate limit or a failure only rests the seat, tried last meanwhile, and the pool comes back to it; with every seat used up it stays put, and a seat that leaves the pool leaves it on the first not used up. A group routed `drain` pools its members' accounts and keys under `group/`, as Quota first does. A restart forgets where each pool was, and it starts again at the first not used up (`TestDrainKeepsTheOneThatTookOver`). 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`) that isn't resting: its lane is free only because nothing is sent there. A request already waiting in a lane doesn't stay bound to it: whenever a slot is given back in any lane or a rest is lifted (`lanes.freed`, signalled by the releaser, `Unrest` and `UnrestAll`), and when the soonest rest among the others runs out (at most every `laneRecheck`), it goes to the first key or account after it in the planned order that has a free slot with no queue, minute room, isn't resting and isn't a reserve now (`waitMate`, `keepAtOnce` re-derived over the provider's candidates, `errMoved`). So one that took a seat while those before it rested, then became a reserve once they were back, doesn't keep requests waiting behind its own long turns (01huadalang on Discord: three ZCode accounts at three at once, the first two back from a 405 while the waiting ones stayed on the third until its requests were cut by hand; `TestWaitingRequestGoesToAccountBackFromRest` under Quota first and In turn, with Stays on and off, `TestWaitingRequestTakesSlotGivenBackElsewhere` under every routing). Strict stays leaves no other candidate, so the request waits for its own. A fallback is never asked for want of a slot or a minute (`TestFullMemberGivesWay`). 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) | | Accounts at once | A provider's `MaxAccounts` (01huadalang on Discord: three ZCode accounts used at once got the exit address refused with a 405, two didn't; the ZCode plugin declared two from 0.1.40 to 0.1.67, and since 0.1.68 declares none and holds its Start Plan to six requests in flight from the address itself, since a user's other accounts sat unused, mathfournity on X) is how many of its keys or accounts take requests at the same time: `provider.AtOnce()` is the user's own value, else what its plugin declares (`maxAccounts` on the auth hook or in package.json's `magpie`, read by host.js `atOnceOf`; zcode says 2), else no limit; the user's 0 is no limit over the plugin's. `perKeyBarred` keeps the first N in the user's own order (`rank`, so a dragged list counts), preferring ones not resting, and hands the rest to `keepAtOnce`'s reserves: they go after everything else as asides with `candidate.reserve` set (`Weighed.Reserve`), so whatever the routing mode, a reserve is asked only once the kept ones failed or rest, and a kept one that rests gives its seat to the first reserve on the next request. Three guards keep a reserve from being reached for anything else: `laneMate` never spills a full lane onto one, a full queue (`laneErr`) drops the provider's reserves before passing on (`dropReserves`), so the request is turned away with the 429 instead, and session affinity keeps no conversation on a reserve once the kept ones can take it (`affine`'s "reserve"; Strict still holds). Leak known: a failure that rests nobody (a 5xx on one try) still passes that one request to the reserve, as it does to any next candidate. Set in the provider editor's Advanced (Accounts at once, beside Concurrency) or with `magpie provider at-once`; Routing's row says "in reserve · {n} at once" (`TestAtOnceKeepsFirstInUserOrder`, `TestAtOnceFullLaneWaitsForTheKept`, `TestAtOnceReserveTakesOverAndGivesBack`, `provider-at-once.test.cjs`). | [`fallback.go`](../../internal/gateway/fallback.go), [`concurrency.go`](../../internal/gateway/concurrency.go), [`internal/provider/concurrency.go`](../../internal/provider/concurrency.go) | | Sink | With `Sink` on, a key or account that answers 429 while it still has quota goes to the back, behind every one not rate limited since. Held in memory until restart, or until its rest is lifted by hand (Try now, `Unrest` calls `unsink`, `UnrestAll` `unsinkAll` for the key and each of its models), which puts it back in its place (`TestTryNowPutsASunkAccountBack`, `TestUnrestAllUnsinksTheModels`). Another magpie's model rate limited there, whose rest is the model's alone (`remoteModelRest`), sinks alone too (`restID`), and `sunkAt` reads a candidate's model before its key, so the remote's other models keep their place (#2167, ggbdpq; `TestRemoteMagpieRateLimitSinksTheModel`, `TestMagpieAddedByHandRateLimitSinksTheModel`). A group in a group sinks by its own Sink, within its own order (`sinkOwn`, #2255), and the group asked for then sinks the whole by its own; `TestNestedGroupSinksItsOwnOrder`. | [`sink.go`](../../internal/gateway/sink.go) | | Group defaults | What a group does when a member is rate limited (Sink), slow to start (FirstToken) or every member is busy (Patience) is set once for every group in settings (`groupSink`, `groupFirstToken`, `groupPatience`; `settings.SetGroupDefaults`, POST `/api/groups/defaults`, the Routing groups page's Settings card; jiezhengj on Discord). A group follows the default for each it leaves unset, and its own value wins: `Sinks()` is `Sink`, or the default unless `NoSink` (Keeps its place); `FirstTokenOr()` is its own `FirstToken` (`FirstTokenWait`, -1, is its own Wait), else the default; `Waits()` reads the default when `Patience` is 0 (60 is its own 1 min). The group editor's rows open on Default for a group that sets none, the hint naming the value it follows. Groups saved before kept 0 and no `NoSink`, so they follow the default, which starts at magpie's own (keep its place, wait, 60s). `TestGroupDefaultsUnlessItsOwn`, `TestGroupFirstTokenFollowsTheDefault`, `TestGroupSinkFollowsTheDefault`, `TestGroupDefaultsSaved`, `group-defaults.test.cjs`. | [`group.go`](../../internal/provider/group.go), [`groups.go`](../../internal/gui/groups.go) | @@ -275,7 +275,7 @@ the key's leaves the call as asked, with a log line (`compactRefused`). - A classifier that can't say which kind a turn is (an error, no answer within `classifyTimeout()`, an answer that isn't a number, or resting `classifyRest` after a failure) leaves a turn whose conversation had an intent, still one of this turn's, with that intent (`Classified.Fallback` is `previous`, its `Error` kept), so the turn goes where the turn before went rather than to the group's first member; with no intent before, no rule with an intent matches, as before. The Routing page says the turn kept it (`classWhy`). The turn's decision itself (`turnRules`) is kept in memory only: after a restart a turn under way waits for the next one and the stick holds it meanwhile. `TestIntentClassifierFailsKeepsThePreviousIntent`, `routing-intent-fallback.test.cjs`. - A group's classifier is asked only for that group's own turns: a request whose model is the group (`group/`, its bare name, or a stand-in an agent's config names it by: Claude Code's tiers, Codex's bare name), or a group in it that its rules or order put first (`nestedRules`). A request for another model or group asks it nothing. The Routing groups page's card says why the classifier couldn't say the last time *that group* asked it (`GroupClassifierFailure`, kept by `classifiedFor` in `ruleFor`): the classifier's own words and time, resting or not, until it answers that group, and nothing once the group's classifier changed. Keyed by the classifier model alone, a group nothing reached showed another group's failure on a classifier they share (jjt on Discord). A classifier on a subscription out of its quota is not asked of the vendor again until the reset: out of quota, its account rests until the quota comes back (`restAfter`: the time the refusal names, else when the account's window renews), and the classifier's call meanwhile gets that refusal back from magpie, at most once each `classifyRest`. `TestClassifierFailureIsTheGroupsOwn`. - The classifier's requests are magpie's own (#1839). Asked in words, they go out with `RouterAgent`'s User-Agent (`magpie-router/1`), so their records' agent is magpie and `callKind` marks them `routing`; a decision model's (Jev, System One) record is written with `Kind: "routing"` too. They go to the same key or account as any other request and count in its totals, while `usage.Group.Own` (`Record.ByMagpie`: agent `magpie` or one of its `magpie-` User-Agents, with search's and image description's) says how many of an account's, key's or model's calls, tokens and cost were magpie's own. A classifier set to a subscription's model (`modelRef.Sub`, or a group whose first member is one) asks that subscription as every turn begins, twice when it picks both intent and effort in words; the Routing page says so beside it (`classifierSub` in `plugins/routing/client.js`). Its questions are the group's spend, so they are held to the accounts the turn is (`classifierHeld` in [`rules.go`](../../internal/gateway/rules.go), carried by `askWaited` to `askChat`, `askDecider` and `askDecisionGroup`; AWilsonPeng on X: a group held to one of two ChatGPT accounts whose classifier was its own member asked on both): the group's `Accounts`, the account its member names when the classifier is that member (each one's, for a model in it once per account), and the caller's (a gateway key's, a group above), never a key's models. A failure rests the classifier for those accounts alone (`classify`'s `rest`). `TestClassifierModelHeldToItsGroupsAccount`, `TestClassifierModelHeldToTheKeysAccount`, `TestIntentRoutesATurn`, `TestJevPicksTheIntent`, `TestSummaryCountsMagpiesOwnCallsApart`, `TestByMagpie`, `TestServedRefSaysASubscription`, `own-requests.test.cjs`. - - A group with no rules routes by its Routing (Smart unless set otherwise: the member whose allowance renews soonest first, ties in the listed order, the next taking over on a failure), and the editor says so in a line under Rules (`rHint2` in [`plugins/routing/client.js`](../../internal/gui/assets/plugins/routing/client.js), @canlee886 on X: it said nothing of it); with one model or routed Manual it says what holds the rules back instead. `routing-rule-example.test.cjs`. + - A group with no rules routes by its Routing (Quota first unless set otherwise, and it does not judge how hard a task is: the member whose allowance renews soonest first, ties in the listed order, the next taking over on a failure), and the editor says so in a line under Rules (`rHint2` in [`plugins/routing/client.js`](../../internal/gui/assets/plugins/routing/client.js), @canlee886 on X: it said nothing of it); with one model or routed Manual it says what holds the rules back instead. `routing-rule-example.test.cjs`. - A rule may name several members (`Rule.More` after `Rule.Use`, `more` in the group's JSON, `use=a,b` typed; monkeyin_92 on X: one rule, several models, not a rule each). They go first in that order, ahead of the later matching rules' members (`ThenUses` leaves out every one the rule names) and the group's others: when the first fails or rests the rule's next takes the request, and the hit says so (`RuleHit.More`; `Instead` is that next one with `Unready` false, where an `Instead` from a later rule comes with `Unready` true). `Uses`, `SetUses`, `MapUses`, `Without` and `Names` in [`grouprule.go`](../../internal/provider/grouprule.go) are how every reader goes through them: `cleanRules` (each must be the group's, each named once, a pause names one), the turn's hold, the tool rounds and compaction (`ruleFor`, the rule's first that takes the summary), `nestedRules` and `ruleLed` (the one of them a nested group's turn stays on), `ruleEffort` (the rule's `useEffort` asked of each), `ruledEntry` (what a group takes is what every one of them takes), a model's rename and removal (a rule goes with its last), `ShareGroup` and its import (one this magpie hasn't is left out of the rule), the CLI's `groups rules` and the TUI. The editor draws a chip per member with a + for the next and an × on each while there is more than one (`rUses`/`setUses` in [`plugins/routing/client.js`](../../internal/gui/assets/plugins/routing/client.js)). A rule of one member writes no `more`, so a group saved before it reads and saves as it was. A magpie from before it reads `use` alone: its requests go to the first, and the others are plain members in the group's order; if it saves the group, `more` is dropped. `TestRuleSeveralModelsInOrder`, `TestCleanRulesSeveralModels`, `routing-rule-models.test.cjs`. - The editor's rules are checked top first, so their order is theirs to set: a rule's number is its handle (`ruleHandle`, `.rt-rhandle`), dragged (`dragRows`, as the members are) or moved a place with Alt+↑/↓, the rules renumbered at once; the grip beside it shows on hover only, and Move up and down stay under its ⋯ (`moveRule`). Saved as the group's `rules` in their new order. `routing-rule-drag.test.cjs`. - A rule can set the reasoning its member is asked for (`Rule.UseEffort`, `useEffort` in the group's JSON, `use-effort=low` typed; #2633, dengtongcai: an intent picks the model and the effort as a pair). It is an output like `Use`, not a condition like `Effort`. `ruleFor` copies it onto the hit (`RuleHit.UseEffort`) from the rule that put a member first, outer or nested; `ruleOver` keeps that rule's members, and `ruleEffort` gives each candidate of them the level fitted to its model's own (`fitLevel`), which `withFixedEffort` writes into the request's field for its protocol (Chat's `reasoning_effort`, Responses' `reasoning.effort`, Anthropic's thinking budget or `output_config.effort`) even when the agent asked none. A member fixed at an effort keeps its own; otherwise the rule's beats the model's suffix, the turn's pick and the agent's pick, and isn't bounded by the group's levels. A model whose levels aren't known (`Efforts` empty) is asked as the agent asked, as with the auto verdict. The members the group fails over to are asked it too (#3664): the effort is the turn's decision, so when the rule's own member is turned away the member that takes the request over is asked the same level, fitted to its model, rather than the agent's. A rule that names the candidate goes before one it only fails over from, and a nested group's rule decides for that group's members only: when the whole nested group fails, the outer group's member outside it is asked as the agent asked, or by the outer group's rule (`TestIntentEffortSurvivesTheGroupsFailover`, `TestNestedRuleEffortStaysInItsGroup`). A Gemini-protocol client's request is left as it came, as for every effort magpie sets. `cleanRules` refuses a value outside `provider.Efforts` and a pause with one. The try records it (`Try.RuleEffort`), and the Routing page says the rule set it. `rule_effort_test.go`, `grouprule_useeffort_test.go`, `routing-rule-effort.test.cjs`. @@ -324,7 +324,7 @@ the key's leaves the call as asked, with a log line (`compactRefused`). - A streamed reply stuck in a loop is ended, not let run to its output limit (#1359, Moody-Sin: WorkBuddy's DeepSeek v4.1 flash reasoned round "Now." "Writing." "Go." "Let me write." "OK." until max tokens while dsh and Pi waited). `holdWriter.Write` feeds every streamed try, passed through or translated, a key's, a built-in subscription's or a plugin's (a moved WorkBuddy's fetch in the plugin host, `TestLoopEndsWorkBuddysReply`), in each of the agent's protocols, to a `loopGuard` ([`loop_guard.go`](../../internal/gateway/loop_guard.go)). It cuts the reasoning and the text, each apart, into units, its lines and sentences (a list's `1.` or a decimal is no sentence's end), compared without case or a closing stop. A unit with no word in it (a letter run with no digit: not a brace, a rule, `0x00`, a hash or a row of numbers) isn't counted. When the last `loopWindow` (256) counted units of either are among no more than `loopDistinct` (24) different ones, the try is cut (`cutLoop`): what came with that write goes out, then, after a blank line (two newlines when that write stopped inside a line, `holdWriter.atLine`, #2446), the protocol's stream error (`streamError`, 502) naming the loop and quoting its units, and the vendor's request is cancelled. It falls back to nobody and rests nobody (`failLoop`); its usage record's error type is `reply_loop` (`usage.LoopErrType`), and Usage counts them per model (`Totals.Loops`), as "{n} looped" beside the model's failures in the Overview's rows and the Requests ranking (#1858, `TestLoopsCountedPerModel`, `usage-loops.test.cjs`). A reply magpie translates into the agent's protocol (`streamTranslated`) whose *reasoning* loops before it has said a text or a call, and isn't a continuation, is asked again once in place instead (`loopReasks`, through `holdWriter.onLoop`; cdredfox on X, WorkBuddy AI's DeepSeek v4 flash): the agent keeps the reasoning it has, the next try's follows it in the same stream, as an empty reply's re-ask does (#667), and only a loop on that try ends the reply with the error (`TestReasoningLoopIsAskedAgain`). A reply passed through in the agent's own protocol is asked again once too, at the fallback loop (`holdWriter.mayReloop`, `letGoLoop`; #2436, lqisgod: pi's Chat stream to WorkBuddy was cut at once): when nothing of the try has reached the agent yet, in any protocol, its held bytes are dropped; when its reasoning is already passing, only a Chat stream goes on, written up to the end of the tripping event, with the next try's chunks after it. An Anthropic or Responses stream already passing still ends with the error, since a second `message_start` or `response.created` can't follow. Each re-ask, in place or at the fallback loop, counts in the usage record's tries. A loop in the text, or after a text or call, is ended at once (`TestLoopAfterTextIsNotAskedAgain`). A cycle need not be exact. Code, tables, lists, logs, CSV and base64 differ line to line or have no words, and don't trip it (`TestLoopGuardLeavesOrdinaryRepliesAlone` feeds magpie's own sources and docs through it). A reply sent whole (no stream, or Gemini without `alt=sse`) isn't read. Settings › Models › Replies › *Stop looping replies* (`noLoopGuard`) turns it off. - A conversation going round one tool call is answered by magpie and sent nowhere (audie on Discord: Codex Desktop on WorkBuddy's deepseek-v4-pro read the same file 308 times in half an hour, and 340 times that evening, 537 credits). `stoppedToolLoop` ([`tool_loop.go`](../../internal/gateway/tool_loop.go)) runs in `serveAgent` before hooks, middleware and routing, and in the Codex backend's passthrough on Codex's own sign-in. It reads the request's own history, so it is per conversation and keeps no state: when the last `toolLoopRepeats` (8) turns are each the same calls (name and arguments, keys in any order, call ids ignored) answered with the same results (with Codex's `Wall time`, `Chunk ID` and `duration_seconds` taken out, `runNoise`) and nothing else from the user, the turn is answered in the agent's own protocol, streamed or whole (`writeLocalText` through `relayStatus`), with a notice naming the call, in the conversation's own language: `conversationLang` ([`reply_lang.go`](../../internal/gateway/reply_lang.go); tenacious_eagle_96548 on Discord, a Chinese conversation told in English) reads the user's own words, newest first, from the whole body (the ask can be past `tailOf`), not the agent's prompt, a tool's output or a tag block the agent adds (``), and tells the language by script: kana Japanese, Hangul Korean, Han Chinese (Traditional when its common characters outnumber the Simplified ones), German by its common words, else English (`toolLoopNotices`; Korean names the settings path in English, as the GUI has no Korean). The notice goes upstream with the next turn, so no language's names magpie or a quota (`TestToolLoopNoticeInTheConversationsLanguage`). Any different result, or a word of the user's, starts the count again; the notice is a turn without calls, so the user's next word goes on. A body with fewer than 8 tool results isn't parsed (`mayLoop`), and only the newest 64 items of a long one are (`tailOf`, gjson), ~1ms for a 1.5MB turn (`BenchmarkToolLoopCheck`). The turn is recorded as Codex's title turns are (`answeredHere`): the Routing trace as "Tool loop stopped", and a usage row with provider `magpie`, rejected, its session and an error starting `tool loop:`. A poll that gets the same answer 8 times in a row is stopped too. Settings › Models › Replies › *Stop looping replies* (`noLoopGuard`) turns it off with the reply guard. Verification: `go test -tags nogui ./internal/gateway -run 'TestToolLoop'`. - A Chat request's earlier turns carry the assistant's thinking back in the spelling its own client used: `reasoning_content` (DeepSeek's, which OpenCode and most clients send), `reasoning` (OpenRouter's) or `reasoning_details` (OpenRouter's structured one). A request translated to a non-Chat upstream reads whichever of the three the turn has, in that order, as the turn's thinking (`messageReasoning`, `reasoningText`, read by `parseChat` in [chat.go](../../internal/gateway/chat.go)); the passthrough has read all three since `mistralThinking` (#494), which was the one place that did. The same conversion covers a request translated to Mistral's Chat API (`forwardTranslated`): the build replays a turn's thinking in `reasoning_content` for a model whose name says DeepSeek wherever it is served (`chatReplaysReasoning`), which Mistral refuses — 422 `extra_forbidden` on `messages[].reasoning_content`, every follow-up of a Codex tool loop after its first call (#4906) — so the built body goes through `mistralThinking` too, and its thinking parts reach Mistral as its own replies carry them; a whitespace-only thinking (the `" "` a tool turn with no reasoning item is given) is dropped, not sent as a blank part. `TestTranslatedReasoningAsThinkingForMistral`, `TestTranslatedToolTurnWithoutReasoningForMistral`. Before that the parse layer read `reasoning_content` alone, so a tool-calling session whose client spelled it another way went on from its second turn without the model's own reasoning. -- The order of the steps a request's accounts go through, how much the accounts' own order (*Make first*) counts under each routing, and how often an allowance is read are described for users in [How magpie picks an account](../reference.md#how-magpie-picks-an-account). Smart compares renewals window by window, biggest first, each truncated to the hour (`weighRouted`), so the order decides only when every window falls in the same hour. A biggest window its next one can't use up before it renews is passed over (`Allowance.Unreached`, `Seat.Unreached`, the trace's `unreached`): when what it has left is more than the next window, a day or longer and counted in the same unit, lets through between its own reset and the biggest one's (`Of` × the time between ÷ `Span`), what the next leaves at its reset is lost, so it ranks the account. A month holding less than its weeks add up to still ranks it while they can carry it (#1778); a Volcengine Agent Plan, 20,000 a month and 7,000 a week, goes by its week from about two weeks before its month renews (#5639, louisgreen0726; `TestMonthOutOfReachRanksByWeek`, `TestSmartSpendsAWeekTheMonthCantWait`, `TestSmartPassesAnUnreachedWindow`). Windows that tell only a share, and Ark replies with `Percent` alone, are never compared. A window's renewal is its reset, or, when what it has left runs out sooner or it has no reset, that moment (`Limit.RunsOut`, from `QuotaWindow.RunsOutAt`; `Allowance.Renewal`): the WorkBuddy plugin (0.1.14) sends it on its Credits window as the soonest end of a package with credits left (cdredfox on X). When the renewals tie to the hour, Smart goes by that moment once more (`Allowance.Lapse`, `Seat.Lapse`), so of accounts renewing together (WorkBuddy's free accounts all reset at the month's end, plugin 0.1.35) the one whose credits left lapse first, after that end, goes first, and one telling none goes after (zhaocai_83020 on Discord). The trace carries both keys as Smart sorted by them, `soon` (`Allowance.Renewal`) and `lapse` (`Allowance.Lapse`) beside each window's own `renews` (`Weighed.Soon`, `Weighed.Lapse`), and the Routing page's story and rows compare those (`renewsBy`, `cmpRenews`, `firstWhy`, `behindWhy`): a credit pack ending before the month another account renews with is told as its credits expiring first, a tie broken by the lapse as that, and the order given only where every key ties (#5646, louisgreen0726; `TestTraceCarriesSmartSortKeys`, `routing-story-credits-expire.test.cjs`). A route from before `soon` is read from `renews` and `restarts`. Only Smart reads the lapse; Use before expiry, the 90%/98% tiers and rests go by the window's share and reset as before. A row on the Routing page says the share used (the fullest window's, `Allowance.For`) with when that same window renews (`Allowance.Fullest`, the trace's `usedRenews`), not the biggest window's: a Factory account 32% into its week and 16% into its month reads "32% used · renews in 3 days" while Smart still ranks it by its month (#1778). A route from before `usedRenews` says when only for an account of one window. Affinity keeps a conversation on an account at 90–97%: only `SpentShareOf` (98%, 100% In order) stops it (`affine`), while the 90% tier (`lowShare`) orders only conversations nobody has answered. +- The order of the steps a request's accounts go through, how much the accounts' own order (*Make first*) counts under each routing, and how often an allowance is read are described for users in [How magpie picks an account](../reference.md#how-magpie-picks-an-account). Quota first compares renewals window by window, biggest first, each truncated to the hour (`weighRouted`), so the order decides only when every window falls in the same hour. A biggest window its next one can't use up before it renews is passed over (`Allowance.Unreached`, `Seat.Unreached`, the trace's `unreached`): when what it has left is more than the next window, a day or longer and counted in the same unit, lets through between its own reset and the biggest one's (`Of` × the time between ÷ `Span`), what the next leaves at its reset is lost, so it ranks the account. A month holding less than its weeks add up to still ranks it while they can carry it (#1778); a Volcengine Agent Plan, 20,000 a month and 7,000 a week, goes by its week from about two weeks before its month renews (#5639, louisgreen0726; `TestMonthOutOfReachRanksByWeek`, `TestSmartSpendsAWeekTheMonthCantWait`, `TestSmartPassesAnUnreachedWindow`). Windows that tell only a share, and Ark replies with `Percent` alone, are never compared. A window's renewal is its reset, or, when what it has left runs out sooner or it has no reset, that moment (`Limit.RunsOut`, from `QuotaWindow.RunsOutAt`; `Allowance.Renewal`): the WorkBuddy plugin (0.1.14) sends it on its Credits window as the soonest end of a package with credits left (cdredfox on X). When the renewals tie to the hour, Quota first goes by that moment once more (`Allowance.Lapse`, `Seat.Lapse`), so of accounts renewing together (WorkBuddy's free accounts all reset at the month's end, plugin 0.1.35) the one whose credits left lapse first, after that end, goes first, and one telling none goes after (zhaocai_83020 on Discord). The trace carries both keys as Quota first sorted by them, `soon` (`Allowance.Renewal`) and `lapse` (`Allowance.Lapse`) beside each window's own `renews` (`Weighed.Soon`, `Weighed.Lapse`), and the Routing page's story and rows compare those (`renewsBy`, `cmpRenews`, `firstWhy`, `behindWhy`): a credit pack ending before the month another account renews with is told as its credits expiring first, a tie broken by the lapse as that, and the order given only where every key ties (#5646, louisgreen0726; `TestTraceCarriesSmartSortKeys`, `routing-story-credits-expire.test.cjs`). A route from before `soon` is read from `renews` and `restarts`. Only Quota first reads the lapse; Use before expiry, the 90%/98% tiers and rests go by the window's share and reset as before. A row on the Routing page says the share used (the fullest window's, `Allowance.For`) with when that same window renews (`Allowance.Fullest`, the trace's `usedRenews`), not the biggest window's: a Factory account 32% into its week and 16% into its month reads "32% used · renews in 3 days" while Quota first still ranks it by its month (#1778). A route from before `usedRenews` says when only for an account of one window. Affinity keeps a conversation on an account at 90–97%: only `SpentShareOf` (98%, 100% In order) stops it (`affine`), while the 90% tier (`lowShare`) orders only conversations nobody has answered. - A turn's end is told to the app for the "Task done alert" notification (itieniu on X, `turndone.go`). The trace follows each agent session's turn (`turns`, keyed by agent and session): a request is of the turn unless it has a `Kind` or is a Claude Code subagent's (`agentTurnOf`), and its reply is scanned on the way to the agent for a tool call in any wire format (`toolScan`, a JSON value such as `"type":"tool_use"` or `"finish_reason":"tool_calls"`, never a key or text). The turn is done when no request of it is going, the last reply was whole, under 400 and called no tool, and nothing more came for `turnQuiet` (4s); a session idle past `turnStale` (30m) starts over. Only a turn that ran at least `settings.TurnDoneAlert` seconds is told (`TurnDone`, set by the GUI; nil under `magpie serve`, so nothing is followed). The ChatGPT backend path (`codexBackend`) is followed the same way. `TestTurnDoneSaidAtTheTurnsEnd`, `TestTurnDoneCodexBackend`, `TestToolScan`, `turn-done.test.cjs`. - A request's masking record is told to the app for the "Masking alert" notification (Must2333 on X, `OnMasked` in [`masked.go`](../../internal/gateway/masked.go), set by the GUI; nil under `magpie serve`), after `maskrec.Hold` and with its text around placeholders (`Snips`, `Back`) taken out. [`mask_alert.go`](../../internal/gui/mask_alert.go) keeps the records while `settings.MaskAlert` is on (off until turned on, in Settings → Usage, hidden with masking) and says only the values a record masked for the first time (`maskrec.Fresh`, [`first.go`](../../internal/maskrec/first.go): each placeholder by the key of the first record that had it, read from memory and the days kept, so a conversation's history sent again each turn, or after a restart, is not news; a value sent as written is not one masked). A burst is gathered for `maskGather` (3s) and said as one, and one is said at most every `maskGap` (1 minute), what came in between said after it. It says each kind with its count and up to two agents, never a value nor its hint; a click opens the Masking page on the latest record (`clickView`, `masking&key=`). A held-back request (`noteBlocked`) is not said; a value whose records have all aged out (30 days) is new again. `TestFreshOnlyTheFirstTime`, `TestMaskAlertFirstTimeOnly`, `TestMaskAlertNeverSaysTheValue`, `TestMaskAlertCoalesces`, `mask-alert.test.cjs`. - A resting candidate is tried last (`restLast`). Of the resting candidates, a request asks only the one whose rest ends soonest, the first in order on a tie (`probeOne`, #1799). The others aren't asked by that request, so a member that is down isn't asked by every request its rest was meant to spare it from, and a group that is down whole takes one upstream request per request, not one per member. Every ready candidate is still asked in its order. A lone candidate is tried even while it rests, because there is no other. The trace still lists every member, the resting ones with their rest. Only rests are read, and a failure about the request's content or its model rests no member (a model refusal rests only `restID`), so neither leaves a member out. The same applies in `count_tokens`, embeddings and rerank, image accounts and a group's System One decision models. A Codex reset (`autoReset`) still looks over every candidate. This is like AxonHub's error-aware load balancing: the rest and its backoff are the penalty that decays, and the member back soonest is the one asked to show it is back. Keys out of their allowance aren't asked even so, not even the one back soonest or a lone one (#1772: four Ollama Cloud keys out for the week, each asked again and refused on every request). The refusal given again says when they are asked again on this magpie's clock with its offset (`heldClock`: "20:12 UTC+8", "Oct 16 09:00 UTC+8"), as do the gateway's other held errors (a capped window, a spent searcher or describer): its reader may be a Remote magpie's user on another clock. When every candidate left is a key (not a subscription account, whose resets `autoReset` may spend) resting out of quota or credit after a 429 or 402, none is asked. The first one's refusal is given again (`quotaHeld`, its words kept in the rest's `said`), saying when it is asked again. A key whose rest magpie guessed the length of, the vendor and the user naming no time (`creditRest`, or `quotaRest` with no `Provider.OwnQuotaRest`), is held so only once it was refused so twice in a row (`Rest.first`): a single refusal may be a moment's, and the next request, the agent's retry first, asks it again (zoecats on Discord: a local aggregator said 429 `insufficient_quota` "quota exhausted" for the moment it switched upstreams, and every request was answered from its rest of 15 or 30 minutes, which only the provider's "Rests" switch, `LimitRestOff`, let through before). Held, it is asked again a minute on (`Rest.askAt`, `fallbackCooldown`), once, and held again if refused (`Rest.asksAt`); a time the vendor named, or the user set, holds it from the first refusal to then. The rest itself stays as long as before, so the order still passes it over for a candidate that is ready. The last key left rests too when it is refused so, as the keys before it do, and so does the last account left (a Codex or other subscription account; `quotaHeld` still holds keys alone, and `autoReset` lifts the rest of an account it spends a reset of): before, an account last in an in-order group, out of its quota, was never rested, so every request a relay ahead of it failed for a moment went on to it and ended on its 429 (dbydd on Discord; `TestGroupSpentLastAccountRests`). Any 429 that reaches the agent without a vendor `Retry-After`, while every candidate tried is resting, carries one: the seconds until the first of them is asked again (`soonestBack`, by `asksAt`), none after a key's first refusal. `TestRetryAfterALimitIsAsked`, `TestHeldLimitAskedAgainInAMinute`. A quota refusal with no word of when it is back rests `quotaRest` (15 minutes), or the provider's own `quotaRest` in minutes (`Provider.QuotaRestFor`, at most `MaxQuotaRest`, 8 days; `magpie provider quota-rest 7d`), or until the time of day the user said its allowance comes back (`QuotaResetAt`, `Provider.OwnQuotaRest`; `magpie provider quota-rest until 08:00`, or `until 00:00+08:00` on the vendor's clock; #2008, a free tier's "today's free-model token quota"). Whichever of the two was set last counts. A time the vendor names stands over it, and so does its `Retry-After`, unless that was more than `longestWait` (an hour) and so cut to it while the user's own rest is longer: then the user's stands (`TestQuotaRestsUntilTheTimeOfDaySet`). A key or an account resting on a 429 for the time its vendor named (`Rest.By` "retry-after" or "resets": a `Retry-After`, an `anthropic-ratelimit-*-reset` or `x-ratelimit-reset-*` header, or a refusal's `resets_in_seconds` / `resets_at`), rate limited or out of its allowance, is held the same way when every candidate left rests so (`timedHeld`, `vendorTimed`): none is asked, not even the soonest back or a lone one, and the agent is answered with the first one's error and a `Retry-After` until the first of them is back, set on the held answer too, so neither the same-one retry (`passing`) nor the patience's rounds take it for a moment's limit. Not a Codex account that spends its resets by itself (`autoReset`), nor another computer's model (`Rest.there`), nor a provider with `LimitRestOff`, which never rests for a limit. The last one left rests on such a 429 too (`vendorSaidWhen`); one naming no time rests nobody, as before. Before, a key or account limited for 300 seconds was asked again every time the agent retried, about every half a second, until the vendor flagged the accounts (hsjzg58958 on X). Codex's own sign-in, and the account a compaction goes to, are relayed outside the candidate loop (`codexUpstreamOn`): a 429 there that names its time holds that account in `codexHolds` (`noteCodexHold`), and Codex's retries are answered with ChatGPT's own refusal and a `Retry-After` till then (`writeCodexHeld`), unless the turn has fallbacks or groups to go on to (`codexFallsBack`), which take it as they took the turn that held the account (`TestCodexHeldTurnFollowsTheGroup`); a reset spent or a window started again lifts a hold out of allowance (`restarted`). Codex's API key isn't held: OpenAI's platform answers it. `TestRateLimitedKeysHeldUntilTheirReset`, `TestRateLimitedCodexAccountsHeldUntilTheirReset`. A key listed in `keys` as well as in `key` is one candidate (`KeysOn`), not asked twice. `TestAllRestingAnswersFromRest`, `TestOwnQuotaRest`, `TestQuotaHeldOnlyForKeysOutOfAllowance`, `TestFirstKeyListedTwiceAskedOnce`. @@ -339,19 +339,19 @@ the key's leaves the call as asked, with a log line (`compactRefused`). - Strict (`strict`, #1797, miniers) never moves a conversation to another key or account (`who`). Its stick is kept as session's is, and while it is fresh `affine` keeps only the candidates of that `who` (`strictOnly`): its other models stay, so a group's rules still pick among them, but no other account, key or provider is asked, and a resting or spent one is asked anyway. A failure there reaches the agent and rests the account as a non-lone candidate's would (`strictAlone`), so new conversations go elsewhere. A reply that breaks off after its 200 (#733) forgets the stick under every other mode; under strict it doesn't, so the agent's retry goes back to the same account, member or key, failing there while it fails and going on there once it answers (imwhatiam123 on Discord: a group of Qoder CN and WorkBuddy AI moved a session to WorkBuddy AI, the retry routed as a new conversation; `TestStrictGroupKeepsItsMemberPastABrokenReply`). Before planning, `strictKeep` takes the stuck account back from what holds new conversations off it: a usage cap (`pl.capped`, `capHeldOnly`), so the conversation goes on past it. An account held for credits it may not spend is answered 429 naming the account and Strict, and nothing reaches the vendor, rather than moved. An account removed, switched off, barred, or not allowed for the calling key is gone, and the conversation moves as under session. The trace says `strict` even with one candidate. `strict_affinity_test.go`, `stays-strict.test.cjs`. - A provider's fallback is its emergency path, not a place a conversation stays (01huadalang on Discord). When the one that answered a conversation last is one of a provider's `Fallback` models (its trace row's `Fallback`) and the provider's own model stands first in the plan, ready, the next turn goes to the provider, whatever the fallback cached and in every mode but Strict (`backToMain` in `affine`, `Affinity.Why` `main`). "Ready" is what `restLast` says: the provider's rest over, which is when the rest `restAfter` set ends (a minute and backing off for a plain failure, the vendor's named reset or Retry-After for a quota or rate limit, `quotaRest` 15 minutes when nothing names a time), or earlier when its windows are read full no more (`renewed`) or a background probe finds it answering (`Rest.Probed`). While the provider rests, the fallback is ahead of it and keeps the conversation as any answerer does. Within a turn (the agent sending tool results back) the conversation stays on the fallback until the user speaks again: the turn's tool loop runs on reasoning the fallback sealed, which the provider can't read, and the provider is sent the whole prompt afresh at the next turn all the same. Strict is left as the user set it: it never moves a conversation, a fallback's included; the trace then names the provider's ready key or account (`Affinity.Main`) and the Routing page says the conversation stays on the fallback for Strict while new conversations go to the provider (`TestStrictKeepsTheFallbackAndSaysTheMainIsReady`, `routing-affinity-order.test.cjs`). A provider routed In turn goes round its own keys and accounts only: its next turn (`after`) and a new conversation (`leastHeld`) pass over a fallback while one of the provider's own leads (`standsIn`). Before, a fallback was one more seat in the round, so with one key every other turn went to the fallback, and a new conversation went to it as the one nobody was on, the provider ready (01huadalang again, 10-31; `TestRotatingProviderKeepsItsFallbackForEmergencies`, `TestFallbackGivesBackAcrossRoutings`). A routing group's members are never `Fallback`; a group gives a conversation back by its own rules (`order`, `back`, below), and a routing group named as a provider's fallback is a fallback here as a whole. Before this, Auto kept a conversation on the fallback by its cache for as long as each turn read it, and Session for the session. `TestFallbackGivesTheConversationBackOnceTheMainIsReady`. The Routing page says so ("{who}, a fallback, answered this conversation last, but the provider's own {first} is ready again…", `affWhy` in `plugins/routing/client.js`); before, `main` showed no reason at all. - A routing group set to In order is tried in the order the user put its members in, and a later member keeps a conversation only until a member ahead of it is ready again (yyhhyyyyyy on Discord: an API key first and a Claude subscription second for Opus, 8 of 10 Claude Code requests on the subscription). One failure of the first member (a 429, a 5xx, a rest) sent a conversation to the second, and Auto affinity's `cache` kept it there at every turn after, since each turn read what the last had written. Now, with Stays left on Auto, a new turn goes back to the first ready member when it is another member than the one that answered last (`backToFirst` in `affine`, `Affinity.Why` `order`; another key or account of the same member, or a group in the group, keeps its own affinity). A provider whose own keys or accounts are routed In order does the same among them (CryptoSarom on X: a conversation that went to the second account while the first was resting stayed there by its cache once the first was back): `affine` gets `inOrder` from the provider's routing when the request isn't to a group, and `backToFirst` then compares accounts (`candidate.who`) rather than members. `TestOrderedAccountsGiveTheConversationToTheFirst`. Within a turn it stays, on the reasoning the later member sealed, as with `main`. Stays: Session and Strict are the user's own and keep the conversation where it is. The Routing page says why it moved. `TestOrderedGroupGivesTheConversationBackToItsFirstMember`, `routing-affinity-order.test.cjs`. -- A group routed any other way (Smart, Least used first, By weight and the rest, In turn aside) gives back a conversation a later member took only as a stand-in (01huadalang on Discord, 11-01: Codex on two accounts first in a Smart group, a MiMo key second as the backup; after an outage of Codex's 5 hours, a session that had gone to MiMo stayed there by MiMo's cache once Codex was back, while new ones went to Codex). A member stood in when, as it answered, a member the group lists ahead of its own was resting (a 429, a 5xx: `restAfter` rests the one that failed before the try goes on) or known all but used up (`Used` at `SpentShareOf`): `standsInFor`, over the plan as it was for the request, by each candidate's `place` in the group's list (`placed` in `planGroup`; a group in the group is one member). The stick keeps it (`stick.stoodIn`, and `stoodIn` in `affinity.json`, absent from a file written before and read as no stand-in) while the same account and model answer on, so a stand-in that routing still puts first after the one ahead is back (Smart's low tier, a week at 92%) gives the conversation back once routing puts the one ahead first. At a new turn, with Stays on Auto, the conversation goes to the first ready member when that one is listed ahead of the stand-in's (`backFromStandIn`, `Affinity.Why` `back`); another key or account of the same member keeps it by its cache. A member routing put first while those ahead of it were ready and had room is no stand-in and keeps its cache as before, so peers of a Smart group don't trade conversations by renewal order. Within a turn it stays; Within a turn and Off route each new turn afresh anyway; Session and Strict keep it where it is; In turn's next turn goes round (`after`). Routing still decides who is first: Least used first and Smart put a key whose usage isn't told (counted unused) ahead of accounts at 90% or more of a window, so a conversation, and every new one, goes to such a backup while the subscription's accounts are that low (routing's own choice, not affinity's; In order keeps a backup last). `TestGroupBackupGivesTheConversationBack`, `TestGroupBackupStandingInWhileTheFirstIsBackAndBehind`, `TestGroupMemberPutFirstOnItsMeritsKeepsItsCache`, `TestGroupStandInStaysWithinATurn`, `TestGroupMemberGivesTheConversationBackOnceTheOneAheadIsBack`, `routing-affinity-order.test.cjs`. +- A group routed any other way (Quota first, Least used first, By weight and the rest, In turn aside) gives back a conversation a later member took only as a stand-in (01huadalang on Discord, 11-01: Codex on two accounts first in a Quota first group, a MiMo key second as the backup; after an outage of Codex's 5 hours, a session that had gone to MiMo stayed there by MiMo's cache once Codex was back, while new ones went to Codex). A member stood in when, as it answered, a member the group lists ahead of its own was resting (a 429, a 5xx: `restAfter` rests the one that failed before the try goes on) or known all but used up (`Used` at `SpentShareOf`): `standsInFor`, over the plan as it was for the request, by each candidate's `place` in the group's list (`placed` in `planGroup`; a group in the group is one member). The stick keeps it (`stick.stoodIn`, and `stoodIn` in `affinity.json`, absent from a file written before and read as no stand-in) while the same account and model answer on, so a stand-in that routing still puts first after the one ahead is back (Quota first's low tier, a week at 92%) gives the conversation back once routing puts the one ahead first. At a new turn, with Stays on Auto, the conversation goes to the first ready member when that one is listed ahead of the stand-in's (`backFromStandIn`, `Affinity.Why` `back`); another key or account of the same member keeps it by its cache. A member routing put first while those ahead of it were ready and had room is no stand-in and keeps its cache as before, so peers of a Quota first group don't trade conversations by renewal order. Within a turn it stays; Within a turn and Off route each new turn afresh anyway; Session and Strict keep it where it is; In turn's next turn goes round (`after`). Routing still decides who is first: Least used first and Quota first put a key whose usage isn't told (counted unused) ahead of accounts at 90% or more of a window, so a conversation, and every new one, goes to such a backup while the subscription's accounts are that low (routing's own choice, not affinity's; In order keeps a backup last). `TestGroupBackupGivesTheConversationBack`, `TestGroupBackupStandingInWhileTheFirstIsBackAndBehind`, `TestGroupMemberPutFirstOnItsMeritsKeepsItsCache`, `TestGroupStandInStaysWithinATurn`, `TestGroupMemberGivesTheConversationBackOnceTheOneAheadIsBack`, `routing-affinity-order.test.cjs`. - A conversation a rule's hours sent to a member goes where the group routes it once they are over (MinglunZhu on X: a cheaper provider at night, the usual one by day). At a new turn that no rule puts a member first in, `ruleFor` sets `RuleHit.Ended` when the last turn's rule had hours that no longer hold, and `affine` lets go of the conversation (`Affinity.Why` `hours`) instead of keeping it on the night's member by its cache; the tool rounds of a turn begun inside the hours stay where they are. Session and Strict affinity, and In turn, keep their own way. The trace says why (`affWhy` in [`plugins/routing/client.js`](../../internal/gui/assets/plugins/routing/client.js)). A time rule in a group inside the group doesn't give its conversation back this way yet. `TestRuleHoursOverGiveTheConversationBack`, `routing-time.test.cjs`. - In turn (`rotate`), a conversation nobody has answered yet goes to the key, account or model the fewest other conversations of the provider's model or the group answered in the last `heldFor` (30 minutes) are on (`leastHeld`, #946). Ties, resting ones, a provider's fallback while the provider's own leads (`standsIn`) and a group with a group in it keep routing's order. With session affinity, two sessions of one group so stay on different models. -- Requests that come together spread (`burstSpread` in [`burst.go`](../../internal/gateway/burst.go), #5242: Moody-Sin and Tericerice sent four at once to three Antigravity accounts, In turn and By pace, and every one went to one account). Routing weighs what each seat served (`Tokens`) and its allowance, which move only once a reply ends, and a lane counts a request only once its try begins, so requests planned at the same moment were all planned on the same figures; In turn's next turn (`after`) reads a stick that moves only on an answer too. Once the plan is made (after affinity, rules, pinning, `roomy`, `behindOverflow`), `burstSpread` puts first, of the candidates alike to the first, the one with the fewest requests in flight (`inFlight`, by `candidate.who`), ties keeping routing's order, and counts the request there in the same hold of the lock; the count is given back when `serve` ends. Alike (`burstAlike`): ready as the first is (not resting, aside, reserved, barred, held, capped, a fallback standing in, credits-last or busy behind), the same fallback, fit, protocol, URL and `Via`, the rule's member when a group's rule picked one; In turn any of the round; By pace a pace within a tenth (`paceAlike`, routes.Pace's band), the same `Learns`, both with room (`burstTier` 0) and no wallet told apart (`sameBalance`); Least used within a point used, the same tier and known-ness. In a group, a provider routed its own way (`ownRouting`) is alike only to its own provider's keys, by its routing, and a group in the group to nothing. Smart, In order, By weight and the others keep their order. Not moved, only counted: a conversation kept (`Affinity.Kept`), Strict, an `X-Magpie-Account` pin, a sealed task's lead, a native compaction's reader, and a new conversation `leastHeld` spreads (In turn, `spreadsSessions`), which counts those in flight itself (`sticks.opening`). A plugin's provider and a remote magpie take the same path; the remote spreads over its own accounts, the sessions passed on to it (`passOnCaller`). Not done: putting a markedly slower account behind (speed is read only for Speed first, `speedOf`), as a first token's wait goes with the prompt's size and the vendor's queue more than with the account. `burst_spread_test.go`. -- Stays: Session or Strict under a routing that picks by what is left (Smart, Least used first, Use before expiry: `spreadsSessions`) spreads new conversations the same way (connor_yang on Discord: three sessions over three accounts landed on two). `leastHeld` with `ready` passes over one routing keeps new conversations off (`readyForNew`: resting, a key for another protocol, a provider's fallback while its own model leads, one used past `lowShare`), counts only leads (a key without `|agent:`), and leaves the turn marks alone. A subagent's first request goes to its lead's key or account while that one is `readyForNew` (`withLead`), so a session keeps one account, its subagents included. Held is the last `heldFor` (30 minutes): a session idle longer counts no more. In order, By weight, Free first, Speed first, Cheapest, Manual and a plugin's routing keep their order. An answered conversation is kept as before; the spread only decides where a new one starts. `session_spread_test.go`. +- Requests that come together spread (`burstSpread` in [`burst.go`](../../internal/gateway/burst.go), #5242: Moody-Sin and Tericerice sent four at once to three Antigravity accounts, In turn and By pace, and every one went to one account). Routing weighs what each seat served (`Tokens`) and its allowance, which move only once a reply ends, and a lane counts a request only once its try begins, so requests planned at the same moment were all planned on the same figures; In turn's next turn (`after`) reads a stick that moves only on an answer too. Once the plan is made (after affinity, rules, pinning, `roomy`, `behindOverflow`), `burstSpread` puts first, of the candidates alike to the first, the one with the fewest requests in flight (`inFlight`, by `candidate.who`), ties keeping routing's order, and counts the request there in the same hold of the lock; the count is given back when `serve` ends. Alike (`burstAlike`): ready as the first is (not resting, aside, reserved, barred, held, capped, a fallback standing in, credits-last or busy behind), the same fallback, fit, protocol, URL and `Via`, the rule's member when a group's rule picked one; In turn any of the round; By pace a pace within a tenth (`paceAlike`, routes.Pace's band), the same `Learns`, both with room (`burstTier` 0) and no wallet told apart (`sameBalance`); Least used within a point used, the same tier and known-ness. In a group, a provider routed its own way (`ownRouting`) is alike only to its own provider's keys, by its routing, and a group in the group to nothing. Quota first, In order, By weight and the others keep their order. Not moved, only counted: a conversation kept (`Affinity.Kept`), Strict, an `X-Magpie-Account` pin, a sealed task's lead, a native compaction's reader, and a new conversation `leastHeld` spreads (In turn, `spreadsSessions`), which counts those in flight itself (`sticks.opening`). A plugin's provider and a remote magpie take the same path; the remote spreads over its own accounts, the sessions passed on to it (`passOnCaller`). Not done: putting a markedly slower account behind (speed is read only for Speed first, `speedOf`), as a first token's wait goes with the prompt's size and the vendor's queue more than with the account. `burst_spread_test.go`. +- Stays: Session or Strict under a routing that picks by what is left (Quota first, Least used first, Use before expiry: `spreadsSessions`) spreads new conversations the same way (connor_yang on Discord: three sessions over three accounts landed on two). `leastHeld` with `ready` passes over one routing keeps new conversations off (`readyForNew`: resting, a key for another protocol, a provider's fallback while its own model leads, one used past `lowShare`), counts only leads (a key without `|agent:`), and leaves the turn marks alone. A subagent's first request goes to its lead's key or account while that one is `readyForNew` (`withLead`), so a session keeps one account, its subagents included. Held is the last `heldFor` (30 minutes): a session idle longer counts no more. In order, By weight, Free first, Speed first, Cheapest, Manual and a plugin's routing keep their order. An answered conversation is kept as before; the spread only decides where a new one starts. `session_spread_test.go`. - Least used first spends credits about to lapse first (kudi3699 on X, 11-12: a WorkBuddy account half through a pack ending in March, with check-in credits ending tomorrow, ranked by the whole pool's share and was never picked). `Allowance.Lapsing` is what a window loses at `RunsOut` (`RunsOutLeft` of `Of`, at most what is left) as points of the used share, in full when it is within a week and not at all past it (11-12, kudi3699 again: a fade across the week left a 20-credit check-in reward under the threshold); an amount not told is zero, never guessed. `routes.Seat.Lapsing` at 0.1 points or more (`urgent`) puts a seat with room ahead of the rest, the soonest `Lapse` first, then the share used as before; one at 90% or more is not helped. Any plugin whose usage window sends `runsOutAt` and `runsOut` gets it. `TestLeastUsedSpendsLapsingFirst`, `TestLeastUsedSpendsWorkBuddyCheckInCreditsAboutToLapse`, `TestAllowanceLapsing`. -- A session's call to another model than its main conversation's goes to the key or account that main conversation is on (`withSession`, `Affinity.Why` `lead` with `LeadModel`; #5655, jerrychoi, and iamnil on Discord). Each model's conversation is kept under its own scope (`p.ID/model`), so Claude Desktop's own Sonnet calls beside an Opus chat (`desktop-beside`), Claude Code's auto mode classifier and a title were routed as sessions of their own: put by `leastHeld`, or by Smart's order once their cache was cold, on another account, they ran one session on two accounts at once and drained the second one's 5 hours. The main conversation is the session's largest stick (cache read plus written) under another scope by the session's own id, one a header names (`sessionNamed`: a conversation known only by its opening's hash has no session, since unrelated ones that open alike share it; no `|agent:`), answered within `heldFor`, holding at least `cacheWorth` (a main with nothing cached goes where its own next turn is sent), and it leads only while larger than the call's own, so the two never follow each other. It is followed for Why `first`, `gone`, `cold`, `no-cache`, `cache` and `session`, by the model routing put first (in a group, another member on that account is another model and is never picked), and only to one `readyForNew`. It is not followed mid-turn (a kept `Within`), under Strict, In turn, nor for a subagent (`withLead` does that), nor past a rest, a reserve, credits or a fallback routing put first. A call moved off its own cache writes it once where the session goes on reading it. The Routing page says so ("Put on {first}, where this session's {model} is…", `routing-affinity-lead.test.cjs`). `session_lead_test.go`. -- A ChatGPT account that holds credits answers past its windows on them; the vendor spends them. That is the default. Set not to spend them (Usage card's *Use credits*, `magpie quota credits off`), the account is held at 100% of a window till it renews, by magpie's latest reading of its windows (`provider.Allowances`, refreshed about every minute), so the other accounts, groups and fallbacks take the request. A cap set on the account (1–99%) takes precedence. Unlike a cap, the hold is at the vendor's own 100%, so an account allowed to spend its resets spends one there, both when every candidate is held and after the last one is refused. A reset made forgets the account's cached allowance (`renewedNow`), so neither hold outlives the windows it started again. One let spend its credits, and holding some by its last `/wham/usage` (`credits.has_credits` with a balance over 0, or `unlimited`; `QuotaWindow.Credits`, `Limit.Credits`, `Allowance.OnCredits`), or as Codex itself hears it on every reply, the 429 included (`x-codex-credits-has-credits`, `-unlimited` and `-balance`, both bools required, an image limit's left out; and `credits` on a `codex.rate_limits` event: `heardCodexCredits`, `codexEventCredits`, `provider.NoteCodexCredits`; 123xtv03k on X, 11-15: an account used up on its plan stopped where Codex alone went on on its bought credits), is not out when a window fills (豆子 and Zhenzhen on Discord): ChatGPT may answer the turn that uses the window up 429 `usage_limit_reached` before it spends the credits, and the next turn on them. So that 429 is asked again at once, once a request, on the same account, before a reset is looked at, on the routed path (`creditsAgain`, `creditsAsked`, `Try.Credits`) and on Codex's own sign-in's relay (`relayOnCredits`), rather than ended for the agent, which ended a running session while a new one worked. Refused again, it rests `fallbackCooldown` (`Rest.By` `credits`) and is read again, not until its window renews (the relay's hold too, `noteCodexHold`); a rest taken for a used-up window before its credits were known is lifted once they are, heard or read (`provider.OnCredits`, `creditsKnown`), and its full windows rest it nowhere else (`full` is zero for it, `spendsCredits`). Smart, Pace and Least used put such an account first of the spent tier (`routes.Seat.Credits`, `spentBefore`): after those with allowance left, ahead of those used up with nothing to go on with (`Weighed.Credits`, told on the Routing page). Switching to credits early, at a few percent left, was weighed and not done: the vendor spends credits only once the allowance is used up, so it would only waste what is left. `TestCodexCreditsHeardOnTheRefusal`, `TestCodexCreditsKnownLiftsTheRest`, `TestCodexCreditsRead`, `TestNoteCodexCreditsKeepsThem`, `TestReadingTellsCreditsBought`, `TestCodexCreditsAskedAgainAtTheEdge`, `TestCodexCreditsNoLongRest`, `TestCodexCreditsFirstOfTheSpent`, `TestCreditsFirstOfTheSpent`, `routing-codex-credits-again.test.cjs`. -- A third way, set per account, spends the credits only after everything else (gokoshiki on Discord: a Codex subscription, then an OpenAI API key, then the subscription's credits): *Only after every other account, key and fallback* under the Usage card's *Use credits*, `magpie quota credits last`, `settings.CodexCreditsLast` (`provider.CodexCreditsLast`, `SetCodexCreditsMode`; on or off clears it, and an account never in it keeps its place, so a setting saved before keeps its order). Such an account is `creditsLast` while it goes on on its credits (`spendsCredits`) and a window for the model is used up where *off* would hold it (`Allowance.CapHeld` at `WindowCaps{Credits: true}`; a call ChatGPT counts in no window, `freeOnChatGPT`, stays). `restLast` then puts it behind every candidate of the plan, the provider's fallbacks and groups included: ready, then resting, then the credits-last ones in their own order (`Weighed.CreditsLast`). Affinity doesn't keep a conversation on one while one not on its credits leads (`Affinity.Why` `credits`, `lastBehind`), within a turn too, and In turn's next pick and Smart/Pace/Least used's spreading of new sessions never bring one forward (`after`, `leastHeld`, `readyForNew`). Strict affinity keeps it, as a rule, an `X-Magpie-Account` pin and a sealed task's lead (`leadFirst`) still put theirs first. A reset is still spent before its credits when the try reaches it (`resetBeforeCredits`). Codex's own sign-in's relay has the one account and nothing to put first, so there it is as *on*. The Routing page tells each: behind the rest, first when every one is, and the conversation moved. `TestCodexCreditsLastAfterTheOthers`, `TestCodexCreditsLastAfterTheFallback`, `TestCodexCreditsLastNotKept`, `TestCodexCreditsLastMode`, `codex-credits-last.test.cjs`. +- A session's call to another model than its main conversation's goes to the key or account that main conversation is on (`withSession`, `Affinity.Why` `lead` with `LeadModel`; #5655, jerrychoi, and iamnil on Discord). Each model's conversation is kept under its own scope (`p.ID/model`), so Claude Desktop's own Sonnet calls beside an Opus chat (`desktop-beside`), Claude Code's auto mode classifier and a title were routed as sessions of their own: put by `leastHeld`, or by Quota first's order once their cache was cold, on another account, they ran one session on two accounts at once and drained the second one's 5 hours. The main conversation is the session's largest stick (cache read plus written) under another scope by the session's own id, one a header names (`sessionNamed`: a conversation known only by its opening's hash has no session, since unrelated ones that open alike share it; no `|agent:`), answered within `heldFor`, holding at least `cacheWorth` (a main with nothing cached goes where its own next turn is sent), and it leads only while larger than the call's own, so the two never follow each other. It is followed for Why `first`, `gone`, `cold`, `no-cache`, `cache` and `session`, by the model routing put first (in a group, another member on that account is another model and is never picked), and only to one `readyForNew`. It is not followed mid-turn (a kept `Within`), under Strict, In turn, nor for a subagent (`withLead` does that), nor past a rest, a reserve, credits or a fallback routing put first. A call moved off its own cache writes it once where the session goes on reading it. The Routing page says so ("Put on {first}, where this session's {model} is…", `routing-affinity-lead.test.cjs`). `session_lead_test.go`. +- A ChatGPT account that holds credits answers past its windows on them; the vendor spends them. That is the default. Set not to spend them (Usage card's *Use credits*, `magpie quota credits off`), the account is held at 100% of a window till it renews, by magpie's latest reading of its windows (`provider.Allowances`, refreshed about every minute), so the other accounts, groups and fallbacks take the request. A cap set on the account (1–99%) takes precedence. Unlike a cap, the hold is at the vendor's own 100%, so an account allowed to spend its resets spends one there, both when every candidate is held and after the last one is refused. A reset made forgets the account's cached allowance (`renewedNow`), so neither hold outlives the windows it started again. One let spend its credits, and holding some by its last `/wham/usage` (`credits.has_credits` with a balance over 0, or `unlimited`; `QuotaWindow.Credits`, `Limit.Credits`, `Allowance.OnCredits`), or as Codex itself hears it on every reply, the 429 included (`x-codex-credits-has-credits`, `-unlimited` and `-balance`, both bools required, an image limit's left out; and `credits` on a `codex.rate_limits` event: `heardCodexCredits`, `codexEventCredits`, `provider.NoteCodexCredits`; 123xtv03k on X, 11-15: an account used up on its plan stopped where Codex alone went on on its bought credits), is not out when a window fills (豆子 and Zhenzhen on Discord): ChatGPT may answer the turn that uses the window up 429 `usage_limit_reached` before it spends the credits, and the next turn on them. So that 429 is asked again at once, once a request, on the same account, before a reset is looked at, on the routed path (`creditsAgain`, `creditsAsked`, `Try.Credits`) and on Codex's own sign-in's relay (`relayOnCredits`), rather than ended for the agent, which ended a running session while a new one worked. Refused again, it rests `fallbackCooldown` (`Rest.By` `credits`) and is read again, not until its window renews (the relay's hold too, `noteCodexHold`); a rest taken for a used-up window before its credits were known is lifted once they are, heard or read (`provider.OnCredits`, `creditsKnown`), and its full windows rest it nowhere else (`full` is zero for it, `spendsCredits`). Quota first, Pace and Least used put such an account first of the spent tier (`routes.Seat.Credits`, `spentBefore`): after those with allowance left, ahead of those used up with nothing to go on with (`Weighed.Credits`, told on the Routing page). Switching to credits early, at a few percent left, was weighed and not done: the vendor spends credits only once the allowance is used up, so it would only waste what is left. `TestCodexCreditsHeardOnTheRefusal`, `TestCodexCreditsKnownLiftsTheRest`, `TestCodexCreditsRead`, `TestNoteCodexCreditsKeepsThem`, `TestReadingTellsCreditsBought`, `TestCodexCreditsAskedAgainAtTheEdge`, `TestCodexCreditsNoLongRest`, `TestCodexCreditsFirstOfTheSpent`, `TestCreditsFirstOfTheSpent`, `routing-codex-credits-again.test.cjs`. +- A third way, set per account, spends the credits only after everything else (gokoshiki on Discord: a Codex subscription, then an OpenAI API key, then the subscription's credits): *Only after every other account, key and fallback* under the Usage card's *Use credits*, `magpie quota credits last`, `settings.CodexCreditsLast` (`provider.CodexCreditsLast`, `SetCodexCreditsMode`; on or off clears it, and an account never in it keeps its place, so a setting saved before keeps its order). Such an account is `creditsLast` while it goes on on its credits (`spendsCredits`) and a window for the model is used up where *off* would hold it (`Allowance.CapHeld` at `WindowCaps{Credits: true}`; a call ChatGPT counts in no window, `freeOnChatGPT`, stays). `restLast` then puts it behind every candidate of the plan, the provider's fallbacks and groups included: ready, then resting, then the credits-last ones in their own order (`Weighed.CreditsLast`). Affinity doesn't keep a conversation on one while one not on its credits leads (`Affinity.Why` `credits`, `lastBehind`), within a turn too, and In turn's next pick and Quota first/Pace/Least used's spreading of new sessions never bring one forward (`after`, `leastHeld`, `readyForNew`). Strict affinity keeps it, as a rule, an `X-Magpie-Account` pin and a sealed task's lead (`leadFirst`) still put theirs first. A reset is still spent before its credits when the try reaches it (`resetBeforeCredits`). Codex's own sign-in's relay has the one account and nothing to put first, so there it is as *on*. The Routing page tells each: behind the rest, first when every one is, and the conversation moved. `TestCodexCreditsLastAfterTheOthers`, `TestCodexCreditsLastAfterTheFallback`, `TestCodexCreditsLastNotKept`, `TestCodexCreditsLastMode`, `codex-credits-last.test.cjs`. - A plugin's account whose window says it goes on on credits (`credits: true`, [provider-plugins.md](provider-plugins.md#credits-after-a-window): a Kiro month used up with a trial left) is on its credits as a ChatGPT account let spend them is (`spendsCredits`), with no setting: Kiro spends the plan's credits before the trial's, the plan's are lost at the month's reset and a trial's last a year. Used up for the model where a window stops it (`pastWindows`), it goes after the provider's accounts with room and before those used up with nothing left, each in its routing's order (`creditsBehind`, `behindOthers` in `weigh`), under every routing but Pick account by hand; a group's heads keep the group's order. The trace marks it `Weighed.CreditsLast`, so affinity doesn't keep a conversation on it while one with room leads (`lastBehind`); the Routing page doesn't show the mark. The Kiro plugin sends `credits` only while an `ACTIVE` bonus has credits left that outlast the month's reset (0.1.41). `TestPluginCreditsAfterTheOthers`. -- A fourth, set per account, spends the credits before moving to another account (jojonas_xyz on X: the account ran out, magpie moved to another by itself, and no setting kept the first one's credits in use). *On* alone lets the vendor answer on credits, but Smart and Pace still put an account at `LowShare` (90%) or `SpentShare` (98%) behind every account with room (`tier`), Drain counts it used up at `SpentShareOf(Drain)`, and `NextLogin` moves Codex's own sign-in at the spent share, credits or not. *Before moving to another account* under *Use credits* (the Usage card, the menu bar panel, and the account's ⋯ in its provider's editor), `magpie quota credits first`, `settings.CodexCreditsFirst` (`provider.CodexCreditsFirst`; one of first and last at most, on or off clears it) makes an account that spends credits (`spendsCredits`) a `routes.Seat.First`: Smart, Pace and Fastest weigh it at tier 0 (`seatTier`), Drain doesn't count it spent, affinity doesn't move a conversation off it as `spent`, and `readyForNew`/`standsInFor` treat it as having room (`Weighed.CreditsFirst`). `NextLogin` keeps Codex signed in to it while one of its windows says it holds credits (`spendsFirst`); with the credits gone it moves as before. The account magpie moved Codex off says where the setting is, on its *First again once it has room* tag. `TestCodexCreditsFirstKeepsItsPlace`, `TestCodexCreditsFirstDrainStays`, `TestCodexCreditsFirstMode`, `TestCodexStaysOnAnAccountSpendingCreditsFirst`, `codex-credits-first.test.cjs`. -- A provider can be set to be used first (hzh_1119 on Discord: ChatGPT Pro and Business come with monthly API credit, to be spent on an OpenAI API key before the subscription where both serve a model). *Use first* on a provider row's right-click (GUI `provider/usefirst`, `provider.SetUseFirst`, `Provider.UseFirst`, copied onto its accounts by `accountSettings`) makes its keys and accounts `routes.Seat.Lead`, and Smart (`leadFirst`) puts those under the spent tier (`seatTier` below 2) ahead of every other seat it weighs, each side in Smart's own order. Without it an API key, which tells no allowance, goes after every account with room. It counts where Smart weighs several providers together: a model's found group (`auto/`) or a user's group routed Smart; within one provider every seat shares it, so nothing changes. One resting is passed over as any is, so a 429 `insufficient_quota` (out of credit, a half-hour rest) or a failure moves the request on to the others. Free quota by expiry orders its paid seats with Smart and so honours it too; the other strategies don't read it. Affinity still keeps a conversation on the one that answered it. The Routing page says why (`Weighed.UseFirst`, `firstWhy`), and `behindWhy` doesn't call one behind it renewing later. `TestSmartLeadFirst`, `TestUseFirstLeadsTheGroup`, `use-first.test.cjs`. -- A provider can be set never to be a fallback for another model (sonnnnnnnnnnnna on X: an agent on a local uncensored model whose server is down or out of KV room must not have its request sent on to Claude or Codex, whose vendor may ban the account for it). *Never a fallback* on a provider row's right-click (GUI `provider/standin`, `magpie provider set fallback-for-others=no`, `provider.SetNoStandIn`, `Provider.NoStandIn`, copied onto its accounts by `accountSettings`) has `standInsOut` leave out, in `planPaused` and `planGroup`, each of its keys and accounts planned after one of a provider not so set. It runs on the planned order before `restLast` and `sinkPlanned`, so a local model that failed and rests still counts as first; a provider request whose own provider is unmarked starts as seen, so one with nothing planned (its model off, every account capped) still keeps them out, and a fallback group's marked members, a marked fallback's unlisted accounts and `groupsAfter`'s groups go the same way. A request that goes first to a marked provider moves on to another marked one, or an unmarked one, as before; a group routed by weight (Smart, Cheapest) that weighs a marked member first sends it the request as the group's pick. The left-out rows carry `Weighed.StandIn` (and `Unlisted`), and the Routing page says why (`leftWhy`, `unlistedWord`); they don't count toward the cap, held or barred refusals. No classifier reads the request: the model that would judge it is the local one that is down, and any other would send the text somewhere the user didn't choose. `TestNoStandInTakesNoOtherModelsRequest`, `stand-in.test.cjs`. +- A fourth, set per account, spends the credits before moving to another account (jojonas_xyz on X: the account ran out, magpie moved to another by itself, and no setting kept the first one's credits in use). *On* alone lets the vendor answer on credits, but Quota first and Pace still put an account at `LowShare` (90%) or `SpentShare` (98%) behind every account with room (`tier`), Drain counts it used up at `SpentShareOf(Drain)`, and `NextLogin` moves Codex's own sign-in at the spent share, credits or not. *Before moving to another account* under *Use credits* (the Usage card, the menu bar panel, and the account's ⋯ in its provider's editor), `magpie quota credits first`, `settings.CodexCreditsFirst` (`provider.CodexCreditsFirst`; one of first and last at most, on or off clears it) makes an account that spends credits (`spendsCredits`) a `routes.Seat.First`: Quota first, Pace and Fastest weigh it at tier 0 (`seatTier`), Drain doesn't count it spent, affinity doesn't move a conversation off it as `spent`, and `readyForNew`/`standsInFor` treat it as having room (`Weighed.CreditsFirst`). `NextLogin` keeps Codex signed in to it while one of its windows says it holds credits (`spendsFirst`); with the credits gone it moves as before. The account magpie moved Codex off says where the setting is, on its *First again once it has room* tag. `TestCodexCreditsFirstKeepsItsPlace`, `TestCodexCreditsFirstDrainStays`, `TestCodexCreditsFirstMode`, `TestCodexStaysOnAnAccountSpendingCreditsFirst`, `codex-credits-first.test.cjs`. +- A provider can be set to be used first (hzh_1119 on Discord: ChatGPT Pro and Business come with monthly API credit, to be spent on an OpenAI API key before the subscription where both serve a model). *Use first* on a provider row's right-click (GUI `provider/usefirst`, `provider.SetUseFirst`, `Provider.UseFirst`, copied onto its accounts by `accountSettings`) makes its keys and accounts `routes.Seat.Lead`, and Quota first (`leadFirst`) puts those under the spent tier (`seatTier` below 2) ahead of every other seat it weighs, each side in Quota first's own order. Without it an API key, which tells no allowance, goes after every account with room. It counts where Quota first weighs several providers together: a model's found group (`auto/`) or a user's group routed Quota first; within one provider every seat shares it, so nothing changes. One resting is passed over as any is, so a 429 `insufficient_quota` (out of credit, a half-hour rest) or a failure moves the request on to the others. Free quota by expiry orders its paid seats with Quota first and so honours it too; the other strategies don't read it. Affinity still keeps a conversation on the one that answered it. The Routing page says why (`Weighed.UseFirst`, `firstWhy`), and `behindWhy` doesn't call one behind it renewing later. `TestSmartLeadFirst`, `TestUseFirstLeadsTheGroup`, `use-first.test.cjs`. +- A provider can be set never to be a fallback for another model (sonnnnnnnnnnnna on X: an agent on a local uncensored model whose server is down or out of KV room must not have its request sent on to Claude or Codex, whose vendor may ban the account for it). *Never a fallback* on a provider row's right-click (GUI `provider/standin`, `magpie provider set fallback-for-others=no`, `provider.SetNoStandIn`, `Provider.NoStandIn`, copied onto its accounts by `accountSettings`) has `standInsOut` leave out, in `planPaused` and `planGroup`, each of its keys and accounts planned after one of a provider not so set. It runs on the planned order before `restLast` and `sinkPlanned`, so a local model that failed and rests still counts as first; a provider request whose own provider is unmarked starts as seen, so one with nothing planned (its model off, every account capped) still keeps them out, and a fallback group's marked members, a marked fallback's unlisted accounts and `groupsAfter`'s groups go the same way. A request that goes first to a marked provider moves on to another marked one, or an unmarked one, as before; a group routed by weight (Quota first, Cheapest) that weighs a marked member first sends it the request as the group's pick. The left-out rows carry `Weighed.StandIn` (and `Unlisted`), and the Routing page says why (`leftWhy`, `unlistedWord`); they don't count toward the cap, held or barred refusals. No classifier reads the request: the model that would judge it is the local one that is down, and any other would send the text somewhere the user didn't choose. `TestNoStandInTakesNoOtherModelsRequest`, `stand-in.test.cjs`. - Different failures are classified separately: out of credit, out of quota, rate limit and other errors rest for different lengths. A fix must not merge them into one bucket (see #873). - A refusal of where the request comes from (`regionWords`: Google's 400 "User location is not supported for the API use.", as Antigravity and Code Assist pass it on, and OpenAI's `unsupported_country_region_territory` / "Country, region, or territory not supported"; `regionRefused`) is the network's and the edge's the connection reached, not the account's. It rests no account and counts no failure (`restAfterMarked` returns `Rest.By` `off`, `Until` now), and the next try goes out on a new connection: `regionFresh` (in `upstreamTransport`, around each of its three transports, so under every request the gateway sends through `s.client`) reads the head of each failed reply, and when it matches it closes the transport's idle connections as the body closes and again before the next request (`pending`), so the HTTP/2 or keep-alive connection that drew the refusal isn't reused. The last candidate is asked again after `retryPause` (`passing`). Refused a second time for the same provider and model within a request (`regionAsked` in the serve loop), it is the place, not a connection: Google serves some models to no request from where the user is while the same account's other models answer (taoxiaoxin, #5182: Antigravity's gemini-3.8-flash refused, its Claude models answered). Then none of the provider's other accounts is asked that model (`notMates`), the last isn't asked again (`protected`), another provider or model left is, and the agent is told the vendor's words with `regionNote` (through `explained`, beside `Provider.Explain`): the vendor doesn't serve that model to requests from that region, it is no account's fault, other models may answer, and a proxy in a served region or another provider gets past it. So a refused model costs two asks a request, not one per account and retries. Before, every Antigravity account was asked on the one kept-alive connection, each refused the same and rested, and the agent got a 400, while a new connection answered 12 seconds on (#5182, ggdayup; `TestRegionRefusalDropsItsConnection`, `TestAntigravityRegionRefusalAsksTheNextOnANewConnection`, `TestAntigravityRegionRefusalAsksTheLastAgain`, `TestRegionRefusalRestsNoAccount`, `TestRegionRefusalOfTheModelEndsAfterOneMoreAsk`, `TestRegionNote`). Not covered: an HTTP/2 connection carrying another stream at that moment outlives the close until it is idle, and the close drops other vendors' idle connections too (one handshake each). A user whose region is refused gets the refusal after the one more ask, a moment later than before. - OpenRouter's 403 for a free model it serves only to the agent apps it lists ("… is only available on agentic harnesses", routing step "Gate Free Endpoints by Agentic Harness"; `provider.HarnessOnly`) is about the app the request came from, not the key or the model. It rests nothing and counts no failure (`restAfterMarked` returns `Rest.By` `off`), and a group's next member is asked as after any 403. Read as the key's 403, it set every model of the OpenRouter key aside (Wade111999 on X; `TestOpenRouterHarnessOnlyRestsNothing`). `APIError` puts `HarnessOnlyHint` after the words, so a model test, magpie's own request and no listed app's, says why it was refused and that the model without `:free` has no such gate (`TestHarnessOnlyTestSaysWhy`). magpie never names an app it isn't. Not covered: whether OpenRouter takes an agent's request through magpie as that agent's, since agents send OpenRouter's attribution headers only to openrouter.ai itself. @@ -1096,7 +1096,7 @@ conversation asked of it is refused 400 pointing at `/v1/systemone`. A single decision provider of several keys or accounts (TypeSafe Jev with a key out of quota, fflake33 on Discord) is asked the same way, at `/v1/systemone` (`serveSystemOne`) and as a classifier (`askClassifier` → -`askDecider`): `decideKeys` plans its keys in its routing's order (Smart, +`askDecider`): `decideKeys` plans its keys in its routing's order (Quota first, In order), leaving out a key whose plan has no System One (a Volcengine Coding Plan key beside pay as you go), `probeOne` leaves out all but the resting one back soonest, and diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 133c0ef3c..ac9b264a9 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -12414,7 +12414,7 @@ function kindTag(c, kind) { // renderRouting: spread over keys or accounts and stickiness, staged in // the draft and made with Save (01huadalang on Discord) const ROUTINGS = [ - ["", "Smart", "Not load balancing: every request, new conversations too, goes to the one account whose quota renews soonest, since what it has left is lost then, until it runs low or can't answer. Keys go in their order. To spread requests evenly, pick In turn or Least used first. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again."], + ["", "Quota first", "Not load balancing: every request, new conversations too, goes to the one account whose quota renews soonest, since what it has left is lost then, until it runs low or can't answer. Keys go in their order. To spread requests evenly, pick In turn or Least used first. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again."], ["order", "In order", "Requests go to the first; the next takes over when the one before runs out of quota, hits a rate limit or fails."], // dzxx0496 on Discord: free accounts one after another, the first not // taking the requests back once it renews (routes.Drain) diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index 1cac9854c..e181f5de2 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -1217,7 +1217,7 @@ const I18N = { "Send each request's traces and metrics to an OpenTelemetry collector, such as Langfuse": "把每个请求的追踪和指标发送到 OpenTelemetry 收集器,比如 Langfuse", "Sending to a collector": "正在发送到收集器", "Routing strategies": "路由策略", - "The routings besides Smart: In order, Until used up, In turn, Least used first, Use before expiry, By weight, Free first, Speed first and Cheapest first": "智能以外的路由方式:按顺序、用完再换、轮流、用量少的优先、到期前用完、按权重、免费优先、速度优先和最便宜优先", + "The routings besides Quota first: In order, Until used up, In turn, Least used first, Use before expiry, By weight, Free first, Speed first and Cheapest first": "额度优先以外的路由方式:按顺序、用完再换、轮流、用量少的优先、到期前用完、按权重、免费优先、速度优先和最便宜优先", "1 provider or group routed so": "1 个提供商或路由组在用", "{n} providers and groups routed so": "{n} 个提供商和路由组在用", "Run the JavaScript gateway plugins: middleware on agents' requests and replies, routings and usage observers": "运行 JavaScript 网关插件:Agent 请求和回复上的中间件、路由方式和用量观察者", @@ -2311,7 +2311,7 @@ const I18N = { "{agent} stays on this account even when it runs low. Requests through magpie still follow Routing.": "额度快用完时,{agent} 也不换账号。经 magpie 的请求仍按「路由」分配。", "{agent} stays signed in to the first account": "{agent} 将始终登录首选账号", "magpie moves {agent} to an account with room again": "首选账号额度不足时,会再把 {agent} 切到有余量的账号", - "Smart": "智能", + "Quota first": "额度优先", "Not load balancing: every request, new conversations too, goes to the one account whose quota renews soonest, since what it has left is lost then, until it runs low or can't answer. Keys go in their order. To spread requests evenly, pick In turn or Least used first. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again.": "不是负载均衡:所有请求(新会话也一样)都给额度最先重置的那一个账号(它剩下的额度到时就作废),直到它快用完或无法响应才换下一个;密钥按顺序。要平均分摊,请选“轮流”或“用量少的优先”。欠费的暂停半小时,额度用完的暂停到重置,被限流的按厂商要求暂停,出错的暂停一分钟,再出错则逐次延长。", "{user} is first in the order; {routing} still goes by each account's quota, so the order only settles ties. In order uses the first first.": "{user} 已排在首位;{routing} 仍按各账号的额度挑选,顺序只在条件相同时起作用。想先用完首选账号,请选「按顺序」。", "In order": "按顺序", @@ -2334,7 +2334,7 @@ const I18N = { "Speed first: {who} hasn't answered {model} lately, so it takes this request to be measured \u2014 one request in five goes to one not measured.": "速度优先:{who} 最近没回答过 {model},所以这个请求给它,好测一下速度——每五个请求有一个给没测过的。", "Speed first: none has answered {model} lately, so {who}, first in the list, goes first and its answer measures it.": "速度优先:最近都没回答过 {model},所以按列出的顺序先用 {who},它的回答会测出速度。", "Free quota by expiry": "免费额度先到期先用", - "Free quota by expiry: the accounts on a free plan, or whose model costs nothing there, go first, the one whose free quota is lost soonest first — at its next reset, or when its credits expire if sooner; once it is used up, the next. A paid one takes requests only when no free one has quota left, the paid as Smart orders them.": "免费额度先到期先用:免费套餐的账号,或模型在那里不花钱的,先用,其中免费额度最先失效的最先——在下次重置时,或其额度包更早过期时;用完了就换下一个。只有所有免费的都没有额度了,才用付费的,付费的按智能的顺序。", + "Free quota by expiry: the accounts on a free plan, or whose model costs nothing there, go first, the one whose free quota is lost soonest first — at its next reset, or when its credits expire if sooner; once it is used up, the next. A paid one takes requests only when no free one has quota left, the paid as Quota first orders them.": "免费额度先到期先用:免费套餐的账号,或模型在那里不花钱的,先用,其中免费额度最先失效的最先——在下次重置时,或其额度包更早过期时;用完了就换下一个。只有所有免费的都没有额度了,才用付费的,付费的按额度优先的顺序。", "its free quota is lost soonest, in {d}.": "它的免费额度最先失效,还有 {d}。", "Free quota by expiry: {who}'s free quota is lost soonest, in {d}, so it's spent first.": "免费额度先到期先用:{who} 的免费额度最先失效,还有 {d},所以先用它。", "it has free quota left, so it's spent before any paid one.": "它还有免费额度,所以先于任何付费的使用。", @@ -2351,7 +2351,7 @@ const I18N = { "Cheapest first: no price is known for {model} on {who}, so it goes in its listed place after every one that has a price.": "最便宜优先:不知道 {model} 在 {who} 上的价格,所以它排在所有有价格的后面,按列出的位置。", "Small context first": "小上下文优先", "Small context first: each request goes to the member with the smallest context window that holds it, so the big ones are kept for long requests; one whose window it is longer than is left out.": "小上下文优先:每个请求交给能装下它、上下文窗口最小的成员,大窗口的留给长请求;窗口比请求短的不参与。", - "Small context first: each request goes to the member with the smallest context window that holds it, so the big ones are kept for long requests; a member whose window the request is longer than is left out. Members of one size go as Smart orders them, and one whose window isn't known goes last.": "小上下文优先:每个请求交给能装下它、上下文窗口最小的成员,大窗口的留给长请求;窗口比请求短的成员不参与。窗口一样大的按智能的顺序,窗口未知的排最后。", + "Small context first: each request goes to the member with the smallest context window that holds it, so the big ones are kept for long requests; a member whose window the request is longer than is left out. Members of one size go as Quota first orders them, and one whose window isn't known goes last.": "小上下文优先:每个请求交给能装下它、上下文窗口最小的成员,大窗口的留给长请求;窗口比请求短的成员不参与。窗口一样大的按额度优先的顺序,窗口未知的排最后。", "its {n} context window is the smallest that holds this request.": "它 {n} 的上下文窗口是能装下这个请求的最小的。", "Small context first: {who}'s {n} context window is the smallest that holds this request.": "小上下文优先:{who} 的 {n} 上下文窗口是能装下这个请求的最小的。", "Small context first: no member with a known context window can take this request, so {who} is next.": "小上下文优先:没有已知窗口的成员能接这个请求,所以轮到 {who}。", @@ -6735,7 +6735,7 @@ const I18N = { "Send each request's traces and metrics to an OpenTelemetry collector, such as Langfuse": "把每個請求的追蹤和指標傳送到 OpenTelemetry 收集器,例如 Langfuse", "Sending to a collector": "正在傳送到收集器", "Routing strategies": "路由策略", - "The routings besides Smart: In order, Until used up, In turn, Least used first, Use before expiry, By weight, Free first, Speed first and Cheapest first": "智慧以外的路由方式:按順序、用完再換、輪流、用量少的優先、到期前用完、按權重、免費優先、速度優先和最便宜優先", + "The routings besides Quota first: In order, Until used up, In turn, Least used first, Use before expiry, By weight, Free first, Speed first and Cheapest first": "額度優先以外的路由方式:按順序、用完再換、輪流、用量少的優先、到期前用完、按權重、免費優先、速度優先和最便宜優先", "1 provider or group routed so": "1 個提供商或路由組在用", "{n} providers and groups routed so": "{n} 個提供商和路由組在用", "Run the JavaScript gateway plugins: middleware on agents' requests and replies, routings and usage observers": "執行 JavaScript 閘道外掛:Agent 請求和回覆上的中介軟體、路由方式和用量觀察者", @@ -7816,7 +7816,7 @@ const I18N = { "{agent} stays on this account even when it runs low. Requests through magpie still follow Routing.": "額度快用完時,{agent} 也不換帳號。經 magpie 的請求仍按「路由」分配。", "{agent} stays signed in to the first account": "{agent} 將始終登入首選帳號", "magpie moves {agent} to an account with room again": "首選帳號額度不足時,會再把 {agent} 切到有餘量的帳號", - "Smart": "智慧", + "Quota first": "額度優先", "Not load balancing: every request, new conversations too, goes to the one account whose quota renews soonest, since what it has left is lost then, until it runs low or can't answer. Keys go in their order. To spread requests evenly, pick In turn or Least used first. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again.": "不是負載平衡:所有請求(新對話也一樣)都給額度最先重置的那一個帳號(它剩下的額度到時就作廢),直到它快用完或無法回應才換下一個;金鑰按順序。要平均分攤,請選「輪流」或「用量少的優先」。欠費的暫停半小時,額度用完的暫停到重置,被限流的按廠商要求暫停,出錯的暫停一分鐘,再出錯則逐次延長。", "{user} is first in the order; {routing} still goes by each account's quota, so the order only settles ties. In order uses the first first.": "{user} 已排在首位;{routing} 仍按各帳號的額度挑選,順序只在條件相同時起作用。想先用完首選帳號,請選「按順序」。", "In order": "按順序", @@ -7839,7 +7839,7 @@ const I18N = { "Speed first: {who} hasn't answered {model} lately, so it takes this request to be measured \u2014 one request in five goes to one not measured.": "速度優先:{who} 最近沒回答過 {model},所以這個請求給它,好測一下速度——每五個請求有一個給沒測過的。", "Speed first: none has answered {model} lately, so {who}, first in the list, goes first and its answer measures it.": "速度優先:最近都沒回答過 {model},所以按列出的順序先用 {who},它的回答會測出速度。", "Free quota by expiry": "免費額度先到期先用", - "Free quota by expiry: the accounts on a free plan, or whose model costs nothing there, go first, the one whose free quota is lost soonest first — at its next reset, or when its credits expire if sooner; once it is used up, the next. A paid one takes requests only when no free one has quota left, the paid as Smart orders them.": "免費額度先到期先用:免費方案的帳號,或模型在那裡不花錢的,先用,其中免費額度最先失效的最先——在下次重置時,或其額度包更早到期時;用完了就換下一個。只有所有免費的都沒有額度了,才用付費的,付費的按智慧的順序。", + "Free quota by expiry: the accounts on a free plan, or whose model costs nothing there, go first, the one whose free quota is lost soonest first — at its next reset, or when its credits expire if sooner; once it is used up, the next. A paid one takes requests only when no free one has quota left, the paid as Quota first orders them.": "免費額度先到期先用:免費方案的帳號,或模型在那裡不花錢的,先用,其中免費額度最先失效的最先——在下次重置時,或其額度包更早到期時;用完了就換下一個。只有所有免費的都沒有額度了,才用付費的,付費的按額度優先的順序。", "its free quota is lost soonest, in {d}.": "它的免費額度最先失效,還有 {d}。", "Free quota by expiry: {who}'s free quota is lost soonest, in {d}, so it's spent first.": "免費額度先到期先用:{who} 的免費額度最先失效,還有 {d},所以先用它。", "it has free quota left, so it's spent before any paid one.": "它還有免費額度,所以先於任何付費的使用。", @@ -7856,7 +7856,7 @@ const I18N = { "Cheapest first: no price is known for {model} on {who}, so it goes in its listed place after every one that has a price.": "最便宜優先:不知道 {model} 在 {who} 上的價格,所以它排在所有有價格的後面,按列出的位置。", "Small context first": "小上下文優先", "Small context first: each request goes to the member with the smallest context window that holds it, so the big ones are kept for long requests; one whose window it is longer than is left out.": "小上下文優先:每個請求交給能裝下它、上下文視窗最小的成員,大視窗的留給長請求;視窗比請求短的不參與。", - "Small context first: each request goes to the member with the smallest context window that holds it, so the big ones are kept for long requests; a member whose window the request is longer than is left out. Members of one size go as Smart orders them, and one whose window isn't known goes last.": "小上下文優先:每個請求交給能裝下它、上下文視窗最小的成員,大視窗的留給長請求;視窗比請求短的成員不參與。視窗一樣大的按智慧的順序,視窗未知的排最後。", + "Small context first: each request goes to the member with the smallest context window that holds it, so the big ones are kept for long requests; a member whose window the request is longer than is left out. Members of one size go as Quota first orders them, and one whose window isn't known goes last.": "小上下文優先:每個請求交給能裝下它、上下文視窗最小的成員,大視窗的留給長請求;視窗比請求短的成員不參與。視窗一樣大的按額度優先的順序,視窗未知的排最後。", "its {n} context window is the smallest that holds this request.": "它 {n} 的上下文視窗是能裝下這個請求的最小的。", "Small context first: {who}'s {n} context window is the smallest that holds this request.": "小上下文優先:{who} 的 {n} 上下文視窗是能裝下這個請求的最小的。", "Small context first: no member with a known context window can take this request, so {who} is next.": "小上下文優先:沒有已知視窗的成員能接這個請求,所以輪到 {who}。", @@ -12219,7 +12219,7 @@ const I18N = { "Send each request's traces and metrics to an OpenTelemetry collector, such as Langfuse": "各リクエストのトレースとメトリクスを Langfuse などの OpenTelemetry コレクターに送ります", "Sending to a collector": "コレクターに送信中", "Routing strategies": "ルーティング戦略", - "The routings besides Smart: In order, Until used up, In turn, Least used first, Use before expiry, By weight, Free first, Speed first and Cheapest first": "スマート以外のルーティング:順番、使い切ってから次へ、交互、使用量が最少のものを優先、期限前に使い切る、重み付け、無料優先、速度優先、最安優先", + "The routings besides Quota first: In order, Until used up, In turn, Least used first, Use before expiry, By weight, Free first, Speed first and Cheapest first": "枠優先以外のルーティング:順番、使い切ってから次へ、交互、使用量が最少のものを優先、期限前に使い切る、重み付け、無料優先、速度優先、最安優先", "1 provider or group routed so": "1 個のプロバイダーまたはグループが使用中", "{n} providers and groups routed so": "{n} 個のプロバイダーとグループが使用中", "Run the JavaScript gateway plugins: middleware on agents' requests and replies, routings and usage observers": "JavaScript ゲートウェイプラグインを実行します:エージェントのリクエストと応答のミドルウェア、ルーティング、使用量オブザーバー", @@ -13290,7 +13290,7 @@ const I18N = { "{agent} stays on this account even when it runs low. Requests through magpie still follow Routing.": "残量が少なくなっても、{agent} はこのアカウントのままです。magpie 経由のリクエストは「ルーティング」に従います。", "{agent} stays signed in to the first account": "{agent} は最初のアカウントにサインインしたままになります", "magpie moves {agent} to an account with room again": "magpie は {agent} を再び残量のあるアカウントに切り替えます", - "Smart": "スマート", + "Quota first": "枠優先", "Not load balancing: every request, new conversations too, goes to the one account whose quota renews soonest, since what it has left is lost then, until it runs low or can't answer. Keys go in their order. To spread requests evenly, pick In turn or Least used first. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again.": "負荷分散ではありません。リクエストは一度に 1 つのアカウント、枠が最も早くリセットされるもの(残りはその時点で失われるため)に送られます(新しい会話も同じ)。残りが少なくなるか応答できなくなるまで次には移りません。キーは順番どおりです。均等に分けるには「交互」か「使用量が最少のものを優先」を選んでください。残高切れは 30 分、枠切れはリセットまで、レート制限はベンダーの指定どおり休み、失敗したものは 1 分、失敗が続くたびに長く休みます。", "{user} is first in the order; {routing} still goes by each account's quota, so the order only settles ties. In order uses the first first.": "{user} が順番の先頭になりました。{routing} は引き続き各アカウントの枠で選ぶため、順番は条件が同じときだけ効きます。先頭から使い切るには「順番」を選んでください。", "In order": "順番", @@ -13313,7 +13313,7 @@ const I18N = { "Speed first: {who} hasn't answered {model} lately, so it takes this request to be measured \u2014 one request in five goes to one not measured.": "速度優先:{who} は最近 {model} に応答していないため、測るためにこのリクエストを受けます。5 件に 1 件は測っていないものに回ります。", "Speed first: none has answered {model} lately, so {who}, first in the list, goes first and its answer measures it.": "速度優先:最近 {model} に応答したものがないため、並び順で最初の {who} が先に使われ、その応答で速さを測ります。", "Free quota by expiry": "無料枠を期限順に", - "Free quota by expiry: the accounts on a free plan, or whose model costs nothing there, go first, the one whose free quota is lost soonest first — at its next reset, or when its credits expire if sooner; once it is used up, the next. A paid one takes requests only when no free one has quota left, the paid as Smart orders them.": "無料枠を期限順に:無料プランのアカウントや、そこではモデルが無料のものを先に使い、そのうち無料枠が最も早く失われるものから使います——次のリセット時、またはクレジットの期限がそれより早ければその時です。使い切ったら次へ。有料のものは、どの無料のものにも枠が残っていないときだけ使い、有料どうしはスマートの順です。", + "Free quota by expiry: the accounts on a free plan, or whose model costs nothing there, go first, the one whose free quota is lost soonest first — at its next reset, or when its credits expire if sooner; once it is used up, the next. A paid one takes requests only when no free one has quota left, the paid as Quota first orders them.": "無料枠を期限順に:無料プランのアカウントや、そこではモデルが無料のものを先に使い、そのうち無料枠が最も早く失われるものから使います——次のリセット時、またはクレジットの期限がそれより早ければその時です。使い切ったら次へ。有料のものは、どの無料のものにも枠が残っていないときだけ使い、有料どうしは枠優先の順です。", "its free quota is lost soonest, in {d}.": "無料枠が最も早く失われます(残り {d})。", "Free quota by expiry: {who}'s free quota is lost soonest, in {d}, so it's spent first.": "無料枠を期限順に:{who} の無料枠が最も早く失われる(残り {d})ので、先に使います。", "it has free quota left, so it's spent before any paid one.": "無料枠が残っているので、有料のものより先に使います。", @@ -13330,7 +13330,7 @@ const I18N = { "Cheapest first: no price is known for {model} on {who}, so it goes in its listed place after every one that has a price.": "最安優先:{who} での {model} の価格が分からないため、価格のあるものすべての後ろ、設定順の位置に入ります。", "Small context first": "小さいコンテキスト優先", "Small context first: each request goes to the member with the smallest context window that holds it, so the big ones are kept for long requests; one whose window it is longer than is left out.": "小さいコンテキスト優先:各リクエストは、それが収まる中でコンテキストウィンドウが最も小さいメンバーに送られ、大きいものは長いリクエストのために残します。ウィンドウより長いリクエストはそのメンバーに送りません。", - "Small context first: each request goes to the member with the smallest context window that holds it, so the big ones are kept for long requests; a member whose window the request is longer than is left out. Members of one size go as Smart orders them, and one whose window isn't known goes last.": "小さいコンテキスト優先:各リクエストは、それが収まる中でコンテキストウィンドウが最も小さいメンバーに送られ、大きいものは長いリクエストのために残します。リクエストがウィンドウより長いメンバーは外します。同じ大きさのメンバーはスマートの順で、ウィンドウが分からないものは最後です。", + "Small context first: each request goes to the member with the smallest context window that holds it, so the big ones are kept for long requests; a member whose window the request is longer than is left out. Members of one size go as Quota first orders them, and one whose window isn't known goes last.": "小さいコンテキスト優先:各リクエストは、それが収まる中でコンテキストウィンドウが最も小さいメンバーに送られ、大きいものは長いリクエストのために残します。リクエストがウィンドウより長いメンバーは外します。同じ大きさのメンバーは枠優先の順で、ウィンドウが分からないものは最後です。", "its {n} context window is the smallest that holds this request.": "{n} のコンテキストウィンドウが、このリクエストが収まる最小のものです。", "Small context first: {who}'s {n} context window is the smallest that holds this request.": "小さいコンテキスト優先:{who} の {n} のコンテキストウィンドウが、このリクエストが収まる最小のものです。", "Small context first: no member with a known context window can take this request, so {who} is next.": "小さいコンテキスト優先:ウィンドウの分かるメンバーではこのリクエストを受けられないため、次は {who} です。", @@ -17720,7 +17720,7 @@ const I18N = { "Send each request's traces and metrics to an OpenTelemetry collector, such as Langfuse": "Traces und Metriken jeder Anfrage an einen OpenTelemetry-Collector senden, etwa Langfuse", "Sending to a collector": "Sendet an einen Collector", "Routing strategies": "Routing-Strategien", - "The routings besides Smart: In order, Until used up, In turn, Least used first, Use before expiry, By weight, Free first, Speed first and Cheapest first": "Die Routings neben Intelligent: Der Reihe nach, Bis aufgebraucht, Abwechselnd, Am wenigsten genutzte zuerst, Vor Ablauf aufbrauchen, Nach Gewicht, Kostenlos zuerst, Schnellste zuerst und Günstigste zuerst", + "The routings besides Quota first: In order, Until used up, In turn, Least used first, Use before expiry, By weight, Free first, Speed first and Cheapest first": "Die Routings neben Kontingent zuerst: Der Reihe nach, Bis aufgebraucht, Abwechselnd, Am wenigsten genutzte zuerst, Vor Ablauf aufbrauchen, Nach Gewicht, Kostenlos zuerst, Schnellste zuerst und Günstigste zuerst", "1 provider or group routed so": "1 Anbieter oder Gruppe so geroutet", "{n} providers and groups routed so": "{n} Anbieter und Gruppen so geroutet", "Run the JavaScript gateway plugins: middleware on agents' requests and replies, routings and usage observers": "Die JavaScript-Gateway-Plugins ausführen: Middleware auf Anfragen und Antworten der Agenten, Routings und Nutzungsbeobachter", @@ -18807,7 +18807,7 @@ const I18N = { "{agent} stays on this account even when it runs low. Requests through magpie still follow Routing.": "{agent} bleibt bei diesem Konto, auch wenn es knapp wird. Anfragen über magpie folgen weiter der „Weiterleitung“.", "{agent} stays signed in to the first account": "{agent} bleibt beim ersten Konto angemeldet", "magpie moves {agent} to an account with room again": "magpie wechselt {agent} wieder zu einem Konto mit freiem Kontingent", - "Smart": "Intelligent", + "Quota first": "Kontingent zuerst", "Not load balancing: every request, new conversations too, goes to the one account whose quota renews soonest, since what it has left is lost then, until it runs low or can't answer. Keys go in their order. To spread requests evenly, pick In turn or Least used first. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again.": "Kein Lastausgleich: Jede Anfrage, auch neuer Unterhaltungen, geht an das eine Konto, dessen Kontingent am frühesten zurückgesetzt wird (was es übrig hat, verfällt dann), bis es knapp wird oder nicht antworten kann. Schlüssel gehen der Reihe nach. Für gleichmäßige Verteilung „Abwechselnd“ oder „Am wenigsten genutzte zuerst“ wählen. Eines ohne Guthaben pausiert eine halbe Stunde, eines ohne Kontingent bis zum Zurücksetzen, eines mit Ratenlimit so lange, wie der Anbieter verlangt, und eines, das fehlschlägt, eine Minute, bei jedem weiteren Fehlschlag länger.", "{user} is first in the order; {routing} still goes by each account's quota, so the order only settles ties. In order uses the first first.": "{user} steht jetzt an erster Stelle; {routing} geht weiter nach dem Kontingent jedes Kontos, die Reihenfolge entscheidet nur bei Gleichstand. Der Reihe nach verbraucht zuerst das erste.", "In order": "Der Reihe nach", @@ -18830,7 +18830,7 @@ const I18N = { "Speed first: {who} hasn't answered {model} lately, so it takes this request to be measured \u2014 one request in five goes to one not measured.": "Schnellste zuerst: {who} hat {model} zuletzt nicht beantwortet und bekommt diese Anfrage, um gemessen zu werden — eine von fünf Anfragen geht an einen nicht Gemessenen.", "Speed first: none has answered {model} lately, so {who}, first in the list, goes first and its answer measures it.": "Schnellste zuerst: Keiner hat {model} zuletzt beantwortet, daher geht {who}, der Erste in der Liste, zuerst, und seine Antwort misst ihn.", "Free quota by expiry": "Gratiskontingent nach Ablauf", - "Free quota by expiry: the accounts on a free plan, or whose model costs nothing there, go first, the one whose free quota is lost soonest first — at its next reset, or when its credits expire if sooner; once it is used up, the next. A paid one takes requests only when no free one has quota left, the paid as Smart orders them.": "Gratiskontingent nach Ablauf: Konten mit einem Gratistarif, oder deren Modell dort nichts kostet, kommen zuerst, und zwar das, dessen Gratiskontingent am frühesten verfällt — bei seinem nächsten Zurücksetzen, oder wenn seine Guthaben früher ablaufen; ist es aufgebraucht, das nächste. Ein bezahltes nimmt Anfragen erst, wenn keinem Gratiskonto mehr Kontingent bleibt, die bezahlten in der Reihenfolge von Smart.", + "Free quota by expiry: the accounts on a free plan, or whose model costs nothing there, go first, the one whose free quota is lost soonest first — at its next reset, or when its credits expire if sooner; once it is used up, the next. A paid one takes requests only when no free one has quota left, the paid as Quota first orders them.": "Gratiskontingent nach Ablauf: Konten mit einem Gratistarif, oder deren Modell dort nichts kostet, kommen zuerst, und zwar das, dessen Gratiskontingent am frühesten verfällt — bei seinem nächsten Zurücksetzen, oder wenn seine Guthaben früher ablaufen; ist es aufgebraucht, das nächste. Ein bezahltes nimmt Anfragen erst, wenn keinem Gratiskonto mehr Kontingent bleibt, die bezahlten in der Reihenfolge von Smart.", "its free quota is lost soonest, in {d}.": "Sein Gratiskontingent verfällt am frühesten, in {d}.", "Free quota by expiry: {who}'s free quota is lost soonest, in {d}, so it's spent first.": "Gratiskontingent nach Ablauf: Das Gratiskontingent von {who} verfällt am frühesten, in {d}, also wird es zuerst verbraucht.", "it has free quota left, so it's spent before any paid one.": "Es hat noch Gratiskontingent, also wird es vor jedem bezahlten verbraucht.", @@ -18847,7 +18847,7 @@ const I18N = { "Cheapest first: no price is known for {model} on {who}, so it goes in its listed place after every one that has a price.": "Günstigste zuerst: Für {model} bei {who} ist kein Preis bekannt, daher kommt es an seinem Platz in der Liste hinter alle mit Preis.", "Small context first": "Kleiner Kontext zuerst", "Small context first: each request goes to the member with the smallest context window that holds it, so the big ones are kept for long requests; one whose window it is longer than is left out.": "Kleiner Kontext zuerst: Jede Anfrage geht an das Mitglied mit dem kleinsten Kontextfenster, in das sie passt, sodass die großen für lange Anfragen bleiben; eines, dessen Fenster sie übersteigt, wird ausgelassen.", - "Small context first: each request goes to the member with the smallest context window that holds it, so the big ones are kept for long requests; a member whose window the request is longer than is left out. Members of one size go as Smart orders them, and one whose window isn't known goes last.": "Kleiner Kontext zuerst: Jede Anfrage geht an das Mitglied mit dem kleinsten Kontextfenster, in das sie passt, sodass die großen für lange Anfragen bleiben; ein Mitglied, dessen Fenster die Anfrage übersteigt, wird ausgelassen. Mitglieder gleicher Größe gehen in der Reihenfolge von „Intelligent“, eines mit unbekanntem Fenster zuletzt.", + "Small context first: each request goes to the member with the smallest context window that holds it, so the big ones are kept for long requests; a member whose window the request is longer than is left out. Members of one size go as Quota first orders them, and one whose window isn't known goes last.": "Kleiner Kontext zuerst: Jede Anfrage geht an das Mitglied mit dem kleinsten Kontextfenster, in das sie passt, sodass die großen für lange Anfragen bleiben; ein Mitglied, dessen Fenster die Anfrage übersteigt, wird ausgelassen. Mitglieder gleicher Größe gehen in der Reihenfolge von „Kontingent zuerst“, eines mit unbekanntem Fenster zuletzt.", "its {n} context window is the smallest that holds this request.": "sein Kontextfenster von {n} ist das kleinste, in das diese Anfrage passt.", "Small context first: {who}'s {n} context window is the smallest that holds this request.": "Kleiner Kontext zuerst: Das Kontextfenster von {who} mit {n} ist das kleinste, in das diese Anfrage passt.", "Small context first: no member with a known context window can take this request, so {who} is next.": "Kleiner Kontext zuerst: Kein Mitglied mit bekanntem Kontextfenster kann diese Anfrage annehmen, daher ist {who} als Nächstes dran.", diff --git a/internal/gui/assets/plugins/routing/client.js b/internal/gui/assets/plugins/routing/client.js index 9edf74d3b..4bcc53ac2 100644 --- a/internal/gui/assets/plugins/routing/client.js +++ b/internal/gui/assets/plugins/routing/client.js @@ -782,7 +782,7 @@ function routingPage(part) { const tryOk = (tr) => tr.status < 400 && !tr.fail; const API = { anthropic: "Anthropic", chat: "OpenAI", responses: "OpenAI Responses", gemini: "Gemini" }; const MODES = { - "": ["Smart", "Smart: of the accounts with quota to spare, the one whose allowance renews soonest goes first — what it has left would be lost at the reset. The week decides; an account with five hours and no week goes by its five hours, and one whose month its weeks can no longer use up before it renews by its week. One at 90% or more waits until the others can't answer; one resting after a failure goes last."], + "": ["Quota first", "Quota first: of the accounts with quota to spare, the one whose allowance renews soonest goes first — what it has left would be lost at the reset. The week decides; an account with five hours and no week goes by its five hours, and one whose month its weeks can no longer use up before it renews by its week. One at 90% or more waits until the others can't answer; one resting after a failure goes last."], order: ["In order", "In order: the first answers everything until it can't; then the next."], drain: ["Until used up", "Until used up: one answers everything until its quota is used up; then the next, which keeps them even after the one before renews."], // the unit that goes round is the user's message (Wing8Aqua on X) @@ -796,7 +796,7 @@ function routingPage(part) { weight: ["By weight", "Requests spread over the keys or accounts by the weight set beside each: one weighing 3 takes three requests for every one weighing 1 takes, evenly over a few requests. One that fails is passed over while it rests, and the others share its requests; a conversation stays with it as Stays says."], free: ["Free first", "Requests go to what costs nothing first: the models their vendor serves at no cost to this subscription's allowance or credits, in their listed order, and only when those can't answer to one that spends them. Nothing that cost nothing is left unused."], cheap: ["Cheapest first", "Requests go to the member whose model costs least now, by its price a million tokens in and out at this hour — a vendor's peak hours count double where it bills them so, as DeepSeek and Ollama Cloud do — and the cheaper cache read when two cost the same; those that cost the same keep their listed order, and one with no known price goes last."], - expiring: ["Free quota by expiry", "Free quota by expiry: the accounts on a free plan, or whose model costs nothing there, go first, the one whose free quota is lost soonest first — at its next reset, or when its credits expire if sooner; once it is used up, the next. A paid one takes requests only when no free one has quota left, the paid as Smart orders them."], + expiring: ["Free quota by expiry", "Free quota by expiry: the accounts on a free plan, or whose model costs nothing there, go first, the one whose free quota is lost soonest first — at its next reset, or when its credits expire if sooner; once it is used up, the next. A paid one takes requests only when no free one has quota left, the paid as Quota first orders them."], fit: ["Small context first", "Small context first: each request goes to the member with the smallest context window that holds it, so the big ones are kept for long requests; one whose window it is longer than is left out."], fast: ["Speed first", "Requests go to the one that has answered this model fastest lately, by its time to the first token and how fast it writes; those within a tenth of each other keep their listed order. One not measured lately gets one request in five, so it is measured again, and one that fails is passed over while it rests."], }; @@ -810,7 +810,7 @@ function routingPage(part) { const GROUP_ORDER = "In order: member by member, the first model the group names until it can't answer, each over its own accounts or keys as its provider routes them."; // a group routed by weight (#1910): its members, not its keys const GROUP_WEIGHT = "By weight: each model takes its share of the requests by the weight set beside it — one weighing 3 three for every one a model weighing 1 takes, spread out rather than in bursts. One resting after a failure leaves the round and the others share its requests; the next model is the fallback when one fails."; - const KEYS_SMART = "Smart: keys that suit the request go first — one made for the model's own API — then in their order. One resting after a failure goes last."; + const KEYS_SMART = "Quota first: keys that suit the request go first — one made for the model's own API — then in their order. One resting after a failure goes last."; const LONE = "Only one account or key is on for this, so routing has nothing to choose between. Turn on a second in the provider's editor, and how it routes is set under Several accounts or keys below."; const agentOf = (id) => (state.clients || state.agents).find((a) => a.id === id); @@ -5261,7 +5261,7 @@ function routingPage(part) { // how it routes, only where it routes over several, and a way to // where that is set const ic = w.icon || w.preset || "generic", nm = w.name || w.provider; - const mode = poolOf(prov) ? t(w.kind === "key" && !w.routing ? "Smart" : modeOf(list.find((x) => x.w.provider === prov && !x.w.fallback)?.w.routing || "")[0]) : null; + const mode = poolOf(prov) ? t(w.kind === "key" && !w.routing ? "Quota first" : modeOf(list.find((x) => x.w.provider === prov && !x.w.fallback)?.w.routing || "")[0]) : null; // kept from one drawing to the next while it says the same: this // runs each second (countdown), and a new heading's asks // for its icon again whether or not patch keeps the old one, five @@ -6371,7 +6371,7 @@ function routingPage(part) { }; window.routingGroupsHome(); if (gHome()) byWidth(gHome(), { max520: (w) => w <= 520 }); - const ROUTE_OPTS = [["", "Smart"], ["order", "In order"], ["drain", "Until used up"], ["rotate", "In turn"], ["usage", "Least used first"], ["pace", "Use before expiry"], ["free", "Free first"], ["fast", "Speed first"]]; + const ROUTE_OPTS = [["", "Quota first"], ["order", "In order"], ["drain", "Until used up"], ["rotate", "In turn"], ["usage", "Least used first"], ["pace", "Use before expiry"], ["free", "Free first"], ["fast", "Speed first"]]; // a group may also be routed by hand: every request to the member the // user picks on its card (provider.Manual, #317) — a provider's keys can't // and by its members' weights, as a provider's keys are (#1910) @@ -6429,7 +6429,7 @@ function routingPage(part) { strict: "A conversation stays with the account or key that answered it and never moves to another, even past its usage cap: when that one is rate limited or out of quota, the error goes to the agent. New conversations are routed as usual.", }; const GROUP_HINT = { - "": "Smart, over the members' accounts and keys together: of the subscriptions with quota to spare, the one whose allowance renews soonest goes first — the week decides, and an account with five hours and no week (Claude Enterprise) goes by its five hours, so ahead of every week renewing later, and one whose month its weeks can no longer use up before it renews by its week; one resting after a failure goes last.", + "": "Quota first, over the members' accounts and keys together: of the subscriptions with quota to spare, the one whose allowance renews soonest goes first — the week decides, and an account with five hours and no week (Claude Enterprise) goes by its five hours, so ahead of every week renewing later, and one whose month its weeks can no longer use up before it renews by its week; one resting after a failure goes last.", order: "In order: the first model until it can't answer, then the next — each over its own accounts or keys as its provider routes them.", drain: "Until used up: one account or key, across the members, takes every request until it is used up; then the next in the list, which keeps them even after an earlier one renews. One rate limited or failing is passed over only while it rests.", rotate: "In turn: each message you send goes to the next member's account or key, round the list; the agent's tool calls for it stay on the same one. A move costs some prompt cache; with Stays on Session, a whole conversation stays on one instead.", @@ -6439,15 +6439,15 @@ function routingPage(part) { free: "Free first: the members whose model its vendor serves at no cost to the subscription's allowance or credits go first, then the rest — each whole, over its own accounts or keys as its provider routes them. The free ones are tried before any that spends, so nothing that costs nothing is left unused.", fast: "Speed first: the member that answered fastest lately goes first, by its time to the first token and how fast it writes, each of its accounts or keys weighed on its own; those within a tenth keep their listed order, and one not measured lately gets one request in five, so it is measured again.", cheap: "Cheapest first: the member whose model costs least now goes first, by its price a million tokens in and out at this hour — so a model billed double in its vendor's peak hours, as DeepSeek's own API and Ollama Cloud's DeepSeek models are, goes behind a provider charging less then, and ahead of it off-peak. Those that cost the same keep their listed order; one with no known price goes last.", - expiring: "Free quota by expiry: the accounts on a free plan, or whose model costs nothing there, go first, the one whose free quota is lost soonest first — at its next reset, or when its credits expire if sooner; once it is used up, the next. A paid one takes requests only when no free one has quota left, the paid as Smart orders them.", - fit: "Small context first: each request goes to the member with the smallest context window that holds it, so the big ones are kept for long requests; a member whose window the request is longer than is left out. Members of one size go as Smart orders them, and one whose window isn't known goes last.", + expiring: "Free quota by expiry: the accounts on a free plan, or whose model costs nothing there, go first, the one whose free quota is lost soonest first — at its next reset, or when its credits expire if sooner; once it is used up, the next. A paid one takes requests only when no free one has quota left, the paid as Quota first orders them.", + fit: "Small context first: each request goes to the member with the smallest context window that holds it, so the big ones are kept for long requests; a member whose window the request is longer than is left out. Members of one size go as Quota first orders them, and one whose window isn't known goes last.", manual: "Manual: every request goes to the model you pick on the group's card, over its own accounts or keys; the others, and the rules, wait until you pick another — none takes over when it fails.", }; // a group in the group, and a provider set to route other than Smart, is // routed by its own routing, whatever this one's (planLevel, #576, // ownRouting); a group in it left on Smart takes this one's where this // one pools (provider.Group.Within, #3847) - const GROUP_NEST = "A group among the models, and a model whose provider routes its accounts or keys other than Smart, keeps its own routing: this group only picks between it and the others, weighing it by the account or key it would try first, then tries it whole in its own order. A group among the models left on Smart is routed as this group is, unless this one goes In order, By weight or Manual."; + const GROUP_NEST = "A group among the models, and a model whose provider routes its accounts or keys other than Quota first, keeps its own routing: this group only picks between it and the others, weighing it by the account or key it would try first, then tries it whole in its own order. A group among the models left on Quota first is routed as this group is, unless this one goes In order, By weight or Manual."; const EFFORTS = ["low", "medium", "high", "xhigh", "max"]; // provider.Efforts // what a rule matches, in words function ruleText(r) { @@ -8736,7 +8736,7 @@ function routingPage(part) { rHint2.textContent = d.members.length < 2 ? t("With two models or more, a rule can send some turns to one of them first.") : d.routing === "manual" ? t("The rules wait while you pick the model by hand.") : none ? (d.routing ? t("No rules: the members go by the routing set under Advanced, {mode}; if one fails, the next takes over.", { mode: t((GROUP_ROUTE_OPTS.find((o) => o[0] === d.routing) || ["", d.routing])[1]) }) - : t("No rules: Smart routing. The member whose allowance renews soonest goes first, ties in the listed order; if it fails, the next takes over.")) : ""; + : t("No rules: Quota first, which doesn't judge how hard a task is. The member whose allowance renews soonest goes first, ties in the listed order; if it fails, the next takes over.")) : ""; rHint2.hidden = !rHint2.textContent; let focus = null; d.rules.forEach((r, i) => { diff --git a/internal/gui/assets/plugins/routing/i18n.js b/internal/gui/assets/plugins/routing/i18n.js index 79522adb1..415a7dd0c 100644 --- a/internal/gui/assets/plugins/routing/i18n.js +++ b/internal/gui/assets/plugins/routing/i18n.js @@ -403,7 +403,7 @@ magpie.strings({ "As a turn begins, Jev is asked once which of the intents the message is, and how hard the turn is when it picks the effort. An intent it isn't sure of matches no rule. Its calls show in the usage as magpie’s own.": "每轮开始时问 Jev 一次消息意图;若由它选推理强度,同时问本轮难度。没把握的意图不命中任何规则。其调用在用量中记为 magpie 自身的。", "It was told turn {prev} reasoned at {level}, which a message that only carries on from it needs too.": "并告知它第 {prev} 轮按 {level} 推理,仅承接上一轮的消息也需同等强度。", "Add an example rule": "添加示例规则", - "No rules: Smart routing. The member whose allowance renews soonest goes first, ties in the listed order; if it fails, the next takes over.": "没有规则:按智能路由。额度最先重置的成员优先,相同则按列表顺序;失败时由下一个接手。", + "No rules: Quota first, which doesn't judge how hard a task is. The member whose allowance renews soonest goes first, ties in the listed order; if it fails, the next takes over.": "没有规则:额度优先,不判断任务难易。额度最先重置的成员优先,相同则按列表顺序;失败时由下一个接手。", "No rules: the members go by the routing set under Advanced, {mode}; if one fails, the next takes over.": "没有规则:成员按高级里设置的路由({mode})排序;失败时由下一个接手。", "planning, design, or a hard problem to think through": "规划、设计,或需要深入思考的难题", "With two models or more, a rule can send some turns to one of them first.": "组内有两个及以上模型时,可用规则将某些轮次先发给其中一个。", @@ -435,12 +435,12 @@ magpie.strings({ "each provider routes over its own": "各供应商在自己的账号或 Key 间路由", "Change how {name} routes": "改 {name} 的路由方式", "Only one account or key is on for this, so routing has nothing to choose between. Turn on a second in the provider's editor, and how it routes is set under Several accounts or keys below.": "这里只开了一个账号或 Key,路由没有可选的。在供应商的编辑页再开一个,路由方式就在下面的「多账号 / 多 Key」里设置。", - "Smart, over the members' accounts and keys together: of the subscriptions with quota to spare, the one whose allowance renews soonest goes first — the week decides, and an account with five hours and no week (Claude Enterprise) goes by its five hours, so ahead of every week renewing later, and one whose month its weeks can no longer use up before it renews by its week; one resting after a failure goes last.": "智能:成员的账号和 Key 统一排序。有余量的订阅中额度最先重置的排第一,以周额度为准;只有 5 小时额度的账号(如 Claude Enterprise)按 5 小时重置,排在更晚重置的周额度之前;月额度已来不及靠每周额度用完的按周重置;失败后休息中的排最后。", + "Quota first, over the members' accounts and keys together: of the subscriptions with quota to spare, the one whose allowance renews soonest goes first — the week decides, and an account with five hours and no week (Claude Enterprise) goes by its five hours, so ahead of every week renewing later, and one whose month its weeks can no longer use up before it renews by its week; one resting after a failure goes last.": "额度优先:成员的账号和 Key 统一排序。有余量的订阅中额度最先重置的排第一,以周额度为准;只有 5 小时额度的账号(如 Claude Enterprise)按 5 小时重置,排在更晚重置的周额度之前;月额度已来不及靠每周额度用完的按周重置;失败后休息中的排最后。", "In order: the first model until it can't answer, then the next — each over its own accounts or keys as its provider routes them.": "按顺序:先用第一个模型,无法响应再换下一个;各成员按其供应商的路由在自己的账号或 Key 间分配。", "In turn: each message you send goes to the next member's account or key, round the list; the agent's tool calls for it stay on the same one. A move costs some prompt cache; with Stays on Session, a whole conversation stays on one instead.": "轮流:你每发一条消息,就按列表顺序交给下一个成员的账号或 Key;Agent 为这条消息做的工具调用留在同一个上。每换一次会损失部分提示词缓存;会话保持选「整个会话」时,改为整个会话固定在一个上。", "Least used first: the account or key with the most of its allowance left goes first.": "最少使用优先:剩余额度最多的账号或 Key 排第一。", "Use before expiry: the account with the most left per hour until it is lost goes first — its week at its reset, or credits in it that expire sooner — so less of each member's allowance is lost; an account with five hours and no week (Claude Enterprise) by what its five hours have left per hour until they renew, so almost always first; a key by the tokens magpie sent it lately.": "到期前用完:按剩余额度 ÷ 距作废小时数排序,越高越先用——周额度在重置时作废,更早过期的积分按过期时间算。只有 5 小时额度的账号(如 Claude Enterprise)按 5 小时窗口计算,几乎总排第一;Key 按最近发给它的 token 数排。", - "A group among the models, and a model whose provider routes its accounts or keys other than Smart, keeps its own routing: this group only picks between it and the others, weighing it by the account or key it would try first, then tries it whole in its own order. A group among the models left on Smart is routed as this group is, unless this one goes In order, By weight or Manual.": "成员中的路由组,以及服务商路由不是“智能”的模型,都保留自己的路由:本组只在它与其他成员间选择(按它会先用的账号或 Key 比较),选中后按其自身顺序整体尝试。成员中路由留在“智能”的路由组,按本组的路由走,除非本组是“按顺序”“按权重”或“手动”。", + "A group among the models, and a model whose provider routes its accounts or keys other than Quota first, keeps its own routing: this group only picks between it and the others, weighing it by the account or key it would try first, then tries it whole in its own order. A group among the models left on Quota first is routed as this group is, unless this one goes In order, By weight or Manual.": "成员中的路由组,以及服务商路由不是“额度优先”的模型,都保留自己的路由:本组只在它与其他成员间选择(按它会先用的账号或 Key 比较),选中后按其自身顺序整体尝试。成员中路由留在“额度优先”的路由组,按本组的路由走,除非本组是“按顺序”“按权重”或“手动”。", "errors your agent saw": "Agent 收到的错误", "It said: {error}": "原话:{error}", "Copilot's Auto picked {model} ({via})": "Copilot 的 Auto 选了 {model}({via})", @@ -503,8 +503,8 @@ magpie.strings({ "Another magpie serves the gateway; its routing plays live in that magpie's window.": "网关由另一个 magpie 提供,它的路由在那个 magpie 的窗口里实时播放。", "The gateway isn't running, so nothing is routed.": "网关没有运行,因此没有任何路由。", "The gateway is served by a magpie without a window (magpie serve), so its routing can't be watched. Stop it and let this magpie serve the gateway to see routing live.": "网关由无窗口的 magpie(magpie serve)提供,无法在此查看路由。停止它并由当前 magpie 提供网关,即可实时查看。", - "Smart: of the accounts with quota to spare, the one whose allowance renews soonest goes first — what it has left would be lost at the reset. The week decides; an account with five hours and no week goes by its five hours, and one whose month its weeks can no longer use up before it renews by its week. One at 90% or more waits until the others can't answer; one resting after a failure goes last.": "智能:有余量的账号中额度最先重置的排第一,以免剩余额度在重置时作废。以周额度为准;只有 5 小时额度的账号按 5 小时重置,月额度已来不及靠每周额度用完的按周重置。用到 90% 以上的,等其他都无法响应时才用;失败后休息中的排最后。", - "Smart: keys that suit the request go first — one made for the model's own API — then in their order. One resting after a failure goes last.": "智能:适合此请求的 Key(为该模型原生 API 准备的)排前,其余按顺序。失败后休息中的排最后。", + "Quota first: of the accounts with quota to spare, the one whose allowance renews soonest goes first — what it has left would be lost at the reset. The week decides; an account with five hours and no week goes by its five hours, and one whose month its weeks can no longer use up before it renews by its week. One at 90% or more waits until the others can't answer; one resting after a failure goes last.": "额度优先:有余量的账号中额度最先重置的排第一,以免剩余额度在重置时作废。以周额度为准;只有 5 小时额度的账号按 5 小时重置,月额度已来不及靠每周额度用完的按周重置。用到 90% 以上的,等其他都无法响应时才用;失败后休息中的排最后。", + "Quota first: keys that suit the request go first — one made for the model's own API — then in their order. One resting after a failure goes last.": "额度优先:适合此请求的 Key(为该模型原生 API 准备的)排前,其余按顺序。失败后休息中的排最后。", "In order: the first answers everything until it can't; then the next.": "按顺序:第一个处理所有请求,无法响应时再换下一个。", "In turn: each message you send goes to the next account, round the list; the agent's tool calls for it stay on the same one. With Stays on Session, a whole conversation stays on one instead.": "轮流:你每发一条消息,就按列表顺序交给下一个账号;Agent 为这条消息做的工具调用留在同一个上。会话保持选「整个会话」时,改为整个会话固定在一个上。", "Least used first: the account with the most of its allowance left goes first; a key by the tokens magpie sent it lately.": "最少使用优先:剩余额度最多的账号排第一;Key 按 magpie 最近发给它的 token 数排。", @@ -1173,7 +1173,7 @@ magpie.strings({ "As a turn begins, Jev is asked once which of the intents the message is, and how hard the turn is when it picks the effort. An intent it isn't sure of matches no rule. Its calls show in the usage as magpie’s own.": "每輪開始時問 Jev 一次訊息意圖;若由它選推理強度,同時問本輪難度。沒把握的意圖不命中任何規則。其呼叫在用量中記為 magpie 自身的。", "It was told turn {prev} reasoned at {level}, which a message that only carries on from it needs too.": "並告知它第 {prev} 輪按 {level} 推理,僅承接上一輪的訊息也需同等強度。", "Add an example rule": "新增範例規則", - "No rules: Smart routing. The member whose allowance renews soonest goes first, ties in the listed order; if it fails, the next takes over.": "沒有規則:依智慧路由。額度最先重置的成員優先,相同則依清單順序;失敗時由下一個接手。", + "No rules: Quota first, which doesn't judge how hard a task is. The member whose allowance renews soonest goes first, ties in the listed order; if it fails, the next takes over.": "沒有規則:額度優先,不判斷任務難易。額度最先重置的成員優先,相同則依清單順序;失敗時由下一個接手。", "No rules: the members go by the routing set under Advanced, {mode}; if one fails, the next takes over.": "沒有規則:成員依進階中設定的路由({mode})排序;失敗時由下一個接手。", "planning, design, or a hard problem to think through": "規劃、設計,或需要深入思考的難題", "With two models or more, a rule can send some turns to one of them first.": "組內有兩個及以上模型時,可用規則將某些輪次先發給其中一個。", @@ -1205,12 +1205,12 @@ magpie.strings({ "each provider routes over its own": "各供應商在自己的帳號或 Key 間路由", "Change how {name} routes": "改 {name} 的路由方式", "Only one account or key is on for this, so routing has nothing to choose between. Turn on a second in the provider's editor, and how it routes is set under Several accounts or keys below.": "這裡只開了一個帳號或 Key,路由沒有可選的。在供應商的編輯頁再開一個,路由方式就在下面的「多帳號 / 多 Key」裡設定。", - "Smart, over the members' accounts and keys together: of the subscriptions with quota to spare, the one whose allowance renews soonest goes first — the week decides, and an account with five hours and no week (Claude Enterprise) goes by its five hours, so ahead of every week renewing later, and one whose month its weeks can no longer use up before it renews by its week; one resting after a failure goes last.": "智慧:成員的帳號和 Key 統一排序。有餘量的訂閱中額度最先重置的排第一,以週額度為準;只有 5 小時額度的帳號(如 Claude Enterprise)按 5 小時重置,排在更晚重置的週額度之前;月額度已來不及靠每週額度用完的按週重置;失敗後休息中的排最後。", + "Quota first, over the members' accounts and keys together: of the subscriptions with quota to spare, the one whose allowance renews soonest goes first — the week decides, and an account with five hours and no week (Claude Enterprise) goes by its five hours, so ahead of every week renewing later, and one whose month its weeks can no longer use up before it renews by its week; one resting after a failure goes last.": "額度優先:成員的帳號和 Key 統一排序。有餘量的訂閱中額度最先重置的排第一,以週額度為準;只有 5 小時額度的帳號(如 Claude Enterprise)按 5 小時重置,排在更晚重置的週額度之前;月額度已來不及靠每週額度用完的按週重置;失敗後休息中的排最後。", "In order: the first model until it can't answer, then the next — each over its own accounts or keys as its provider routes them.": "按順序:先用第一個模型,無法回應再換下一個;各成員按其供應商的路由在自己的帳號或 Key 間分配。", "In turn: each message you send goes to the next member's account or key, round the list; the agent's tool calls for it stay on the same one. A move costs some prompt cache; with Stays on Session, a whole conversation stays on one instead.": "輪流:你每發一則訊息,就按清單順序交給下一個成員的帳號或 Key;Agent 為這則訊息做的工具呼叫留在同一個上。每換一次會損失部分提示詞快取;會話保持選「整個會話」時,改為整個會話固定在一個上。", "Least used first: the account or key with the most of its allowance left goes first.": "最少使用優先:剩餘額度最多的帳號或 Key 排第一。", "Use before expiry: the account with the most left per hour until it is lost goes first — its week at its reset, or credits in it that expire sooner — so less of each member's allowance is lost; an account with five hours and no week (Claude Enterprise) by what its five hours have left per hour until they renew, so almost always first; a key by the tokens magpie sent it lately.": "到期前用完:按剩餘額度 ÷ 距作廢小時數排序,越高越先用——週額度在重置時作廢,更早過期的點數按過期時間算。只有 5 小時額度的帳號(如 Claude Enterprise)按 5 小時時段計算,幾乎總排第一;Key 按最近發給它的 token 數排。", - "A group among the models, and a model whose provider routes its accounts or keys other than Smart, keeps its own routing: this group only picks between it and the others, weighing it by the account or key it would try first, then tries it whole in its own order. A group among the models left on Smart is routed as this group is, unless this one goes In order, By weight or Manual.": "成員中的路由組,以及服務商路由不是「智慧」的模型,都保留自己的路由:本組只在它與其他成員間選擇(按它會先用的帳號或 Key 比較),選中後按其自身順序整體嘗試。成員中路由留在「智慧」的路由組,按本組的路由走,除非本組是「按順序」「按權重」或「手動」。", + "A group among the models, and a model whose provider routes its accounts or keys other than Quota first, keeps its own routing: this group only picks between it and the others, weighing it by the account or key it would try first, then tries it whole in its own order. A group among the models left on Quota first is routed as this group is, unless this one goes In order, By weight or Manual.": "成員中的路由組,以及服務商路由不是「額度優先」的模型,都保留自己的路由:本組只在它與其他成員間選擇(按它會先用的帳號或 Key 比較),選中後按其自身順序整體嘗試。成員中路由留在「額度優先」的路由組,按本組的路由走,除非本組是「按順序」「按權重」或「手動」。", "errors your agent saw": "Agent 收到的錯誤", "It said: {error}": "原話:{error}", "Copilot's Auto picked {model} ({via})": "Copilot 的 Auto 選了 {model}({via})", @@ -1273,8 +1273,8 @@ magpie.strings({ "Another magpie serves the gateway; its routing plays live in that magpie's window.": "閘道由另一個 magpie 提供,它的路由在那個 magpie 的窗口裡即時播放。", "The gateway isn't running, so nothing is routed.": "閘道沒有執行,因此沒有任何路由。", "The gateway is served by a magpie without a window (magpie serve), so its routing can't be watched. Stop it and let this magpie serve the gateway to see routing live.": "閘道由無視窗的 magpie(magpie serve)提供,無法在此檢視路由。停止它並由目前 magpie 提供閘道,即可即時檢視。", - "Smart: of the accounts with quota to spare, the one whose allowance renews soonest goes first — what it has left would be lost at the reset. The week decides; an account with five hours and no week goes by its five hours, and one whose month its weeks can no longer use up before it renews by its week. One at 90% or more waits until the others can't answer; one resting after a failure goes last.": "智慧:有餘量的帳號中額度最先重置的排第一,以免剩餘額度在重置時作廢。以週額度為準;只有 5 小時額度的帳號按 5 小時重置,月額度已來不及靠每週額度用完的按週重置。用到 90% 以上的,等其他都無法回應時才用;失敗後休息中的排最後。", - "Smart: keys that suit the request go first — one made for the model's own API — then in their order. One resting after a failure goes last.": "智慧:適合此請求的 Key(為該模型原生 API 準備的)排前,其餘按順序。失敗後休息中的排最後。", + "Quota first: of the accounts with quota to spare, the one whose allowance renews soonest goes first — what it has left would be lost at the reset. The week decides; an account with five hours and no week goes by its five hours, and one whose month its weeks can no longer use up before it renews by its week. One at 90% or more waits until the others can't answer; one resting after a failure goes last.": "額度優先:有餘量的帳號中額度最先重置的排第一,以免剩餘額度在重置時作廢。以週額度為準;只有 5 小時額度的帳號按 5 小時重置,月額度已來不及靠每週額度用完的按週重置。用到 90% 以上的,等其他都無法回應時才用;失敗後休息中的排最後。", + "Quota first: keys that suit the request go first — one made for the model's own API — then in their order. One resting after a failure goes last.": "額度優先:適合此請求的 Key(為該模型原生 API 準備的)排前,其餘按順序。失敗後休息中的排最後。", "In order: the first answers everything until it can't; then the next.": "按順序:第一個處理所有請求,無法回應時再換下一個。", "In turn: each message you send goes to the next account, round the list; the agent's tool calls for it stay on the same one. With Stays on Session, a whole conversation stays on one instead.": "輪流:你每發一則訊息,就按清單順序交給下一個帳號;Agent 為這則訊息做的工具呼叫留在同一個上。會話保持選「整個會話」時,改為整個會話固定在一個上。", "Least used first: the account with the most of its allowance left goes first; a key by the tokens magpie sent it lately.": "最少使用優先:剩餘額度最多的帳號排第一;Key 按 magpie 最近發給它的 token 數排。", @@ -1941,7 +1941,7 @@ magpie.strings({ "As a turn begins, Jev is asked once which of the intents the message is, and how hard the turn is when it picks the effort. An intent it isn't sure of matches no rule. Its calls show in the usage as magpie’s own.": "ターンの開始時に、メッセージがどのインテントに当たるかと、推論レベルを選ぶ場合はターンの難しさを、Jev に 1 回尋ねます。確信のないインテントはどのルールにも一致しません。その呼び出しは使用量に magpie 自身のものとして表示されます。", "It was told turn {prev} reasoned at {level}, which a message that only carries on from it needs too.": "ターン {prev} が {level} で推論したことも伝えています。それを続けるだけのメッセージも同じだけ必要です。", "Add an example rule": "例のルールを追加", - "No rules: Smart routing. The member whose allowance renews soonest goes first, ties in the listed order; if it fails, the next takes over.": "ルールなし:スマートルーティング。枠が最も早くリセットされるメンバーが先、同じなら一覧の順。失敗すると次が引き継ぎます。", + "No rules: Quota first, which doesn't judge how hard a task is. The member whose allowance renews soonest goes first, ties in the listed order; if it fails, the next takes over.": "ルールなし:枠優先。タスクの難しさは判断しません。枠が最も早くリセットされるメンバーが先、同じなら一覧の順。失敗すると次が引き継ぎます。", "No rules: the members go by the routing set under Advanced, {mode}; if one fails, the next takes over.": "ルールなし:メンバーは詳細設定のルーティング({mode})の順に使われます。失敗すると次が引き継ぎます。", "planning, design, or a hard problem to think through": "計画、設計、またはじっくり考える必要がある難問", "With two models or more, a rule can send some turns to one of them first.": "2 つ以上のモデルがあれば、ルールで一部のターンをそのうちの 1 つへ優先して送れます。", @@ -1973,12 +1973,12 @@ magpie.strings({ "each provider routes over its own": "各プロバイダが自身のアカウントやキーでルーティング", "Change how {name} routes": "{name} のルーティングを変更", "Only one account or key is on for this, so routing has nothing to choose between. Turn on a second in the provider's editor, and how it routes is set under Several accounts or keys below.": "有効なアカウントやキーが 1 つだけなので、ルーティングに選択肢はありません。プロバイダの編集画面で 2 つ目を有効にすると、ルーティングは下の「複数のアカウントやキー」で設定できます。", - "Smart, over the members' accounts and keys together: of the subscriptions with quota to spare, the one whose allowance renews soonest goes first — the week decides, and an account with five hours and no week (Claude Enterprise) goes by its five hours, so ahead of every week renewing later, and one whose month its weeks can no longer use up before it renews by its week; one resting after a failure goes last.": "スマート(メンバーのアカウントとキーをまとめて扱う):クォータに余裕のあるサブスクリプションのうち、利用枠のリセットが最も早いものが先頭です。週の枠で判断し、5 時間枠のみで週の枠がないアカウント(Claude Enterprise)は 5 時間枠で判断するため、それより後にリセットされるどの週の枠よりも前になります。月の枠をリセットまでに週の枠では使い切れなくなったものは週の枠で判断します。失敗後に休止中のものは最後です。", + "Quota first, over the members' accounts and keys together: of the subscriptions with quota to spare, the one whose allowance renews soonest goes first — the week decides, and an account with five hours and no week (Claude Enterprise) goes by its five hours, so ahead of every week renewing later, and one whose month its weeks can no longer use up before it renews by its week; one resting after a failure goes last.": "枠優先(メンバーのアカウントとキーをまとめて扱う):クォータに余裕のあるサブスクリプションのうち、利用枠のリセットが最も早いものが先頭です。週の枠で判断し、5 時間枠のみで週の枠がないアカウント(Claude Enterprise)は 5 時間枠で判断するため、それより後にリセットされるどの週の枠よりも前になります。月の枠をリセットまでに週の枠では使い切れなくなったものは週の枠で判断します。失敗後に休止中のものは最後です。", "In order: the first model until it can't answer, then the next — each over its own accounts or keys as its provider routes them.": "順番:先頭のモデルが応答できなくなるまで使い、その後次へ。各モデルはそのプロバイダのルーティングに従って自身のアカウントやキーを使います。", "In turn: each message you send goes to the next member's account or key, round the list; the agent's tool calls for it stay on the same one. A move costs some prompt cache; with Stays on Session, a whole conversation stays on one instead.": "交互:メッセージを送るたびに、リストの順で次のメンバーのアカウントやキーへ回します。そのメッセージのためのエージェントのツール呼び出しは同じものに残ります。移るたびにプロンプトキャッシュの一部を失います。維持を「セッション」にすると、会話全体が一つに留まります。", "Least used first: the account or key with the most of its allowance left goes first.": "使用量が最少を優先:利用枠の残りが最も多いアカウントやキーが先頭です。", "Use before expiry: the account with the most left per hour until it is lost goes first — its week at its reset, or credits in it that expire sooner — so less of each member's allowance is lost; an account with five hours and no week (Claude Enterprise) by what its five hours have left per hour until they renew, so almost always first; a key by the tokens magpie sent it lately.": "期限前に使い切る:失われるまでの 1 時間あたりの残りが最も多いアカウントが先頭になり、各メンバーの枠が失われる分が減ります — 週の枠はリセットで、それより早く期限切れになるクレジットはその期限で失われます。5 時間枠のみで週の枠がないアカウント(Claude Enterprise)は、リセットまでの 1 時間あたりの 5 時間枠の残りで判断するため、ほぼ常に先頭です。キーは magpie が最近送ったトークン数で判断します。", - "A group among the models, and a model whose provider routes its accounts or keys other than Smart, keeps its own routing: this group only picks between it and the others, weighing it by the account or key it would try first, then tries it whole in its own order. A group among the models left on Smart is routed as this group is, unless this one goes In order, By weight or Manual.": "モデルの中のグループと、プロバイダーのルーティングがスマート以外のモデルは、独自のルーティングを保ちます。このグループはそれと他のメンバーの間で選ぶだけで、そのグループが最初に試すアカウントやキーで比較し、選ばれたらそのグループ全体を独自の順番で試します。ルーティングをスマートのままにしたモデルの中のグループは、このグループのルーティングに従います。ただし、このグループが順番、重み付け、手動の場合を除きます。", + "A group among the models, and a model whose provider routes its accounts or keys other than Quota first, keeps its own routing: this group only picks between it and the others, weighing it by the account or key it would try first, then tries it whole in its own order. A group among the models left on Quota first is routed as this group is, unless this one goes In order, By weight or Manual.": "モデルの中のグループと、プロバイダーのルーティングが枠優先以外のモデルは、独自のルーティングを保ちます。このグループはそれと他のメンバーの間で選ぶだけで、そのグループが最初に試すアカウントやキーで比較し、選ばれたらそのグループ全体を独自の順番で試します。ルーティングを枠優先のままにしたモデルの中のグループは、このグループのルーティングに従います。ただし、このグループが順番、重み付け、手動の場合を除きます。", "errors your agent saw": "エージェントが受けたエラー", "It said: {error}": "メッセージ:{error}", "Copilot's Auto picked {model} ({via})": "Copilot の Auto が {model} を選択({via})", @@ -2041,8 +2041,8 @@ magpie.strings({ "Another magpie serves the gateway; its routing plays live in that magpie's window.": "ゲートウェイは別の magpie が提供しています。そのルーティングはその magpie のウィンドウでライブ再生されます。", "The gateway isn't running, so nothing is routed.": "ゲートウェイが実行されていないため、何もルーティングされません。", "The gateway is served by a magpie without a window (magpie serve), so its routing can't be watched. Stop it and let this magpie serve the gateway to see routing live.": "ゲートウェイはウィンドウのない magpie(magpie serve)が提供しているため、ルーティングを見ることができません。それを停止し、この magpie にゲートウェイを提供させるとルーティングをライブで見られます。", - "Smart: of the accounts with quota to spare, the one whose allowance renews soonest goes first — what it has left would be lost at the reset. The week decides; an account with five hours and no week goes by its five hours, and one whose month its weeks can no longer use up before it renews by its week. One at 90% or more waits until the others can't answer; one resting after a failure goes last.": "スマート:クォータに余裕のあるアカウントのうち、利用枠が最も早く更新されるものが先です — 残りはリセット時に失われるためです。週の枠で決まり、5 時間枠だけで週の枠がないアカウントは 5 時間枠で、月の枠を更新までに週の枠では使い切れなくなったアカウントは週の枠で決まります。90% 以上使ったアカウントは他が応答できなくなるまで待ち、失敗後に休止中のアカウントは最後になります。", - "Smart: keys that suit the request go first — one made for the model's own API — then in their order. One resting after a failure goes last.": "スマート:リクエストに合うキー — モデル本来の API 用のキー — が先で、その後は設定順です。失敗後に休止中のキーは最後になります。", + "Quota first: of the accounts with quota to spare, the one whose allowance renews soonest goes first — what it has left would be lost at the reset. The week decides; an account with five hours and no week goes by its five hours, and one whose month its weeks can no longer use up before it renews by its week. One at 90% or more waits until the others can't answer; one resting after a failure goes last.": "枠優先:クォータに余裕のあるアカウントのうち、利用枠が最も早く更新されるものが先です — 残りはリセット時に失われるためです。週の枠で決まり、5 時間枠だけで週の枠がないアカウントは 5 時間枠で、月の枠を更新までに週の枠では使い切れなくなったアカウントは週の枠で決まります。90% 以上使ったアカウントは他が応答できなくなるまで待ち、失敗後に休止中のアカウントは最後になります。", + "Quota first: keys that suit the request go first — one made for the model's own API — then in their order. One resting after a failure goes last.": "枠優先:リクエストに合うキー — モデル本来の API 用のキー — が先で、その後は設定順です。失敗後に休止中のキーは最後になります。", "In order: the first answers everything until it can't; then the next.": "順番:最初の 1 つが応答できなくなるまですべてに応答し、その後は次へ。", "In turn: each message you send goes to the next account, round the list; the agent's tool calls for it stay on the same one. With Stays on Session, a whole conversation stays on one instead.": "交互:メッセージを送るたびに、リストの順で次のアカウントへ回します。そのメッセージのためのエージェントのツール呼び出しは同じものに残ります。維持を「セッション」にすると、会話全体が一つに留まります。", "Least used first: the account with the most of its allowance left goes first; a key by the tokens magpie sent it lately.": "使用量が最少:利用枠の残りが最も多いアカウントが先です。キーは magpie が最近送ったトークン数で決まります。", @@ -2711,7 +2711,7 @@ magpie.strings({ "As a turn begins, Jev is asked once which of the intents the message is, and how hard the turn is when it picks the effort. An intent it isn't sure of matches no rule. Its calls show in the usage as magpie’s own.": "Zu Beginn einer Runde wird Jev einmal gefragt, welcher Absicht die Nachricht entspricht und, wenn es den Effort wählt, wie schwer die Runde ist. Eine Absicht, bei der es unsicher ist, trifft auf keine Regel zu. Seine Aufrufe erscheinen in der Nutzung als eigene von magpie.", "It was told turn {prev} reasoned at {level}, which a message that only carries on from it needs too.": "Ihm wurde mitgeteilt, dass Runde {prev} {level} Reasoning nutzte; eine Nachricht, die nur daran anknüpft, braucht das ebenso.", "Add an example rule": "Beispielregel hinzufügen", - "No rules: Smart routing. The member whose allowance renews soonest goes first, ties in the listed order; if it fails, the next takes over.": "Keine Regeln: Smart-Routing. Das Mitglied, dessen Kontingent am frühesten erneuert wird, kommt zuerst, bei Gleichstand die Reihenfolge der Liste; fällt es aus, übernimmt das nächste.", + "No rules: Quota first, which doesn't judge how hard a task is. The member whose allowance renews soonest goes first, ties in the listed order; if it fails, the next takes over.": "Keine Regeln: Kontingent zuerst, ohne die Schwierigkeit einer Aufgabe zu beurteilen. Das Mitglied, dessen Kontingent am frühesten erneuert wird, kommt zuerst, bei Gleichstand die Reihenfolge der Liste; fällt es aus, übernimmt das nächste.", "No rules: the members go by the routing set under Advanced, {mode}; if one fails, the next takes over.": "Keine Regeln: Die Mitglieder gehen nach dem unter Erweitert gesetzten Routing ({mode}); fällt eines aus, übernimmt das nächste.", "planning, design, or a hard problem to think through": "Planung, Entwurf oder ein schwieriges Problem zum Durchdenken", "With two models or more, a rule can send some turns to one of them first.": "Ab zwei Modellen kann eine Regel bestimmte Runden zuerst an eines davon senden.", @@ -2743,12 +2743,12 @@ magpie.strings({ "each provider routes over its own": "jeder Anbieter leitet über seine eigenen weiter", "Change how {name} routes": "Ändern, wie {name} weiterleitet", "Only one account or key is on for this, so routing has nothing to choose between. Turn on a second in the provider's editor, and how it routes is set under Several accounts or keys below.": "Hier ist nur ein Konto oder Schlüssel aktiv, also hat die Weiterleitung keine Wahl. Aktiviere im Editor des Anbieters ein zweites; wie weitergeleitet wird, legst du dann unten unter „Mehrere Konten oder Schlüssel“ fest.", - "Smart, over the members' accounts and keys together: of the subscriptions with quota to spare, the one whose allowance renews soonest goes first — the week decides, and an account with five hours and no week (Claude Enterprise) goes by its five hours, so ahead of every week renewing later, and one whose month its weeks can no longer use up before it renews by its week; one resting after a failure goes last.": "Intelligent, über Konten und Schlüssel aller Mitglieder zusammen: Von den Abos mit freiem Kontingent kommt das zuerst, dessen Kontingent sich am frühesten erneuert – die Woche entscheidet, und ein Konto mit fünf Stunden und ohne Woche (Claude Enterprise) richtet sich nach seinen fünf Stunden, also vor jeder später erneuerten Woche, und eines, dessen Monat seine Wochen vor der Erneuerung nicht mehr aufbrauchen können, nach seiner Woche; eines, das nach einem Fehler pausiert, kommt zuletzt.", + "Quota first, over the members' accounts and keys together: of the subscriptions with quota to spare, the one whose allowance renews soonest goes first — the week decides, and an account with five hours and no week (Claude Enterprise) goes by its five hours, so ahead of every week renewing later, and one whose month its weeks can no longer use up before it renews by its week; one resting after a failure goes last.": "Kontingent zuerst, über Konten und Schlüssel aller Mitglieder zusammen: Von den Abos mit freiem Kontingent kommt das zuerst, dessen Kontingent sich am frühesten erneuert – die Woche entscheidet, und ein Konto mit fünf Stunden und ohne Woche (Claude Enterprise) richtet sich nach seinen fünf Stunden, also vor jeder später erneuerten Woche, und eines, dessen Monat seine Wochen vor der Erneuerung nicht mehr aufbrauchen können, nach seiner Woche; eines, das nach einem Fehler pausiert, kommt zuletzt.", "In order: the first model until it can't answer, then the next — each over its own accounts or keys as its provider routes them.": "Der Reihe nach: das erste Modell, bis es nicht mehr antworten kann, dann das nächste – jedes über seine eigenen Konten oder Schlüssel, wie sein Anbieter sie weiterleitet.", "In turn: each message you send goes to the next member's account or key, round the list; the agent's tool calls for it stay on the same one. A move costs some prompt cache; with Stays on Session, a whole conversation stays on one instead.": "Abwechselnd: Jede Nachricht, die Sie senden, geht an das nächste Konto oder den nächsten Schlüssel der Mitglieder, reihum; die Tool-Aufrufe des Agenten dazu bleiben beim selben. Jeder Wechsel kostet etwas Prompt-Cache; mit Bleibt auf Sitzung bleibt eine ganze Unterhaltung bei einem.", "Least used first: the account or key with the most of its allowance left goes first.": "Am wenigsten genutzt zuerst: Das Konto oder der Schlüssel mit dem größten Restkontingent kommt zuerst.", "Use before expiry: the account with the most left per hour until it is lost goes first — its week at its reset, or credits in it that expire sooner — so less of each member's allowance is lost; an account with five hours and no week (Claude Enterprise) by what its five hours have left per hour until they renew, so almost always first; a key by the tokens magpie sent it lately.": "Vor Ablauf aufbrauchen: Das Konto mit dem meisten Rest pro Stunde, bis er verfällt, kommt zuerst – seine Woche beim Zurücksetzen oder Guthaben darin, das früher abläuft –, damit von jedem Mitglied weniger verfällt; ein Konto mit fünf Stunden und ohne Woche (Claude Enterprise) nach dem Rest seiner fünf Stunden pro Stunde bis zur Erneuerung, also fast immer zuerst; ein Schlüssel nach den Token, die magpie ihm zuletzt gesendet hat.", - "A group among the models, and a model whose provider routes its accounts or keys other than Smart, keeps its own routing: this group only picks between it and the others, weighing it by the account or key it would try first, then tries it whole in its own order. A group among the models left on Smart is routed as this group is, unless this one goes In order, By weight or Manual.": "Eine Gruppe unter den Modellen und ein Modell, dessen Anbieter seine Konten oder Schlüssel anders als „Intelligent“ weiterleitet, behalten ihre eigene Weiterleitung: Diese Gruppe wählt nur zwischen ihr und den anderen, gewichtet nach dem Konto oder Schlüssel, den sie zuerst versuchen würde, und versucht sie dann als Ganzes in ihrer eigenen Reihenfolge. Eine Gruppe unter den Modellen, deren Weiterleitung auf „Intelligent“ steht, wird wie diese Gruppe weitergeleitet, außer diese geht „Der Reihe nach“, „Nach Gewicht“ oder „Manuell“.", + "A group among the models, and a model whose provider routes its accounts or keys other than Quota first, keeps its own routing: this group only picks between it and the others, weighing it by the account or key it would try first, then tries it whole in its own order. A group among the models left on Quota first is routed as this group is, unless this one goes In order, By weight or Manual.": "Eine Gruppe unter den Modellen und ein Modell, dessen Anbieter seine Konten oder Schlüssel anders als „Kontingent zuerst“ weiterleitet, behalten ihre eigene Weiterleitung: Diese Gruppe wählt nur zwischen ihr und den anderen, gewichtet nach dem Konto oder Schlüssel, den sie zuerst versuchen würde, und versucht sie dann als Ganzes in ihrer eigenen Reihenfolge. Eine Gruppe unter den Modellen, deren Weiterleitung auf „Kontingent zuerst“ steht, wird wie diese Gruppe weitergeleitet, außer diese geht „Der Reihe nach“, „Nach Gewicht“ oder „Manuell“.", "errors your agent saw": "Fehler, die Ihr Agent sah", "It said: {error}": "Meldung: {error}", "Copilot's Auto picked {model} ({via})": "Copilots Auto wählte {model} ({via})", @@ -2811,8 +2811,8 @@ magpie.strings({ "Another magpie serves the gateway; its routing plays live in that magpie's window.": "Ein anderes magpie stellt den Zugangspunkt bereit; seine Weiterleitung wird live in dessen Fenster abgespielt.", "The gateway isn't running, so nothing is routed.": "Der Zugangspunkt läuft nicht, daher wird nichts weitergeleitet.", "The gateway is served by a magpie without a window (magpie serve), so its routing can't be watched. Stop it and let this magpie serve the gateway to see routing live.": "Der Zugangspunkt wird von einem magpie ohne Fenster (magpie serve) bereitgestellt, daher lässt sich seine Weiterleitung nicht beobachten. Beenden Sie es und lassen Sie dieses magpie den Zugangspunkt bereitstellen, um die Weiterleitung live zu sehen.", - "Smart: of the accounts with quota to spare, the one whose allowance renews soonest goes first — what it has left would be lost at the reset. The week decides; an account with five hours and no week goes by its five hours, and one whose month its weeks can no longer use up before it renews by its week. One at 90% or more waits until the others can't answer; one resting after a failure goes last.": "Intelligent: Von den Konten mit freiem Kontingent kommt das zuerst, dessen Kontingent sich am frühesten erneuert – sein Rest würde beim Zurücksetzen verfallen. Die Woche entscheidet; ein Konto mit fünf Stunden und ohne Woche richtet sich nach seinen fünf Stunden, eines, dessen Monat seine Wochen vor der Erneuerung nicht mehr aufbrauchen können, nach seiner Woche. Eines ab 90 % wartet, bis die anderen nicht antworten können; eines, das nach einem Fehler pausiert, kommt zuletzt.", - "Smart: keys that suit the request go first — one made for the model's own API — then in their order. One resting after a failure goes last.": "Intelligent: Schlüssel, die zur Anfrage passen, kommen zuerst – einer für die eigene API des Modells –, dann in ihrer Reihenfolge. Einer, der nach einem Fehler pausiert, kommt zuletzt.", + "Quota first: of the accounts with quota to spare, the one whose allowance renews soonest goes first — what it has left would be lost at the reset. The week decides; an account with five hours and no week goes by its five hours, and one whose month its weeks can no longer use up before it renews by its week. One at 90% or more waits until the others can't answer; one resting after a failure goes last.": "Kontingent zuerst: Von den Konten mit freiem Kontingent kommt das zuerst, dessen Kontingent sich am frühesten erneuert – sein Rest würde beim Zurücksetzen verfallen. Die Woche entscheidet; ein Konto mit fünf Stunden und ohne Woche richtet sich nach seinen fünf Stunden, eines, dessen Monat seine Wochen vor der Erneuerung nicht mehr aufbrauchen können, nach seiner Woche. Eines ab 90 % wartet, bis die anderen nicht antworten können; eines, das nach einem Fehler pausiert, kommt zuletzt.", + "Quota first: keys that suit the request go first — one made for the model's own API — then in their order. One resting after a failure goes last.": "Kontingent zuerst: Schlüssel, die zur Anfrage passen, kommen zuerst – einer für die eigene API des Modells –, dann in ihrer Reihenfolge. Einer, der nach einem Fehler pausiert, kommt zuletzt.", "In order: the first answers everything until it can't; then the next.": "Der Reihe nach: Der erste beantwortet alles, bis er nicht mehr kann; dann der nächste.", "In turn: each message you send goes to the next account, round the list; the agent's tool calls for it stay on the same one. With Stays on Session, a whole conversation stays on one instead.": "Abwechselnd: Jede Nachricht, die Sie senden, geht an das nächste Konto in der Liste, reihum; die Tool-Aufrufe des Agenten dazu bleiben beim selben. Mit Bleibt auf Sitzung bleibt eine ganze Unterhaltung bei einem.", "Least used first: the account with the most of its allowance left goes first; a key by the tokens magpie sent it lately.": "Am wenigsten genutzt zuerst: Das Konto mit dem größten Restkontingent kommt zuerst; ein Schlüssel nach den Token, die magpie ihm zuletzt gesendet hat.", diff --git a/internal/gui/tests/account-arrange.test.cjs b/internal/gui/tests/account-arrange.test.cjs index 25fc9eb98..c33c44cc4 100644 --- a/internal/gui/tests/account-arrange.test.cjs +++ b/internal/gui/tests/account-arrange.test.cjs @@ -122,7 +122,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await page.route("**/*", f.route); for (const id of ["antigravity", "relay"]) { await open(page, id); - for (const [mode, label] of [["", "Smart"], ["order", "In order"], ["rotate", "In turn"], ["usage", "Least used first"]]) { + for (const [mode, label] of [["", "Quota first"], ["order", "In order"], ["rotate", "In turn"], ["usage", "Least used first"]]) { // picked, then made with the editor's Save, which closes it const saveResponse = page.waitForResponse(response => new URL(response.url()).pathname === "/api/provider/save" && response.request().method() === "POST"); diff --git a/internal/gui/tests/account-weight.test.cjs b/internal/gui/tests/account-weight.test.cjs index 59bf72533..a0b788027 100644 --- a/internal/gui/tests/account-weight.test.cjs +++ b/internal/gui/tests/account-weight.test.cjs @@ -137,7 +137,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal((await page.locator("#status").textContent()).trim(), note, at); // back to Smart hides them - await page.locator(".editor").getByRole("button", { name: await say(page, lang, "Smart"), exact: true }).first().click(); + await page.locator(".editor").getByRole("button", { name: await say(page, lang, "Quota first"), exact: true }).first().click(); assert.equal(await chip("max@example.com").isVisible(), false, `${at}: a weight under Smart`); // open, the editor scrolls and the dialog around it doesn't: the lines // its check-in and warm-up rows keep out of sight were held against diff --git a/internal/gui/tests/builtins.test.cjs b/internal/gui/tests/builtins.test.cjs index fe8fc1e72..c3542a9aa 100644 --- a/internal/gui/tests/builtins.test.cjs +++ b/internal/gui/tests/builtins.test.cjs @@ -26,7 +26,7 @@ const PLUGINS = [ { id: "middleware", name: "JS gateway plugins", sub: "Run the JavaScript gateway plugins: middleware on agents' requests and replies, routings and usage observers", one: "1 gateway plugin on", many: "{n} gateway plugins on" }, { id: "otel", name: "Observability", sub: "Send each request's traces and metrics to an OpenTelemetry collector, such as Langfuse", one: "Sending to a collector", many: "Sending to a collector" }, { id: "redact", name: "Privacy masking", sub: "Secrets, personal data and your own words go to vendors as placeholders, and come back as they were", one: "Masking is on", many: "Masking is on" }, - { id: "rotation", name: "Routing strategies", sub: "The routings besides Smart: In order, Until used up, In turn, Least used first, Use before expiry, By weight, Free first, Speed first and Cheapest first", one: "1 provider or group routed so", many: "{n} providers and groups routed so" }, + { id: "rotation", name: "Routing strategies", sub: "The routings besides Quota first: In order, Until used up, In turn, Least used first, Use before expiry, By weight, Free first, Speed first and Cheapest first", one: "1 provider or group routed so", many: "{n} providers and groups routed so" }, { id: "routing", name: "Routing", sub: "Each request as the gateway routes it, the accounts it weighed and what each answered, and your routing groups", one: "1 group in use", many: "{n} groups in use" }, { id: "search", name: "Web search", sub: "Models that can't search the web search with a provider that can, or a search API", one: "1 search source set up", many: "{n} search sources set up" }, { id: "sessions", name: "Sessions", sub: "Your agents' past conversations: read, search, resume and export them", one: "Recording gateway conversations", many: "Recording gateway conversations" }, diff --git a/internal/gui/tests/key-weight.test.cjs b/internal/gui/tests/key-weight.test.cjs index 041b724c5..517fbec0d 100644 --- a/internal/gui/tests/key-weight.test.cjs +++ b/internal/gui/tests/key-weight.test.cjs @@ -112,7 +112,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", if (process.env.ARTIFACT_DIR) await page.locator(".editor .accts").screenshot({ path: path.join(process.env.ARTIFACT_DIR, `${engine}-${lang}-key-weight-rows.png`) }); // back to Smart hides them - await page.locator(".editor").getByRole("button", { name: lang === "en" ? "Smart" : "智能", exact: true }).first().click(); + await page.locator(".editor").getByRole("button", { name: lang === "en" ? "Quota first" : "额度优先", exact: true }).first().click(); assert.equal(await chip("aaaaaaaaaa").isVisible(), false); assert.deepEqual(errors, []); }); diff --git a/internal/gui/tests/rotate-figure.test.cjs b/internal/gui/tests/rotate-figure.test.cjs index 697bce448..ac1258e5c 100644 --- a/internal/gui/tests/rotate-figure.test.cjs +++ b/internal/gui/tests/rotate-figure.test.cjs @@ -171,7 +171,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", f = await fig(routing); assert.equal(f.affinity, "session"); assert.equal(f.msgs, "AAABBB"); - await routing.locator(".segs .opt", { hasText: new RegExp(`^${await tr(page, "Smart")}$`) }).click(); + await routing.locator(".segs .opt", { hasText: new RegExp(`^${await tr(page, "Quota first")}$`) }).click(); assert.equal(await routing.locator("svg.rot-fig").count(), 0, "drawn for In turn only"); assert.deepEqual(errors, []); }); diff --git a/internal/gui/tests/routing-free-expiring.test.cjs b/internal/gui/tests/routing-free-expiring.test.cjs index 49f9722a7..9abdadd6b 100644 --- a/internal/gui/tests/routing-free-expiring.test.cjs +++ b/internal/gui/tests/routing-free-expiring.test.cjs @@ -88,7 +88,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.match(said, pattern(await say("Free quota by expiry: {who}'s free quota is lost soonest, in {d}, so it's spent first."))); assert.ok(said.includes("mm@example.com"), said); assert.equal((await page.locator(".rt-mode").textContent()).trim(), - await say("Free quota by expiry: the accounts on a free plan, or whose model costs nothing there, go first, the one whose free quota is lost soonest first — at its next reset, or when its credits expire if sooner; once it is used up, the next. A paid one takes requests only when no free one has quota left, the paid as Smart orders them.")); + await say("Free quota by expiry: the accounts on a free plan, or whose model costs nothing there, go first, the one whose free quota is lost soonest first — at its next reset, or when its credits expire if sooner; once it is used up, the next. A paid one takes requests only when no free one has quota left, the paid as Quota first orders them.")); if (lang !== "en") assert.notEqual(await say("Free quota by expiry"), "Free quota by expiry", `${lang} names Free quota by expiry`); const wide = await page.evaluate(() => document.documentElement.scrollWidth - window.innerWidth); assert.ok(wide <= 0, `the page scrolls sideways by ${wide}px`); diff --git a/internal/gui/tests/routing-group-strategy.test.cjs b/internal/gui/tests/routing-group-strategy.test.cjs index 81ea5b841..f1353ae8e 100644 --- a/internal/gui/tests/routing-group-strategy.test.cjs +++ b/internal/gui/tests/routing-group-strategy.test.cjs @@ -25,10 +25,10 @@ const info = [{ id: "a/sol", ready: true }, { id: "b/flash", ready: true }, { id const base = { members: ["a/sol", "b/flash", "c/luna"], ready: true, memberInfo: info, offers: [], shared: [] }; const words = { - en: { order: "In order", manual: "Manual", weight: "By weight", smart: "Smart", head: "Routing", edit: "Edit", - names: ["Smart", "In order", "Until used up", "In turn", "Least used first", "Use before expiry", "Free first", "Speed first", "Cheapest first", "Free quota by expiry", "Small context first", "By weight", "Manual"], + en: { order: "In order", manual: "Manual", weight: "By weight", smart: "Quota first", head: "Routing", edit: "Edit", + names: ["Quota first", "In order", "Until used up", "In turn", "Least used first", "Use before expiry", "Free first", "Speed first", "Cheapest first", "Free quota by expiry", "Small context first", "By weight", "Manual"], tip: "How Auto routes: click to change it", saved: "Auto: Manual" }, - zh: { order: "按顺序", manual: "手动", weight: "按权重", smart: "智能", head: "路由", edit: "编辑", + zh: { order: "按顺序", manual: "手动", weight: "按权重", smart: "额度优先", head: "路由", edit: "编辑", tip: "Auto 的路由方式:点击更改", saved: "Auto:手动" }, "zh-TW": { tip: "Auto 的路由方式:點擊更改" }, ja: { tip: "Auto のルーティング方法:クリックで変更" }, @@ -213,8 +213,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await menu.waitFor(); const box = await menu.boundingBox(); assert.ok(box.x >= 0 && box.x + box.width <= width, JSON.stringify(box)); - await menu.locator(".pm-item", { hasText: "Smart" }).click(); - await page.waitForFunction(() => document.querySelector('.rt-group[data-id="auto"] .rt-groute')?.textContent === "Smart"); + await menu.locator(".pm-item", { hasText: "Quota first" }).click(); + await page.waitForFunction(() => document.querySelector('.rt-group[data-id="auto"] .rt-groute')?.textContent === "Quota first"); assert.equal(posts.at(-1).body.routing, ""); assert.deepEqual(errors, []); }); diff --git a/internal/gui/tests/routing-key-windows.test.cjs b/internal/gui/tests/routing-key-windows.test.cjs index 1bcfdac30..2ba7f0d82 100644 --- a/internal/gui/tests/routing-key-windows.test.cjs +++ b/internal/gui/tests/routing-key-windows.test.cjs @@ -160,7 +160,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.match(await row("relay-b").locator("em").textContent(), /95%/); // the header tells Smart as it weighs them, not as keys in their order assert.equal((await page.locator(".rt-mode").textContent()).trim(), - await say("Smart: of the accounts with quota to spare, the one whose allowance renews soonest goes first — what it has left would be lost at the reset. The week decides; an account with five hours and no week goes by its five hours, and one whose month its weeks can no longer use up before it renews by its week. One at 90% or more waits until the others can't answer; one resting after a failure goes last.")); + await say("Quota first: of the accounts with quota to spare, the one whose allowance renews soonest goes first — what it has left would be lost at the reset. The week decides; an account with five hours and no week goes by its five hours, and one whose month its weeks can no longer use up before it renews by its week. One at 90% or more waits until the others can't answer; one resting after a failure goes last.")); assert.deepEqual(errors, []); }); test(`${engine} ${lang}: one whose month its weeks can't use up says its week decides (#5639)`, async (t) => { @@ -201,7 +201,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", const steps = await page.locator(".rt-steps li").allTextContents(); assert.ok(steps.some((s) => s.includes(aside)), steps.join("\n")); assert.equal((await page.locator(".rt-mode").textContent()).trim(), - await say("Smart: of the accounts with quota to spare, the one whose allowance renews soonest goes first — what it has left would be lost at the reset. The week decides; an account with five hours and no week goes by its five hours, and one whose month its weeks can no longer use up before it renews by its week. One at 90% or more waits until the others can't answer; one resting after a failure goes last.")); + await say("Quota first: of the accounts with quota to spare, the one whose allowance renews soonest goes first — what it has left would be lost at the reset. The week decides; an account with five hours and no week goes by its five hours, and one whose month its weeks can no longer use up before it renews by its week. One at 90% or more waits until the others can't answer; one resting after a failure goes last.")); assert.deepEqual(errors, []); }); diff --git a/internal/gui/tests/routing-manual.test.cjs b/internal/gui/tests/routing-manual.test.cjs index 5b107110f..18ee2323a 100644 --- a/internal/gui/tests/routing-manual.test.cjs +++ b/internal/gui/tests/routing-manual.test.cjs @@ -30,11 +30,11 @@ const groups = (pick) => ({ models, pools: [], groups: [ ] }); const words = { - en: { edit: "Edit", save: "Save", routing: "Routing", manual: "Manual", smart: "Smart", + en: { edit: "Edit", save: "Save", routing: "Routing", manual: "Manual", smart: "Quota first", hint: "Manual: every request goes to the model you pick on the group's card, over its own accounts or keys; the others, and the rules, wait until you pick another — none takes over when it fails.", rulesWait: "The rules wait while you pick the model by hand.", group: "Model every request goes to", saved: "Hand: every request to luna" }, - zh: { edit: "编辑", save: "保存", routing: "路由", manual: "手动", smart: "智能", + zh: { edit: "编辑", save: "保存", routing: "路由", manual: "手动", smart: "额度优先", hint: "手动:所有请求发给在路由组卡片上选中的模型(在其账号或 Key 间路由);改选前其他模型和规则不生效,失败时也不切换。", rulesWait: "手动选择模型时,规则暂不生效。", group: "所有请求发往的模型", saved: "Hand:所有请求改发给 luna" }, diff --git a/internal/gui/tests/routing-rule-example.test.cjs b/internal/gui/tests/routing-rule-example.test.cjs index d5e1405da..a12f7e802 100644 --- a/internal/gui/tests/routing-rule-example.test.cjs +++ b/internal/gui/tests/routing-rule-example.test.cjs @@ -32,11 +32,11 @@ const groups = () => ({ }); const words = { - en: { smart: "No rules: Smart routing", order: "No rules: the members go by the routing set under Advanced, In order", edit: "Edit", save: "Save", intent: "planning, design, or a hard problem to think through" }, - zh: { smart: "没有规则:按智能路由", order: "没有规则:成员按高级里设置的路由(按顺序)", edit: "编辑", save: "保存", intent: "规划、设计,或需要深入思考的难题" }, - "zh-TW": { smart: "沒有規則:依智慧路由", order: "沒有規則:成員依進階中設定的路由(按順序)", edit: "編輯", save: "儲存", intent: "規劃、設計,或需要深入思考的難題" }, - ja: { smart: "ルールなし:スマートルーティング", order: "ルールなし:メンバーは詳細設定のルーティング(順番)", edit: "編集", save: "保存", intent: "計画、設計、またはじっくり考える必要がある難問" }, - de: { smart: "Keine Regeln: Smart-Routing", order: "Keine Regeln: Die Mitglieder gehen nach dem unter Erweitert gesetzten Routing (Der Reihe nach)", edit: "Bearbeiten", save: "Speichern", intent: "Planung, Entwurf oder ein schwieriges Problem zum Durchdenken" }, + en: { smart: "No rules: Quota first, which doesn't judge how hard a task is", order: "No rules: the members go by the routing set under Advanced, In order", edit: "Edit", save: "Save", intent: "planning, design, or a hard problem to think through" }, + zh: { smart: "没有规则:额度优先,不判断任务难易", order: "没有规则:成员按高级里设置的路由(按顺序)", edit: "编辑", save: "保存", intent: "规划、设计,或需要深入思考的难题" }, + "zh-TW": { smart: "沒有規則:額度優先,不判斷任務難易", order: "沒有規則:成員依進階中設定的路由(按順序)", edit: "編輯", save: "儲存", intent: "規劃、設計,或需要深入思考的難題" }, + ja: { smart: "ルールなし:枠優先。タスクの難しさは判断しません", order: "ルールなし:メンバーは詳細設定のルーティング(順番)", edit: "編集", save: "保存", intent: "計画、設計、またはじっくり考える必要がある難問" }, + de: { smart: "Keine Regeln: Kontingent zuerst, ohne die Schwierigkeit einer Aufgabe zu beurteilen", order: "Keine Regeln: Die Mitglieder gehen nach dem unter Erweitert gesetzten Routing (Der Reihe nach)", edit: "Bearbeiten", save: "Speichern", intent: "Planung, Entwurf oder ein schwieriges Problem zum Durchdenken" }, }; function serve(lang, posts) { diff --git a/internal/gui/tests/routing-save.test.cjs b/internal/gui/tests/routing-save.test.cjs index 849a40a1c..824fa133a 100644 --- a/internal/gui/tests/routing-save.test.cjs +++ b/internal/gui/tests/routing-save.test.cjs @@ -55,7 +55,7 @@ function serve(lang, posts, off = []) { } const ROUTINGS = [ - ["", "Smart", "智能"], ["order", "In order", "按顺序"], ["drain", "Until used up", "用完再换"], ["rotate", "In turn", "轮流"], + ["", "Quota first", "额度优先"], ["order", "In order", "按顺序"], ["drain", "Until used up", "用完再换"], ["rotate", "In turn", "轮流"], ["usage", "Least used first", "用量少的优先"], ["pace", "Use before expiry", "到期前用完"], ]; const STAYS = [["", "Auto", "自动"], ["session", "Session", "整个会话"], ["turn", "Within a turn", "一轮之内"], ["off", "Off", "关闭"]]; @@ -123,7 +123,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await page.getByRole("button", { name: L.cancel, exact: true }).click(); await page.getByRole("alertdialog").locator("button").last().click(); await open(); - assert.match(await opt(L.routing, zh ? "智能" : "Smart").getAttribute("class"), /\bon\b/); + assert.match(await opt(L.routing, zh ? "额度优先" : "Quota first").getAttribute("class"), /\bon\b/); assert.match(await opt(L.stays, zh ? "自动" : "Auto").getAttribute("class"), /\bon\b/); assert.equal(await unsaved(L.routing).isVisible(), false); assert.equal(await unsaved(L.stays).isVisible(), false); @@ -156,7 +156,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await page.locator(".editor .accts").first().waitFor(); const field = page.locator(".editor label", { hasText: new RegExp(`^${L.routing}$`) }).locator("xpath=following-sibling::div[1]"); const shown = await field.locator(".segs").first().evaluate((box) => [...box.querySelectorAll(".opt")].filter((b) => getComputedStyle(b).display !== "none").map((b) => b.textContent)); - assert.deepEqual(shown, [zh ? "智能" : "Smart"], `${where}: Smart alone`); + assert.deepEqual(shown, [zh ? "额度优先" : "Quota first"], `${where}: Smart alone`); assert.match(await field.locator(".segs .opt").first().getAttribute("class"), /\bon\b/, `${where}: Smart picked`); assert.ok(await page.evaluate(() => document.scrollingElement.scrollWidth <= innerWidth + 1), `${where}: fits`); // on again, every routing is back diff --git a/internal/gui/tests/routing-weight-chip.test.cjs b/internal/gui/tests/routing-weight-chip.test.cjs index 8ff19d9de..7b8ca548c 100644 --- a/internal/gui/tests/routing-weight-chip.test.cjs +++ b/internal/gui/tests/routing-weight-chip.test.cjs @@ -51,7 +51,7 @@ function serve(lang, scene) { } const chip = { en: "By weight", zh: "按权重", ja: "重み付け", de: "Nach Gewicht" }; -const smart = { en: "Smart", zh: "智能", ja: "スマート", de: "Intelligent" }; +const smart = { en: "Quota first", zh: "额度优先", ja: "枠優先", de: "Kontingent zuerst" }; for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) { for (const lang of ["en", "zh", "ja", "de"]) { @@ -103,7 +103,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal((await page.locator(".rt-hub i").textContent()).trim(), smart[lang]); assert.equal((await page.locator(".rt-mode").textContent()).trim(), await page.evaluate(([lang, key]) => (lang !== "en" && I18N[lang]?.[key]) || key, [lang, - "Smart: keys that suit the request go first — one made for the model's own API — then in their order. One resting after a failure goes last."])); + "Quota first: keys that suit the request go first — one made for the model's own API — then in their order. One resting after a failure goes last."])); assert.deepEqual(errors, []); }); } diff --git a/site/public/docs/ja/routing-groups.html b/site/public/docs/ja/routing-groups.html index 618eb717b..ab336b284 100644 --- a/site/public/docs/ja/routing-groups.html +++ b/site/public/docs/ja/routing-groups.html @@ -185,7 +185,7 @@

プロバイダーに二つ目のアカウントやキーを追加してオンにすると、編集画面に ルーティング と 維持 が現れ、リクエストをどう分けるかを決めます。

枠が残っているのにレート制限(429)されたものの扱いも選べます。位置を維持 はベンダーの指定どおり休んでから元の位置に戻り、最後尾へ はレート制限されていないものの後ろに回り、毎回先頭に戻らず負荷が回ります。

ルーティング

-
  • スマート(既定):枠に余裕のある間は最初のものが受け、少なくなると残りが最も多いものが引き継ぎます。クレジット切れは 30 分、枠切れはリセットまで、レート制限はベンダーの指定どおり、エラーは 1 分(繰り返すと長く)休みます。
  • 順番:最初のものに送り、枠切れ・レート制限・エラーで次が引き継ぎます。
  • 交互:メッセージを送るたびに、リストの順で次のものへ回します。そのメッセージのためのエージェントのツール呼び出しは同じものに残ります。移るたびにプロンプトキャッシュの一部を失います。維持をセッションにすると、会話全体が一つに留まります。
  • 使用量が最少のものを優先:サブスクリプションは使った枠の割合、キーは直近数時間のトークン数で決めます。
  • 週ペース:更新までの 1 時間あたりの残りが最も多いサブスクリプションへ送り、週のリセットで失う分を減らします。90% 以上使ったものはほかが答えられないときまで待ちます。
  • 重み付け:各キーの重みで分けます。重み 3 のキーは重み 1 のキーの 3 倍を受けます。キーのみで、アカウントには使えません。
  • 無料優先:費用のかからないものを先に使い、それが答えられないときだけ費用のかかるものへ。
+
  • 枠優先(既定):枠に余裕のある間は最初のものが受け、少なくなると残りが最も多いものが引き継ぎます。クレジット切れは 30 分、枠切れはリセットまで、レート制限はベンダーの指定どおり、エラーは 1 分(繰り返すと長く)休みます。
  • 順番:最初のものに送り、枠切れ・レート制限・エラーで次が引き継ぎます。
  • 交互:メッセージを送るたびに、リストの順で次のものへ回します。そのメッセージのためのエージェントのツール呼び出しは同じものに残ります。移るたびにプロンプトキャッシュの一部を失います。維持をセッションにすると、会話全体が一つに留まります。
  • 使用量が最少のものを優先:サブスクリプションは使った枠の割合、キーは直近数時間のトークン数で決めます。
  • 週ペース:更新までの 1 時間あたりの残りが最も多いサブスクリプションへ送り、週のリセットで失う分を減らします。90% 以上使ったものはほかが答えられないときまで待ちます。
  • 重み付け:各キーの重みで分けます。重み 3 のキーは重み 1 のキーの 3 倍を受けます。キーのみで、アカウントには使えません。
  • 無料優先:費用のかからないものを先に使い、それが答えられないときだけ費用のかかるものへ。

維持

維持 は、会話を答えたアカウントやキーに留めるかを決めます。

  • 自動(既定):ベンダーのキャッシュに保つ価値がある間は留まり、ターン内では常に留まります。
  • セッション:答えられる限りセッション全体で留まります。
  • ターン内:エージェントがツール結果を返す間は動かず、次に話しかけると改めてルーティングします。
  • オフ:リクエストごとに改めてルーティングします。
  • 厳格:レート制限や枠切れでも移らず、エラーがエージェントに届きます。新しい会話は通常どおりです。
diff --git a/site/public/docs/routing-groups.html b/site/public/docs/routing-groups.html index 70ade8324..7cfd02730 100644 --- a/site/public/docs/routing-groups.html +++ b/site/public/docs/routing-groups.html @@ -185,7 +185,7 @@

Once a provider has a second account or key switched on, its editor gets Routing and Stays, which decide how requests go between them.

You can also choose what one rate limited (429) while it still has quota does: Keeps its place rests as long as the vendor asks, then takes its place again; Goes to the back goes behind every one not rate limited since, so the load goes round rather than back to the first each time.

Routings

-
  • Smart (default): the first takes requests while it has quota to spare; when it runs low, the one with the most left takes over. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again.
  • In order: requests go to the first; the next takes over when the one before runs out of quota, hits a rate limit or fails.
  • In turn: each message you send goes to the next one, round the list; the agent’s tool calls for it stay on the same one. A move costs some prompt cache; with Stays on Session, a whole conversation stays on one instead.
  • Least used first: a subscription by the share of its allowance used, a key by the tokens it served in the last hours.
  • Weekly pace: the subscription with the most of its week left per hour until it renews, so less of each week is lost at its reset; one at 90% or more waits until the others can't answer.
  • By weight: by the weight beside each key; a key weighing 3 takes three requests for every one a key weighing 1 takes. Keys only, not accounts.
  • Free first: what costs nothing first, and only when those can't answer one that spends.
+
  • Quota first (default): the first takes requests while it has quota to spare; when it runs low, the one with the most left takes over. One out of credit sits out half an hour, one out of quota until it resets, one rate limited as long as the vendor asks, and one that fails a minute, longer each time it fails again.
  • In order: requests go to the first; the next takes over when the one before runs out of quota, hits a rate limit or fails.
  • In turn: each message you send goes to the next one, round the list; the agent’s tool calls for it stay on the same one. A move costs some prompt cache; with Stays on Session, a whole conversation stays on one instead.
  • Least used first: a subscription by the share of its allowance used, a key by the tokens it served in the last hours.
  • Weekly pace: the subscription with the most of its week left per hour until it renews, so less of each week is lost at its reset; one at 90% or more waits until the others can't answer.
  • By weight: by the weight beside each key; a key weighing 3 takes three requests for every one a key weighing 1 takes. Keys only, not accounts.
  • Free first: what costs nothing first, and only when those can't answer one that spends.

Stays

Stays decides whether a conversation stays with the account or key that answered it:

  • Auto (default): while what the vendor cached of it is worth keeping; within a turn always.
  • Session: for the whole session, while it can answer.
  • Within a turn: stays put while the agent sends tool results back; routed afresh when you speak again.
  • Off: every request routed afresh.
  • Strict: never moved, even rate limited or out of quota; the error goes to the agent. New conversations are routed as usual.
diff --git a/site/public/docs/zh/routing-groups.html b/site/public/docs/zh/routing-groups.html index e590c6bc5..b7b073706 100644 --- a/site/public/docs/zh/routing-groups.html +++ b/site/public/docs/zh/routing-groups.html @@ -185,7 +185,7 @@

给同一个供应商加上第二个账号或第二个 Key 并打开后,它的编辑页会多出 路由 和 会话保持 两项,决定请求在这些账号或 Key 之间怎么分。

被限流(429)但还有额度的那个怎么办,也可以选:保持原位:休息到供应商要求的时间,再回到原来的位置;排到最后:排到所有没被限流的后面,让负载轮转起来,而不是每次都回到第一个。

路由方式

-
  • 智能(默认):第一个在额度充足时接请求,额度快用完时由剩得最多的接手。没余额的歇半小时,额度用完的歇到重置,被限流的歇到供应商要求的时间,出错的歇一分钟,再错就更久。
  • 按顺序:请求都发给第一个,它额度用完、被限流或出错时由下一个接手。
  • 轮流:你每发一条消息,就按列表顺序交给下一个;Agent 为这条消息做的工具调用留在同一个上。每换一次会损失部分提示词缓存;会话保持选整个会话时,改为整个会话固定在一个上。
  • 用量少的优先:订阅按已用额度的比例,Key 按最近几小时用掉的 token。
  • 重置前用完:交给本周剩余额度按小时算最多的订阅,让每周重置时浪费得最少;用到 90% 以上的,等别的都答不了才用。
  • 按权重:按每个 Key 旁边设的权重分,权重 3 的接 3 个请求,权重 1 的接 1 个。只有 Key 能用,账号不行。
  • 免费优先:先用不占额度、不花钱的模型,它们答不了时才用花钱的。
+
  • 额度优先(默认):第一个在额度充足时接请求,额度快用完时由剩得最多的接手。没余额的歇半小时,额度用完的歇到重置,被限流的歇到供应商要求的时间,出错的歇一分钟,再错就更久。
  • 按顺序:请求都发给第一个,它额度用完、被限流或出错时由下一个接手。
  • 轮流:你每发一条消息,就按列表顺序交给下一个;Agent 为这条消息做的工具调用留在同一个上。每换一次会损失部分提示词缓存;会话保持选整个会话时,改为整个会话固定在一个上。
  • 用量少的优先:订阅按已用额度的比例,Key 按最近几小时用掉的 token。
  • 重置前用完:交给本周剩余额度按小时算最多的订阅,让每周重置时浪费得最少;用到 90% 以上的,等别的都答不了才用。
  • 按权重:按每个 Key 旁边设的权重分,权重 3 的接 3 个请求,权重 1 的接 1 个。只有 Key 能用,账号不行。
  • 免费优先:先用不占额度、不花钱的模型,它们答不了时才用花钱的。

会话保持

会话保持 决定一段对话是否留在答过它的那个账号或 Key 上:

  • 自动(默认):在供应商为它缓存的内容还值得保留时留下,一轮之内总是留下。
  • 整个会话:整个会话都留在那里,只要它还能答。
  • 一轮之内:Agent 发回工具结果时不动,你再说话时重新路由。
  • 关闭:每个请求都重新路由。
  • 严格:永远不换,哪怕它被限流或额度用完,错误直接交给 Agent。新会话照常路由。