lidazi2016 on Discord (#feedback): a Kimi Code plan has a 5-hour, a
weekly and a monthly limit, and magpie showed only the first two.
Kimi's /coding/v1/usages tells a plan on its monthly allowance in a
third block magpie didn't read: "usages", each entry a share
{"used_ratio", "reset_time"} keyed limit_5h, limit_7d,
limit_month_total and limit_month_code. kimi-cli 1.52.0 (the Python CLI,
latest on PyPI) reads only "usage" and "limits"; Kimi's newer kimi-code
(MoonshotAI/kimi-code, packages/oauth/src/managed-usage.ts and
apps/kimi-code/src/utils/usage/usage-format.ts) reads "usages" and shows
"5h limit", "Weekly limit" and "Monthly limit" from limit_5h, limit_7d
and limit_month_total. limit_month_code is the part of the month code
has used, drawn on limit_month_total, not an allowance of its own.
readKimiCode now reads usages the same way: limit_5h as "5 hours",
limit_7d as "7 days", limit_month_total as "Month" (30-day Span, reset
at its reset_time, the name Volcengine, Tencent, Cline and Ollama's
month windows already use, translated in zh, zh-TW, ja and de), and
leaves limit_month_code out. A window told both ways (the 300-minute
limits[] entry beside limit_5h, the weekly usage beside limit_7d) is the
share's, as kimi-code takes it; a share that isn't a number is skipped
and the counted window stands. The windows come shortest first.
Test: TestReadKimiCodeMonth. Its first body is a live reply of
2026-09-23 posted in narumiruna/pi-extensions#1390 (limits[] + usages
with limit_5h, limit_month_total, limit_month_code, no weekly usage);
the second has every window kimi-code reads, plus usage and limits[];
the third a null used_ratio. With planquota.go put back to origin/main
it fails: "planquota_test.go:462: [{... Name:5 hours Used:44 ...}]", the
month missing; with the change it passes. TestReadKimiCode (the counted
shape) passes unchanged.
Run on mote (mote-run): gofmt -l (nothing), go vet -tags nogui ./...,
GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go build,
GOOS=linux go build -tags nogui, GOOS=windows go build, and go test
-tags nogui -count=1 -timeout 45m on internal/provider, internal/gui,
internal/tui, internal/cli, internal/usage and internal/usageapi:
all ok (provider 290s, gui 195s, tui 28s, cli 155s, usage 101s, usageapi 2s).
Not run: the whole go test ./... (mote was at load ~99 running two other
sessions' full suites; one suite a machine), and the GUI suite (no
change under internal/gui/assets; "Month" and its translations are
already there). Not tried: a real Kimi Code account or key; the reply
shape is Kimi's own client's parser and a live reply posted by another
user, not one read here.