Files
magpie/internal
yetone cf3a2cc838 provider: Kimi Code's month read however /usages tells it, on every route
lidazi2016 (Discord) still saw no monthly limit on v0.1.2023 with a Kimi
Code China API key: the card had 5h and 7 days only. 296f66a74 read the
month from usages.limit_month_total alone. Other ways Kimi tells it went
unread:

- the membership of 2026-09 sends limit_5h and limit_month_code with no
  total (GCMP's kimiUsage.ts); limit_month_code is now the month when
  limit_month_total isn't there;
- a share under its camelCase name (limitMonthTotal, usedRatio,
  resetTime) and a reset as epoch seconds or milliseconds (EchoBird's
  fixture);
- a limits[] window counted in TIME_UNIT_WEEK or TIME_UNIT_MONTH, which
  was "Allowance" with no length.

Every way to add a Kimi Code key reaches the same reader through
planQuotaSourceOf: the kimi-code-cn and kimi-code presets, a provider of
the user's own at https://api.kimi.com/coding (Anthropic base alone), and
an OpenCode auth.json import (kimi-code-plan-cn / -global). There is no
Kimi Code sign-in in magpie. TestPlanQuotasKimiCodeMonthEveryRoute saves
one of each and checks each card's month through PlanQuotas.

Probed with the owner's kimi-code-cn key (read only): GET
api.kimi.com/coding/v1/usages answers 200 {} for that lapsed membership,
so it says nothing about an active one. token-monitor reads the Kimi
console's monthly pool from the kimi.com web API
(MembershipService/GetSubscriptionStats subscriptionBalance) with the
web sign-in's token, not the key; if /usages doesn't carry the month for
an API key, this change can't show it, and that web route is not added.

Run (mote, at this tree rebased on origin/main 4534561f6; also ran at bb3565309 before the rebase):
- go test -tags nogui -count=1 -timeout 45m ./internal/provider/: ok
- go vet ./internal/provider/ for darwin, GOOS=linux and GOOS=windows: ok
- gofmt -l internal/provider/: empty

Broken by hand: the old planquota.go with these tests is red in all
three TestReadKimiCodeMonthEveryWay cases, the week-and-month case, and
all four routes of TestPlanQuotasKimiCodeMonthEveryRoute.

Not tried: a real active Kimi Code China or global key; the reporter's
own /usages reply has not been seen.
2026-10-29 17:23:44 +08:00
..
…
…
…
…
…
…