provider: Fable 5.2 counts in the Claude card's Fable week

aipha2025 on X asked to see Fable 5.2's allowance. Claude Code 2.1.321's
/usage, run for real on a Team account in a sandbox config dir (the
token it renewed written back to the account's keychain item), tells
one Fable week ("Current week (Fable): 0% used · resets Nov 11 at 6am"),
which magpie already shows as "7 days · Fable" and which claude-fable-*
counts against. The test holds those bytes and checks 5.2 and 5.1 both
stop at a spent Fable week while Opus doesn't.

The launch's limit resets are not shown and can't be used from magpie:
- /usage -p prints no reset; Claude Code reads them from its own usage
  call (cedar_ember) and spends them with /limit-reset, a hidden,
  interactive-only command behind a per-account flag, which POSTs
  /api/organizations/<org>/reset_rate_limits.
- On the three accounts tried (Team, two Max 20x) the Fable reset
  program is off: /limit-reset said "A 5-hour limit reset isn't
  available right now", Team's said "Unknown command".
- magpie never calls Anthropic's endpoints as Claude Code, and a spend
  can't be tried without a reset to spend, so nothing is offered; the
  user spends one in claude.ai Settings > Usage or Claude Code's
  /limit-reset.

Run at this tree (mote): the provider package's Claude tests with
the agent and gateway runs in the commit before; gofmt and the three
vets clean.

Rebased onto b681b036d (53b2773d7 changed provider pricing) and run
again at this tree on mote: gofmt clean, vet ok; agent 121s, gateway
175s, provider 46s ok with -run
"Fable|Claude|Fast|Vertex|Bedrock|Effort|Thinking|Xhigh|XHigh|Desktop|Sampling|Adaptive|Price|Catalog".
The full ./... suite runs after the push; a red gets an issue.
This commit is contained in:
yetone
2026-11-10 05:03:10 +08:00
parent 6fe754cb20
commit b27b660467
+27
View File
@@ -44,6 +44,33 @@ Current week (Fable): 64% used · resets Jul 24 at 8pm (UTC)`, now)
}
}
// Claude Code 2.1.321's /usage on a Team account the day Fable 5.2
// launched, word for word: its one Fable week holds Fable 5.2 too.
func TestClaudeFable52CountsInTheFableWeek(t *testing.T) {
now := time.Date(2026, 11, 9, 21, 0, 0, 0, time.UTC)
ws, err := parseClaudeUsage(`You are currently using your subscription to power your Claude Code usage
Current session: 0% used · resets Nov 10 at 5:40am (Asia/Shanghai)
Current week (all models): 0% used · resets Nov 11 at 6am (Asia/Shanghai)
Current week (Fable): 0% used · resets Nov 11 at 6am (Asia/Shanghai)`, now)
if err != nil {
t.Fatal(err)
}
if len(ws) != 3 || ws[2].Name != "7 days · Fable" || ws[2].Model != "fable" {
t.Fatalf("windows: %+v", ws)
}
ws[2].Used = 100
a := allowanceOf(ws, now)
for _, m := range []string{"claude-fable-5-2", "claude-fable-5-1"} {
if used, _ := a.For(m, now); used != 100 {
t.Fatalf("%s: %v", m, used)
}
}
if used, _ := a.For("claude-opus-5-5", now); used != 0 {
t.Fatalf("opus: %v", used)
}
}
func TestClaudeScopeModel(t *testing.T) {
for in, want := range map[string]string{"Fable": "fable", "Fable 5.1": "fable-5-1", "": ""} {
if got := claudeScopeModel(in); got != want {