cursor 0.2.2: a model listed at a size Cursor has a fast variant of says fast: true (yetone/magpie#1360, loosheng)

0.2.0 stopped listing a model's -fast one and takes fast as the request's
service_tier, so magpie, which offered its Fast switch (the agent picker's
lightning, a group member's 标准速度/快速) for a model with a -fast one,
offered it for none. The runtime model now says fast: true when a variant
the account is served at that context size has fast=true (Opus 5.5 @ 300k,
Composer 2.5, Grok 4.7), and nothing otherwise (a size with no fast variant,
a model with no fast parameter, an account the usable list doesn't serve the
fast variants). Requests are unchanged.

Tested: new context.test.mjs case, which fails on 0.2.1 (no model says
fast); the whole package (50 tests) and scripts/check.mjs pass. Not tried
with a real Cursor account.
This commit is contained in:
yetone
2026-10-09 05:14:56 +08:00
parent af4a0b365d
commit fb253f91d5
4 changed files with 37 additions and 4 deletions
+3 -1
View File
@@ -87,7 +87,9 @@ minutes), the way pi-cursor-sdk lists Cursor's catalog:
sent as the model's effort parameter. `none` turns a Claude's thinking off.
- Fast is not a model of its own either: a `service_tier` of `priority`
or `fast` sends `fast=true`, anything else `fast=false` (it costs more,
so only when asked).
so only when asked). A model listed at a size Cursor has a fast variant
of (served to the account) says `fast: true`, which magpie offers its
Fast switch for (yetone/magpie#1360).
- A request goes as the picker's variant those parameters pick, in Max Mode
when that variant is Max Mode's (a 1M size, say), as the CLI turns it on.
A size with no variant goes in Max Mode when it is over Cursor's limit
+19
View File
@@ -91,6 +91,25 @@ test("the provider's list, efforts as variants, no model of its own for fast or
expect(Object.keys(list).some((id) => /-fast$|-(low|medium|high)$/.test(id))).toBe(false)
})
test("fast is said on the models Cursor has a fast variant of, at that size, and only those (yetone/magpie#1360)", async () => {
const fastOf = async (usableIDs) => {
fakeAPI(PICKER, usableIDs)
const hooks = await CursorAuthPlugin()
const jwt = ["e30", Buffer.from(JSON.stringify({ exp: Math.floor(Date.now() / 1000) + 7200 + ++n })).toString("base64url"), "s"].join(".")
const list = await hooks.provider.models({ models: {} }, { auth: { type: "oauth", access: jwt, refresh: "", expires: 0 } })
return Object.keys(list).filter((id) => list[id].fast === true).sort()
}
// Opus 5.5 is fast at 300k only; Grok 4.7 at both sizes; Composer 2.5
// has no sizes; Haiku 5.5, Grok 4.6, Max Only and Auto have no fast
expect(await fastOf()).toEqual(["claude-opus-5-5@300k", "composer-2.5", "grok-4.7@256k", "grok-4.7@500k"])
// an account not served Opus 5.5's fast variants: not offered fast
// (Grok 4.7, which the usable list says nothing of, is kept whole)
expect(await fastOf(["claude-opus-5-5-medium", "claude-opus-5-5-high", "composer-2.5", "composer-2.5-fast"])).toEqual(["composer-2.5", "grok-4.7@256k", "grok-4.7@500k"])
// none served fast but Grok 4.7's 500k one, which has no id of its own
// for the usable list to leave out
expect(await fastOf(["claude-opus-5-5-medium", "composer-2.5", "grok-4.7-high"])).toEqual(["grok-4.7@500k"])
})
test("a request goes as the variant its size, effort and fast pick, in that variant's mode", async () => {
fakeAPI()
const raw = await usable(tok())
+14 -2
View File
@@ -542,17 +542,26 @@ function modelsOf(picker, ids) {
const id = m.name + "@" + c
if (used.has(id)) continue
used.add(id)
out.push({ ...base, id, name: base.title + " @ " + c, context: tokensOf(c) || DEFAULT_CONTEXT, size: c })
out.push({ ...base, id, name: base.title + " @ " + c, context: tokensOf(c) || DEFAULT_CONTEXT, size: c, offersFast: fastAt(variants, c) })
}
} else if (!used.has(m.name)) {
used.add(m.name)
const limit = needsMax(m, def) ? m.contextTokenLimitForMaxMode || m.contextTokenLimit : m.contextTokenLimit
out.push({ ...base, id: m.name === "default" ? "auto" : m.name, name: base.title, context: limit > 0 ? limit : DEFAULT_CONTEXT, size: "" })
out.push({ ...base, id: m.name === "default" ? "auto" : m.name, name: base.title, context: limit > 0 ? limit : DEFAULT_CONTEXT, size: "", offersFast: fastAt(variants, "") })
}
}
return out
}
// fastAt is whether Cursor has a fast variant the account is served at
// the context size (any, for a model without sizes): what magpie offers
// fast for, which 0.1.x said with a -fast model of its own.
const fastAt = (variants, size) =>
variants.some((v) => {
const have = valuesOf(v)
return have.fast === "true" && (!size || have.context === undefined || have.context === size)
})
// nearest is the variant of vs most like the parameters wanted, one at
// their context size before any other.
function nearest(vs, want) {
@@ -734,6 +743,9 @@ function runtimeModel(m) {
},
release_date: "",
variants: Object.fromEntries(efforts.map((e) => [e, { reasoningEffort: e }])),
// a request's service_tier priority (or fast) runs it as Cursor's fast
// variant: magpie offers Fast for the models that have one
...(m.offersFast ? { fast: true } : {}),
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/opencode-cursor-auth",
"version": "0.2.1",
"version": "0.2.2",
"description": "Cursor subscriptions (Pro, Pro+, Ultra, Teams) in OpenCode and magpie, through the API cursor-agent talks to",
"type": "module",
"main": "./index.mjs",