Commit Graph
5 Commits
Author SHA1 Message Date
yetone 9ddcee10ac provider: a Cursor Team member with no limit of their own spends the team's on-demand pool, shown and counted as the limit, not as unlimited (#1868)
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.
2026-10-13 06:07:06 +08:00
yetone 45c63e9aa4 provider: a Cursor account still on the built-in that may spend on-demand is not used up when its included usage is (#1476, PaSSw0rds)
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).
2026-10-10 17:41:52 +08:00
yetone 112471fb2d cursor: a model is put in Cursor's pool by its family — the server lists grok-4.8, the CLI asks for grok-4.8-high-fast, and the exact match put that one in Other Models; case and cursor- no longer matter, and a bare composer is Cursor's too. The pools read Cursor 模型 / 其他模型 in Chinese 2026-09-28 12:04:43 +08:00
SadWood 4425be9262 fix(gateway): 按模型匹配 Cursor 路由额度 (#125)
Cursor 的两个额度池和汇总值原先同时参与每个模型的路由计算,导致 Other Models 用尽时仍有额度的 Grok、Composer 和 Auto 也被判为用尽。按服务端名单及官方已确认的模型归属分别匹配额度池,汇总值仅用于展示,并统一额度名称。

路由用量按账号和模型分别保存,避免同一账号的不同模型覆盖用量及重置时间。补充额度池独立耗尽、模型别名、重置和路由排序的回归测试。
2026-09-28 12:03:58 +08:00
yetone deb0d9e5e8 usage: Cursor's allowance shows on the Usage page, and every card names the account it is for; an agent with several Claude or Codex accounts is one card with a section per account, the one it is signed in to first 2026-09-25 01:15:09 +08:00