commandcode 0.1.13: the Credits window renews at the plan's period end, the CLI's free models are free, and a Go request's max_tokens stays within 200,000

Three things magpie's built-in Command Code did that the plugin didn't,
ahead of retiring the built-in:

- The Credits window had no reset, though the month's credits come back
  when the plan's period ends, which billing/subscriptions' currentPeriodEnd
  says (sub.until, already the card's "until"). allowanceOf now puts it on
  the window as resetsAt (yetone/magpie#2454). No period end, no reset.
- The models the CLI marks FREE (magpie's cmdFree, all 11: Space Bunny
  Alpha, Pixel Canary, Laguna S 2.1, the Ling 3.0/3.1 Flash ones, the
  MiniMax M3/M2.7 free ids, LongCat 2.0 free, Tencent Hy3) now say
  free: true on every list: the Provider API's, Go's, and Go's table when
  the list can't be had.
- A Go chat's max_tokens sent to /alpha/generate is kept within 200,000,
  the most Command Code takes ("Too big: expected number to be <=200000
  at params.max_tokens"; magpie's CommandCodeMaxOutput in cmdRequest).
  Before, a 384,000 ask failed the whole request.

Run: bun test in packages/commandcode: 49 pass, 0 fail. parity.test.mjs
is new; usage.test.mjs's two plan-with-period cases now expect the reset.
Broke each by hand and watched red: no resetsAt, 3 fail; no free flag,
3 fail; no cap, 1 fail. bun scripts/check.mjs commandcode: ok.
Live, with the owner's GOAT key: the card's Credits window says resetsAt
2026-10-28T16:16:42Z, the subscription's until; its list (71 models) has
poolside/laguna-s-2.1-free free, the only one of the 11 Command Code lists
today. Not tried live: a Go request over 200,000 (no Go key here).
This commit is contained in:
yetone
2026-10-16 17:37:25 +08:00
parent 0c35adbf03
commit 8fc3833aa7
4 changed files with 151 additions and 8 deletions
+2 -2
View File
@@ -43,7 +43,7 @@ test("a Max account: its 5 hours, its week and its credits, and its period", asy
windows: [
{ name: "5 hours", used: 25, span: 18000, resetsAt: new Date(reset).toISOString() },
{ name: "Weekly", used: 10, span: 604800, resetsAt: new Date(week).toISOString() },
{ name: "Credits", used: 30.9375, display: "$49.50 / $160.00" },
{ name: "Credits", used: 30.9375, display: "$49.50 / $160.00", resetsAt: "2026-10-28T00:00:00.000Z" },
],
})
expect(seen.every((x) => x.auth === "Bearer own-key")).toBe(true)
@@ -90,7 +90,7 @@ test("seconds and string amounts read as magpie reads them; a half cent goes to
signIn: "kept",
plan: "Pro",
until: new Date(1790000000 * 1000).toISOString(),
windows: [{ name: "Weekly", used: 100, span: 604800 }, { name: "Credits", used: 0.4166666666666667, display: "$0.12 / $30.00" }],
windows: [{ name: "Weekly", used: 100, span: 604800 }, { name: "Credits", used: 0.4166666666666667, display: "$0.12 / $30.00", resetsAt: new Date(1790000000 * 1000).toISOString() }],
})
})