diff --git a/docs/subsystems/gateway-routing.md b/docs/subsystems/gateway-routing.md index 645c976b7..e761c9859 100644 --- a/docs/subsystems/gateway-routing.md +++ b/docs/subsystems/gateway-routing.md @@ -45,7 +45,7 @@ removed records stay and turning them on again restores the groups as they were. | 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) or `expiring` (free quota by expiry). `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 `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) | -| 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) 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) | +| 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) | | Image generation | `/v1/images/generations` and `/v1/images/edits` are translated to the selected model's image API. OpenRouter image-only models use its `/images` endpoint and send reference images as `input_references`; OpenRouter models that return images through chat stay on Chat Completions. Volcengine Ark (`isArk`: an `ark.*.volces.com` base, the preset's plans or one added by hand) is asked at `/images/generations` only, as its doc (https://www.volcengine.com/docs/82379/1541523) takes it (`drawArk`): `watermark: false`, since it marks every image otherwise; reference images as JSON `image` (a URL or data URL, an array for several), never a multipart edit; no `n`, so one request per image (`eachDrawing`); no ratio as `size`, so a ratio its doc lists is sent as that ratio's 2K size and any other is a 400 that says to put it in the prompt; no mask, no quality (JL on Discord, `TestArkDrawsWithoutWatermarkOncePerImage`). DashScope (`dashScope`: Qwen's, Bailian's and Qwen Cloud's presets, or one of their hosts) draws its Qwen-Image and Wan 2.7 image models (`dashScopeDraws`) on its own API, `/api/v1/services/aigc/multimodal-generation/generation` (`drawDashScope`), as docs.qwencloud.com gives it: the prompt as the user message's `text` part after an edit's images as `image` parts (a URL or data URL), `n`, `size` as `W*H` (a ratio is a 400 that says to give WxH), `watermark: false`, no mask; the images are read from every `output.choices[].message.content[].image` (`readDashScopeAnswer`), and a refusal says its `message` and `code`. A Token Plan's host serves no OpenAI images API, so the drawing went on to chat completions and "drew nothing" (judi0713 on Discord, `TestDashScopeDrawsOnItsOwnAPI`). A MiniMax API key (`filmsMiniMax`: the `minimax` and `minimax-cn` presets, or any provider at api.minimax.io, api.minimaxi.com or api.minimax.cn) lists `image-01` and `image-01-live` among its drawers (`minimaxDrawers`) and draws them on MiniMax's own `/v1/image_generation` (`drawMiniMax`), as platform.minimax.io gives it: `aspect_ratio` from `size` (one MiniMax lists, or the size it draws for one; else for image-01 a `width`/`height` in 512 to 2048 by 8; else the nearest ratio), `n`, `response_format: base64`, an edit's images as `subject_reference` (`type: character`), and the caller's `seed`, `prompt_optimizer`, `aigc_watermark` and `style`; no mask. The images are read from `data.image_base64` (or `image_urls`), and a `base_resp` failure in a 200 is told by its code (1004/2049 key, 1008 balance, 1026 content, 1002 rate) with its status (`readMiniMaxDrawing`). It went to chat completions before and was answered "unknown model 'image-01' (2013)" (rocbomb123 on X, `TestMiniMaxDrawsOnImageGeneration`). A routing group named for a drawing or a video (`drawingGroup`: `group/`, or a bare id the group goes by that resolved to one of its members) is tried member by member in the order its routing plans for a chat (`drawingTries` over `planGroup`), each member over its own keys or accounts (`drawOnAccounts`, `startVideo`); the next member is asked while one fails as a chat's would move on (`retryable`: its vendor 5xx, out of quota, the model not served), never for a refusal of the request itself, and the call's `Fallback` names those tried first (#2005, tianxia3111: a group of two relays answered the first one's 502). A group with chat models beside its image or video ones is tried on those alone (`drawingTries`' `makes`: `drawsModel`, or `servesKind` for video), so a drawing never goes to a chat member, on its provider's images API or as a chat asked for an image (changqiu4890 on Discord: a group of three relay chat models, a DeepSeek one and the relay's gpt-image-2.5 drew on its first chat model; `TestMixedGroupDrawsOnItsImageMemberOnly`, `TestMixedGroupMakesVideoOnItsVideoMemberOnly`). Codex's image tool draws on the routing group its turn asked for when that group has an image member (`codexDrawingProvider` gives the turn's group, `GroupDraws`, then `resolveDrawing`), and only otherwise on the provider that served the turn or Settings' pick (`TestCodexDrawingTakesItsGroupsImageMember`). Pause rules and a gateway key's group hold apply as for a chat. A failed drawing rests no member and no key. An account out of quota for the image model (`failure` reads `failQuota`) rests that model on it alone (`restDrawer`, keyed by `restID`), until the reset its refusal names (`resetsAt`: Antigravity's "Your quota will reset after 3h19m30s.") or `quotaRest`, so the next drawing asks the accounts that still have it first (`restLast`), and the account's text models stay in. Antigravity also tells a model's quota used up as a 200 whose stream is the error; `drawCodeAssist` gives such an error the status its words stand for (`saidStatus`: quota or rate 429, credit 402, else 502), as the images API's 200 with no image does, so a spent account hands the drawing to the next one as its 429 does (01huadalang on Discord: a 502 ended the drawing on the spent account; `TestAntigravityDrawingOutOfQuotaInsideTheReplyGoesOn`, `TestAntigravityDrawingQuotaRestsTheImageModel`). `TestImageGroupMovesOnToTheNextMember`, `TestVideoGroupMovesOnToTheNextMember`. Such a group may be Settings → Models → Images → Image generation's pick (7up6666 on X): the list offers each routing group with a member among its provider's `Drawers` (`GroupDraws`), so a request naming no model, the Magpie Image MCP's included, draws on the group; a picked group none of whose members draws any more is `DrawerMissing` (`drawerMissing`), the row says so and Automatic draws in its place. `TestImageGroupPickedInSettingsDraws`, `TestImageGenOffersDrawingGroups`. A group's Add a model picker offers each provider's image models, `/api/groups`' `drawers` (`gateway.Drawers` less hidden ones, apart from the chat `models`), said as such and with no reasoning level (jzw690 on X); such a member draws whether or not its provider's picks name it, as picks are of chat models (`provider.FindDrawingGroup`, used by `GroupDraws`, `resolveDrawing` and the image group's turns), and the group is no model agents are offered. A group named on `/v1/embeddings`, `/v1/rerank`, `/v1/audio/speech`, `/v1/audio/transcriptions` (and translations) or `/v1/videos` keeps the same way a member its provider's chat list doesn't have (`mediaMembers`: `provider.FindGroupAlso` with `offChatList`), and is tried from its first such member (`mediaGroupFirst`), so a hand-made group of embedding or speech models of providers with picks is served, not a 404 (XYenon on Discord); a chat model the user unticked stays out. `TestMediaGroupOfProvidersWithChatPicks`, `TestVideoGroupOfProvidersWithChatPicks`. The same models need no group made by hand (#5339): a fetched list keeps its models made for another API, each marked with it (`catalog.Model.Serves`, from the id: `catalog.ServesOf`; `LiveServing`), out of the chat models (`catalog.Chat`), so agents' lists, gateway keys and Routing's chat pickers never offer them, and a moderation model is still dropped. A model of one kind that more than one provider serves under exactly the same id (no other case, no other version) is a group of that kind made per request on its route (`provider.KindGroup`, `mediaMembers` and `servesKind` in [`media_group.go`](../../internal/gateway/media_group.go)): asked by the bare id there, or by `group/auto-:` (`KindGroupID`; a chat model's found group's id has no `:`), never on another kind's route, its members in the Providers order, none switched off and none the model is disabled on. It is in no list of groups (`Groups`), so no agent, key or picker offers it. Video is the kind `video` (`Videomakers`); images keep their own groups. A list saved before this is fetched again once a run, schedule or none (`refreshDueLists`, `catalog.LiveKinded`). Another magpie's list (`X-Magpie-Drawers`) is not marked; its models are found by their id (`ServesOf`). `TestKindGroupsServeEachAPIByRoute`, `TestVideoKindGroupByTheModelsID`, `TestKindGroupHoldsTheExactModel`, `TestKindlessListFetchedOnce`, `TestFetchKeepsModelsOfOtherAPIs`. `TestImageGroupOfUnpickedImageModelsDraws`, `TestGroupEditorOffersImageModels`, `group-pick-drawers.test.cjs`. An account's own list of models (#474) never bars a ChatGPT account's GPT Image, a Grok subscription's Grok Imagine or a WorkBuddy plan's image models (`listsCantName`): the list is picked from the editor's chat models, which they are never among, so a list kept for some chat models had every drawing refused as "set not to be served by any account" (heyiwei5 on X). A key's list, picked from models that include its image ones, still bars them. `TestCodexDrawsPastAccountModelLists`. A drawing is given Settings → Models → Images → Image generation timeout (`imageTimeout`, 1 to 60 minutes, 5 when unset; neighbads on X: a slow image endpoint needed more) as its context's deadline (`drawTimeout`, `drawWithin`), and so is downloading an image answered as a link (`imageLongest`, never under `ImageLongest`). A drawing's request goes through a transport with no `ResponseHeaderTimeout` (`drawsApart`), since an images API sends its headers only once it has drawn, and every other request keeps `upstreamHeaderWait` (10 minutes). A video's submit, status and download calls keep 5 minutes each (`videoTimeout`). The `magpie mcp image` process, which may not read these settings (WSL), waits on a call up to `callLongest` (two hours and a minute), so it never cuts one the gateway still waits on. `TestLongImageTimeoutLetsASlowVendorFinish`, `TestImageTimeoutSettingReachesTheVendor`, `TestOnlyDrawingsWaitPastTheHeaderWait`. | [`draw.go`](../../internal/gateway/draw.go), [`draw_volcengine.go`](../../internal/gateway/draw_volcengine.go), [`draw_dashscope.go`](../../internal/gateway/draw_dashscope.go), [`video.go`](../../internal/gateway/video.go), [`catalog.go`](../../internal/catalog/catalog.go) | diff --git a/internal/provider/migrate_zcode.go b/internal/provider/migrate_zcode.go index 537fe7ff4..6a2e69e28 100644 --- a/internal/provider/migrate_zcode.go +++ b/internal/provider/migrate_zcode.go @@ -20,7 +20,7 @@ import ( func init() { movers["zcode"] = &mover{ pkg: "@magpie-community/opencode-zcode-auth", - min: "0.1.66", // 0.1.66: a gift-only account (no GLM Coding Plan) no longer sends a model its Start Plan balance doesn't name, which spent none of the free quota, and a plan-list read that fails keeps such an account on the Start Plan rather than sending its key to the coding plan's host, which bills a key with no plan pay-as-you-go (bg5eau on X); 0.1.65: a -Trial pick that finds no gift names the gift plan ZCode holds for the account unclaimed (its weekend ZCODE WEEKEND BUILD) and says to claim it in the ZCode app, whose claim needs the app's security check, rather than only "no active limited quota" (heduian, bg5eau on X); 0.1.64: a Start Plan request ZCode refuses (3008) beside the account's other requests waits for one of them to end and is sent again, rather than answered 429, so two sessions on an account ZCode serves one at a time no longer show 429s (JJLIN070414 on X); 0.1.61: a reset the vendor's list flags available but whose end has passed is no longer counted as a reset card (nathan_ift_us on X); 0.1.60: a coding plan key that can't be read for a network reason (ECONNRESET, a timeout) keeps the last key read, or answers a wall that magpie sends once and rests, rather than a thrown error retried about 8 times over six minutes, and free first no longer replays onto a coding plan whose usage read showed a window full (plugins#1020, takomitkm); 0.1.59: a reply the gift answered names its -Trial entry (GLM-5.3-Flash-Trial), so Usage, the sessions and the request log show free quota was spent when free first moved the plain model there (WJaunita45604 on X); 0.1.58: a Start Plan account ZCode serves fewer than three at a time is narrowed to what it serves for five minutes, and a request refused again with others of that account in flight counts toward no busy hold, so one agent with two in flight no longer holds every account (plugins#438, takomitkm); a -Trial entry is marked free, so a coding plan model's weekly or monthly limit (1310) rests that model and not the account's trial entries; 0.1.57: a Start Plan request the busy hold answered while in flight is not counted as a spent gift, so a -Trial model or free first is no longer rested for a minute with quota left (plugins#859, zxy20250120); 0.1.56: a Start Plan account has at most three requests in flight, the rest waiting in the plugin rather than sent to be refused, a busy cap (3008/3009/3010) is asked again twice, after 1s and 2s, as ZCode 3.17.2 does, and the 3-minute busy hold counts only a request refused again at its re-ask, its message saying what happened and what to do (star21321321124 on Discord); 0.1.55: no daily claim is posted while ZCode's client config asks its security check for claims (captcha.enabled), each plan saying to claim it in the ZCode app, and Start Plan requests carry the desktop's X-Title "Z Code@electron" and a per-turn x-query-id, as ZCode 3.17.2 sends (young02036 on Discord); 0.1.54: a busy hold also stops Start Plan requests already in flight (plugins#801); 0.1.53: a spent bucket's HTTP 200 ("exceed quota limit" 1005, 1113) says 429 on every path, so magpie rests that model and not the account (zane668, plugins#817); 0.1.52: a rate-limited claim or balance read holds that account, and only that account, until ZCode's wait is over, rather than every account asking again at once (kongbai01203, plugins#793); 0.1.51: a gift-only account (no GLM Coding Plan) lists only the models its Start Plan balance names, as ZCode offers it, not every model of the Start Plan config, so magpie no longer routes GLM-5.2 or GLM-5-Turbo to an account whose balance holds only GLM-5.3-Flash (young02036 on Discord); 0.1.50: a daily claim answered with code 1004 reads the account as not eligible for that plan now and asks again in half an hour, not a failed claim (kongbai01203, plugins#729); 0.1.49: a free-first request zcode.z.ai turned away (405/3012) no longer makes the -Trial entry answer a local "quota exhausted" 429 without asking ZCode, the local 429 keeps the words zcodeSpentWords reads at its end, and free first is a switch in the provider's editor (Can4ry_ on X). 0.1.48: the Start Plan request carries ZCode 3.17.2's prompt texts, not 3.14.3's under a 3.17.2 header, which zcode.z.ai turned away with 405/3012 while the app worked on the same accounts (jinpy666's #682; plugins#348: bitjerry, issennknight, jovial, supermc); 0.1.47: a free gift model (GLM-5.3-Flash-Trial) goes to ZCode as the registry spells it, as the app sends it, not the lowercase bucket name, and the plugin's own 429 says when ZCode answered 429 a minute ago (Discord reports); 0.1.46: every call goes as ZCode 3.17.2, whose Start Plan balance judges by app_version, and a sign-in whose only Start Plan starts later is taken, as ZCode counts it, not refused as "ended or never started" (sliyrainbow on Discord); the feed is asked in zh-CN or en-US only, as ZCode does; 0.1.45: the daily claim reads the marketing feed under 3.17.2's version header, since under 3.16.3 it answered empty and nothing was claimed from 11-03, and no longer reads billing/preview, which the 3.17 client dropped (plugins#676, #678, jinpy666); 0.1.43: a block page from zcode.z.ai's edge firewall holds every account's Start Plan and -Trial requests off zcode.z.ai for three minutes, answered at once with the same 405 and BlockedHint so the gateway still falls back, and free first stays on the coding plan meanwhile, so a blocked address is not knocked on by every account and session (frank6com, plugins #649); 0.1.42: a plain GLM model spends a live ZCode gift first by default, falling back to the coding plan; "freeFirst": false in the plugin's or provider's options keeps the plan first (sgfvdsg86265 on X); 0.1.41: an account the daily claim found nothing for is asked again in half an hour rather than settled for the day, so a gift plan ZCode drops into its feed later (the weekend plan from 19:00 Beijing) is still claimed (plugins#600); 0.1.40: maxAccounts 2 is declared, so magpie sends requests to the first two ZCode accounts of the list and holds the others in reserve, since three at once from one address got it refused with a 405 (01huadalang on Discord); 0.1.39: the daily claim also reads the ZCode app's claim banners (GET /api/v1/marketing/touch, each claim_zcode_plan button), so a banner plan billing/preview never lists (ZCODE WEEKEND BUILD) is claimed and named on the card (plugins#503, kongbai01203); 0.1.38: freeFirst, an option (Plugins › Options or provider.zcode.options, off by default), lets a plain model spend a dual account's live gift first, under the name the gift lists, and replays any gift failure on the coding plan in the same request (plugins#505, jinpy666); 0.1.37: an account with no gift plan to claim, which ZCode's billing/preview answers {"code":0,"msg":""} with no data at all, is "no check-in event now" in the daily check-in, not "Check-in failed · no plan list in the reply" (hykql on Discord); 0.1.36: beside a GLM Coding Plan a gift bucket is named by its model first, as ZCode's "Today's balance" lists it, then its plan ("GLM-5.3-Trial · ZCODE GLOBAL BUILD"), since the ring and account row cut "ZCODE GLOBAL BUI…" short and the Start Plan read as missing (plugins#504, Danbuth); 0.1.35: the daily check-in (off until the user turns ZCode on in Settings → Daily check-in) claims each account's ZCode gift plans that billing/preview lists, judged by the claim reply's code (0 claimed, 1003 claimed before, 3007 captcha: claimed in the ZCode app), an unreadable reply failed, never claimed (plugins#503, kongbai01203); 0.1.34: a gift plan whose starts_at is still to come (a Start Plan taking effect at 23:00 today) is named on the card with its start ("ZCode gift plan not started yet") and gets no requests before it, and beside a GLM Coding Plan every gift bucket carries its plan's name ("Start Plan · GLM-5.1-Trial") (windy on Discord, plugins 3b3209e); 0.1.33: ZCode 3.16's key-location sign-in lists its GLM Coding Plan's models (GLM-5.3 among them) from the key it reads, not the Start Plan's, and a key that can't be read keeps the list magpie had (plugins#439, dinghao-8); 0.1.32: a 429 that is the plan's in-flight cap (3008/3009) is asked again, the same bytes, for about ten seconds before it goes on, is not counted as a spent gift, and maxConcurrency 3 is declared as a default magpie's per-account queue applies (plugins#395, ANDY-JK); 0.1.31: ZCode 3.16's sign-in that keeps only a project-key-location record reads that key, so its GLM Coding Plan is found, not only the gift (plugins#410); conversation named in x-session-id as a bare UUID (plugins#388); 0.1.30: a GLM Coding Plan or team request names the device in metadata.user_id as ZCode's client does on every request, when the agent sent none (plugins #387); 0.1.29: a sign-in keeps the account's user id, for two accounts of one name to be told apart (wakkana on Discord); 0.1.28: plugins #369, #379; 0.1.27: the Start Plan's 405 code 3012 says ZCode's risk control blocked the account (provider.ZCodeRestrictedHint), which rests it as restricted, not "a network block of this IP" (plugins #348); 0.1.26: a signed-in account's ZCode gift plans keep their -Trial models when ZCode's config is out of reach (no fall back to the last list), a failed gift read is asked again in a minute rather than ten, and a card with an API key or an expired ZCode session says its gift plans need ZCode's sign-in (bigsteven on Discord, plugins cc0bd90); 0.1.25: a GLM Coding Plan key on an account with no plan says ZCode's gift plans (the Start Plan, ZCode 1024 Dev Day) are spent only with ZCode's sign-in, on its card and on a 1113 refusal, rather than an empty card and a bare "余额不足" (rtbeilin on X, plugins 71021b8); 0.1.24: Claude Code's ToolSearch goes to ZCode's plans as ToolSearchTool and tools go without defer_loading, since api.z.ai shows the model no tool but a tool_reference's beside a tool named ToolSearch, so a Claude Code subagent saw no Bash, Read or Write (小八 on Discord, plugins d1b6500); 0.1.23: with two gift plans (the 1024 Dev Day and the new-user plan) each bucket is named after its plan and the ones a request spends come first, so a spent plan's GLM-5.3 no longer hides another plan's (01huadalang on Discord, plugins 1f8d38b); 0.1.22: a Start Plan request goes with ZCode 3.16.3's headers alone (x-zcode-query-source, X-Os-Version as os.release()), never the agent's (Claude Code's anthropic-beta, x-app, x-stainless-*), and without ?beta=true (01huadalang on Discord); 0.1.21: a Start Plan request sends the agent's system prompt at the end of ZCode's third system block, as ZCode joins every dynamic section, since zcode.z.ai refuses a fourth block with 405/3012 (plugins #343); 0.1.20: a team's GLM Coding Plan signs in beside the account's own, as an account of its own named " (team)" (plugins #285); 0.1.19: the personal plan's resets, and the team's, carry each reset's end and window; a Start Plan refusal carries the built-in's hint; 0.1.18: the ZCode app's sign-in reads ZCode 3.15's GLM Coding Plan key from config.json (provider["builtin:*-coding-plan"].options.apiKey), so a valid plan no longer reads as "no plan", as the built-in does since 1d8e83a79 (#2130); 0.1.17: the ZCode app's sign-in reads credentials.json from the folder ZCode's data was moved to in its settings (数据存储路径, dataBaseDir in the home folder's setting.json), as the built-in does since 41972b25f (flower on Discord); 0.1.16's ZCode app's sign-in follows ZCode only while it is signed in to the same account, so an entry added for one account never sends with another's credentials after ZCode switched (LingYi_Stu on X); 0.1.15's Start Plan request says the agent's folder and git repository as magpie tells them, never magpie's own folder, and leaves out what it doesn't know (plugins #86); 0.1.14's gift-only account lists its gift's models by their own names, as ZCode does, so a Start Plan GLM-5.3 bucket's model is listed as GLM-5.3, not only GLM-5.3-Trial (#1261, plugins aca7c59); 0.1.13's claim line has one fixed name, which the GUI translates, so it no longer shares the "ZCode Trust Build" bucket window's name (plugins #43); 0.1.12's counted window carries its amount and limit, so the card's count follows used/left (#659, plugins #35); 0.1.11's gift plan ZCode holds but hasn't granted is named on the card, to claim in the ZCode app (plugins #30, #1001); 0.1.10's gift-only buckets and 0.1.9's trial entries (plugins #21) kept + min: "0.1.68", // 0.1.68: every ZCode account takes requests, not the first two of the list with the others in reserve, and the Start Plan is held instead to six requests in flight from this computer over all its accounts, which is what the edge firewall refuses an address for (mathfournity on X); 0.1.66: a gift-only account (no GLM Coding Plan) no longer sends a model its Start Plan balance doesn't name, which spent none of the free quota, and a plan-list read that fails keeps such an account on the Start Plan rather than sending its key to the coding plan's host, which bills a key with no plan pay-as-you-go (bg5eau on X); 0.1.65: a -Trial pick that finds no gift names the gift plan ZCode holds for the account unclaimed (its weekend ZCODE WEEKEND BUILD) and says to claim it in the ZCode app, whose claim needs the app's security check, rather than only "no active limited quota" (heduian, bg5eau on X); 0.1.64: a Start Plan request ZCode refuses (3008) beside the account's other requests waits for one of them to end and is sent again, rather than answered 429, so two sessions on an account ZCode serves one at a time no longer show 429s (JJLIN070414 on X); 0.1.61: a reset the vendor's list flags available but whose end has passed is no longer counted as a reset card (nathan_ift_us on X); 0.1.60: a coding plan key that can't be read for a network reason (ECONNRESET, a timeout) keeps the last key read, or answers a wall that magpie sends once and rests, rather than a thrown error retried about 8 times over six minutes, and free first no longer replays onto a coding plan whose usage read showed a window full (plugins#1020, takomitkm); 0.1.59: a reply the gift answered names its -Trial entry (GLM-5.3-Flash-Trial), so Usage, the sessions and the request log show free quota was spent when free first moved the plain model there (WJaunita45604 on X); 0.1.58: a Start Plan account ZCode serves fewer than three at a time is narrowed to what it serves for five minutes, and a request refused again with others of that account in flight counts toward no busy hold, so one agent with two in flight no longer holds every account (plugins#438, takomitkm); a -Trial entry is marked free, so a coding plan model's weekly or monthly limit (1310) rests that model and not the account's trial entries; 0.1.57: a Start Plan request the busy hold answered while in flight is not counted as a spent gift, so a -Trial model or free first is no longer rested for a minute with quota left (plugins#859, zxy20250120); 0.1.56: a Start Plan account has at most three requests in flight, the rest waiting in the plugin rather than sent to be refused, a busy cap (3008/3009/3010) is asked again twice, after 1s and 2s, as ZCode 3.17.2 does, and the 3-minute busy hold counts only a request refused again at its re-ask, its message saying what happened and what to do (star21321321124 on Discord); 0.1.55: no daily claim is posted while ZCode's client config asks its security check for claims (captcha.enabled), each plan saying to claim it in the ZCode app, and Start Plan requests carry the desktop's X-Title "Z Code@electron" and a per-turn x-query-id, as ZCode 3.17.2 sends (young02036 on Discord); 0.1.54: a busy hold also stops Start Plan requests already in flight (plugins#801); 0.1.53: a spent bucket's HTTP 200 ("exceed quota limit" 1005, 1113) says 429 on every path, so magpie rests that model and not the account (zane668, plugins#817); 0.1.52: a rate-limited claim or balance read holds that account, and only that account, until ZCode's wait is over, rather than every account asking again at once (kongbai01203, plugins#793); 0.1.51: a gift-only account (no GLM Coding Plan) lists only the models its Start Plan balance names, as ZCode offers it, not every model of the Start Plan config, so magpie no longer routes GLM-5.2 or GLM-5-Turbo to an account whose balance holds only GLM-5.3-Flash (young02036 on Discord); 0.1.50: a daily claim answered with code 1004 reads the account as not eligible for that plan now and asks again in half an hour, not a failed claim (kongbai01203, plugins#729); 0.1.49: a free-first request zcode.z.ai turned away (405/3012) no longer makes the -Trial entry answer a local "quota exhausted" 429 without asking ZCode, the local 429 keeps the words zcodeSpentWords reads at its end, and free first is a switch in the provider's editor (Can4ry_ on X). 0.1.48: the Start Plan request carries ZCode 3.17.2's prompt texts, not 3.14.3's under a 3.17.2 header, which zcode.z.ai turned away with 405/3012 while the app worked on the same accounts (jinpy666's #682; plugins#348: bitjerry, issennknight, jovial, supermc); 0.1.47: a free gift model (GLM-5.3-Flash-Trial) goes to ZCode as the registry spells it, as the app sends it, not the lowercase bucket name, and the plugin's own 429 says when ZCode answered 429 a minute ago (Discord reports); 0.1.46: every call goes as ZCode 3.17.2, whose Start Plan balance judges by app_version, and a sign-in whose only Start Plan starts later is taken, as ZCode counts it, not refused as "ended or never started" (sliyrainbow on Discord); the feed is asked in zh-CN or en-US only, as ZCode does; 0.1.45: the daily claim reads the marketing feed under 3.17.2's version header, since under 3.16.3 it answered empty and nothing was claimed from 11-03, and no longer reads billing/preview, which the 3.17 client dropped (plugins#676, #678, jinpy666); 0.1.43: a block page from zcode.z.ai's edge firewall holds every account's Start Plan and -Trial requests off zcode.z.ai for three minutes, answered at once with the same 405 and BlockedHint so the gateway still falls back, and free first stays on the coding plan meanwhile, so a blocked address is not knocked on by every account and session (frank6com, plugins #649); 0.1.42: a plain GLM model spends a live ZCode gift first by default, falling back to the coding plan; "freeFirst": false in the plugin's or provider's options keeps the plan first (sgfvdsg86265 on X); 0.1.41: an account the daily claim found nothing for is asked again in half an hour rather than settled for the day, so a gift plan ZCode drops into its feed later (the weekend plan from 19:00 Beijing) is still claimed (plugins#600); 0.1.40: maxAccounts 2 is declared, so magpie sends requests to the first two ZCode accounts of the list and holds the others in reserve, since three at once from one address got it refused with a 405 (01huadalang on Discord); 0.1.39: the daily claim also reads the ZCode app's claim banners (GET /api/v1/marketing/touch, each claim_zcode_plan button), so a banner plan billing/preview never lists (ZCODE WEEKEND BUILD) is claimed and named on the card (plugins#503, kongbai01203); 0.1.38: freeFirst, an option (Plugins › Options or provider.zcode.options, off by default), lets a plain model spend a dual account's live gift first, under the name the gift lists, and replays any gift failure on the coding plan in the same request (plugins#505, jinpy666); 0.1.37: an account with no gift plan to claim, which ZCode's billing/preview answers {"code":0,"msg":""} with no data at all, is "no check-in event now" in the daily check-in, not "Check-in failed · no plan list in the reply" (hykql on Discord); 0.1.36: beside a GLM Coding Plan a gift bucket is named by its model first, as ZCode's "Today's balance" lists it, then its plan ("GLM-5.3-Trial · ZCODE GLOBAL BUILD"), since the ring and account row cut "ZCODE GLOBAL BUI…" short and the Start Plan read as missing (plugins#504, Danbuth); 0.1.35: the daily check-in (off until the user turns ZCode on in Settings → Daily check-in) claims each account's ZCode gift plans that billing/preview lists, judged by the claim reply's code (0 claimed, 1003 claimed before, 3007 captcha: claimed in the ZCode app), an unreadable reply failed, never claimed (plugins#503, kongbai01203); 0.1.34: a gift plan whose starts_at is still to come (a Start Plan taking effect at 23:00 today) is named on the card with its start ("ZCode gift plan not started yet") and gets no requests before it, and beside a GLM Coding Plan every gift bucket carries its plan's name ("Start Plan · GLM-5.1-Trial") (windy on Discord, plugins 3b3209e); 0.1.33: ZCode 3.16's key-location sign-in lists its GLM Coding Plan's models (GLM-5.3 among them) from the key it reads, not the Start Plan's, and a key that can't be read keeps the list magpie had (plugins#439, dinghao-8); 0.1.32: a 429 that is the plan's in-flight cap (3008/3009) is asked again, the same bytes, for about ten seconds before it goes on, is not counted as a spent gift, and maxConcurrency 3 is declared as a default magpie's per-account queue applies (plugins#395, ANDY-JK); 0.1.31: ZCode 3.16's sign-in that keeps only a project-key-location record reads that key, so its GLM Coding Plan is found, not only the gift (plugins#410); conversation named in x-session-id as a bare UUID (plugins#388); 0.1.30: a GLM Coding Plan or team request names the device in metadata.user_id as ZCode's client does on every request, when the agent sent none (plugins #387); 0.1.29: a sign-in keeps the account's user id, for two accounts of one name to be told apart (wakkana on Discord); 0.1.28: plugins #369, #379; 0.1.27: the Start Plan's 405 code 3012 says ZCode's risk control blocked the account (provider.ZCodeRestrictedHint), which rests it as restricted, not "a network block of this IP" (plugins #348); 0.1.26: a signed-in account's ZCode gift plans keep their -Trial models when ZCode's config is out of reach (no fall back to the last list), a failed gift read is asked again in a minute rather than ten, and a card with an API key or an expired ZCode session says its gift plans need ZCode's sign-in (bigsteven on Discord, plugins cc0bd90); 0.1.25: a GLM Coding Plan key on an account with no plan says ZCode's gift plans (the Start Plan, ZCode 1024 Dev Day) are spent only with ZCode's sign-in, on its card and on a 1113 refusal, rather than an empty card and a bare "余额不足" (rtbeilin on X, plugins 71021b8); 0.1.24: Claude Code's ToolSearch goes to ZCode's plans as ToolSearchTool and tools go without defer_loading, since api.z.ai shows the model no tool but a tool_reference's beside a tool named ToolSearch, so a Claude Code subagent saw no Bash, Read or Write (小八 on Discord, plugins d1b6500); 0.1.23: with two gift plans (the 1024 Dev Day and the new-user plan) each bucket is named after its plan and the ones a request spends come first, so a spent plan's GLM-5.3 no longer hides another plan's (01huadalang on Discord, plugins 1f8d38b); 0.1.22: a Start Plan request goes with ZCode 3.16.3's headers alone (x-zcode-query-source, X-Os-Version as os.release()), never the agent's (Claude Code's anthropic-beta, x-app, x-stainless-*), and without ?beta=true (01huadalang on Discord); 0.1.21: a Start Plan request sends the agent's system prompt at the end of ZCode's third system block, as ZCode joins every dynamic section, since zcode.z.ai refuses a fourth block with 405/3012 (plugins #343); 0.1.20: a team's GLM Coding Plan signs in beside the account's own, as an account of its own named " (team)" (plugins #285); 0.1.19: the personal plan's resets, and the team's, carry each reset's end and window; a Start Plan refusal carries the built-in's hint; 0.1.18: the ZCode app's sign-in reads ZCode 3.15's GLM Coding Plan key from config.json (provider["builtin:*-coding-plan"].options.apiKey), so a valid plan no longer reads as "no plan", as the built-in does since 1d8e83a79 (#2130); 0.1.17: the ZCode app's sign-in reads credentials.json from the folder ZCode's data was moved to in its settings (数据存储路径, dataBaseDir in the home folder's setting.json), as the built-in does since 41972b25f (flower on Discord); 0.1.16's ZCode app's sign-in follows ZCode only while it is signed in to the same account, so an entry added for one account never sends with another's credentials after ZCode switched (LingYi_Stu on X); 0.1.15's Start Plan request says the agent's folder and git repository as magpie tells them, never magpie's own folder, and leaves out what it doesn't know (plugins #86); 0.1.14's gift-only account lists its gift's models by their own names, as ZCode does, so a Start Plan GLM-5.3 bucket's model is listed as GLM-5.3, not only GLM-5.3-Trial (#1261, plugins aca7c59); 0.1.13's claim line has one fixed name, which the GUI translates, so it no longer shares the "ZCode Trust Build" bucket window's name (plugins #43); 0.1.12's counted window carries its amount and limit, so the card's count follows used/left (#659, plugins #35); 0.1.11's gift plan ZCode holds but hasn't granted is named on the card, to claim in the ZCode app (plugins #30, #1001); 0.1.10's gift-only buckets and 0.1.9's trial entries (plugins #21) kept agents: []string{"zcode"}, out: func() ([]Moving, error) { var out []Moving