PaSSw0rds' Team account (#1476) has on-demand turned on for the whole
organization: spendLimitUsage has no individualLimit, pooledLimit
"45120000" and pooledRemaining "38785730" are int64 strings, pooledUsed
6334270 a number, and GetHardLimit answers {"hardLimit": 451200} with or
without a team id. cursorOnDemandOf read that as unlimited, as
cursor-agent's own usage view does, so On-demand showed only the member's
$198.55 at 0%, aside, and a spent team pool never counted the account
used up; magpie would keep routing to it until Cursor refused.
Now a team member with no individualLimit and a pooledLimit > 0 gets a
fixed On-demand window on the pool: used = pooledUsed / pooledLimit,
display "$63,342.70 / $451,200.00 (you: $198.55)", not aside. A hard
limit that forbids on-demand still reads as disabled, and a team with no
pool and a hard limit still as unlimited. Dollar figures group thousands
(cursorDollars), as plugin 0.2.10 does. This is the built-in, for users
who haven't moved to the plugin; moved users get the same from
@magpie-community/opencode-cursor-auth 0.2.10 (next commit raises the
mover's min).
Run, under a sandbox HOME with pinned caches: go test -tags nogui
./internal/provider/ (ok); gofmt -l; go vet ./... on darwin,
GOOS=linux -tags nogui and GOOS=windows (clean).
Broken by hand: with the old cursor_usage.go,
TestCursorOnDemandKeepsTheAccount/a_team's_org-wide_on-demand_pool_is_the_allowance
fails (On-demand "$198.55", used 0, aside; the spent pool "used up
false"); with a fix that puts the member's spend against the pool, it
fails too. Built from the payloads quoted in #1476. Not tried against a
real Team account.
The same fix as plugin 0.2.6, for users who haven't moved Cursor onto its
plugin. cursorWindows read only GetCurrentPeriodUsage's planUsage, so a
team or enterprise that pays for on-demand usage read as used up once
Cursor Models / Other Models hit 100%: smart routing put it last, and a
failure then rested it until the billing period renewed.
It now also reads GetHardLimit (in parallel) and the period's
spendLimitUsage, and cursorOnDemandOf derives the On-demand state exactly
as cursor-agent 2026.10.01's usage view (usage-data.ts) and the plugin's
onDemandOf do: fixed (the member's own limit, or a personal hard limit),
unlimited (a team with a hard limit or a pooled limit, or a personal
limit of the top int32), disabled, or not known. Fixed or unlimited: the
pools stay on the card but aside, and an On-demand window ($used /
$limit) is the allowance, used up at its limit; unlimited is aside too.
Disabled or not known: the pools are the allowance, as before.
TestCursorOnDemandKeepsTheAccount uses the plugin's fixtures (Connect
JSON of SpendLimitUsage in cents with pooledLimit as an int64 string,
GetHardLimitResponse in dollars) and checks the windows and that
allowanceOf doesn't count the account full. On the old cursor_usage.go
three of its four subtests FAIL (pools not aside, no On-demand window);
the "no on-demand" subtest passes on both, as it should.
go test -tags nogui ./internal/provider passes (temp HOME, pinned caches);
go vet -tags nogui for darwin, linux, windows; gofmt -l clean. Not tried
with a real Cursor account (no enterprise account here).
Cursor 的两个额度池和汇总值原先同时参与每个模型的路由计算,导致 Other Models 用尽时仍有额度的 Grok、Composer 和 Auto 也被判为用尽。按服务端名单及官方已确认的模型归属分别匹配额度池,汇总值仅用于展示,并统一额度名称。
路由用量按账号和模型分别保存,避免同一账号的不同模型覆盖用量及重置时间。补充额度池独立耗尽、模型别名、重置和路由排序的回归测试。