MoonshotAI / MoonshotAI/kimi-code
/coding/v1/usages returns zeroed usedRatio on both rate windows during verified usage
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
Summary
GET /coding/v1/usages (both api.kimi.com and api.kimi.ai) returns usedRatio: 0 for both rate windows (limit5h, limit7d) at all times for this account — including during verified heavy usage — while the web app's GetSubscriptionStats shows the real ratios for the same windows with identical reset timestamps.
Environment
- kimi CLI 0.43.1 on Linux
- Account: Allegro (legacy plan), REGION_OVERSEA, userId
dafi9ks8k36dhc0j4eh0 - Auth: CLI OAuth login (managed service), no API key involved
Steps to reproduce
- Log in via the CLI OAuth flow.
- Consume real quota: a single session this morning used 10.6M tokens (K3 / K3-256k models) over ~2.5 hours.
- During the session,
GET https://api.kimi.com/coding/v1/usageswith the OAuth access token (also triedapi.kimi.ai).
Observed
{"code":0,"data":{"kind":"ok","quota":{"extraUsage":null,"usages":{
"limit5h":{"resetAt":"2026-09-18T12:07:12Z","usedRatio":0},
"limit7d":{"resetAt":"2026-09-23T23:07:12Z","usedRatio":0}}}}}
Both windows read integer 0, on both regional endpoints, at every hour tested. The same zero shows in the CLI's own /usage panel (which reads this endpoint): "5h limit 0% used / Weekly limit 0% used" — while the same panel reports 10.6M tokens of session usage.
Expected vs actual (same account, same minute)
The web app (www.kimi.ai/settings/subscription) calls GetSubscriptionStats and shows real figures for the same windows:
{"ratelimitCode5h":{"ratio":0.1719,"resetTime":"2026-09-18T12:07:12.717Z"},
"ratelimitCode7d":{"ratio":0.346,"resetTime":"2026-09-23T23:07:12.717Z"},
"subscriptionBalance":{"amountUsedRatio":0.0711,"expireTime":"2026-10-10T00:00:00Z"}}
Reset instants match the /usages payload to the second — same windows, different numbers. The endpoint returns correct reset boundaries with zeroed ratios.
Notes
- The CLI's own bundled schema declares
usedRatioas a float (number()), so integer-zero emission under verified load looks like a server-side counter/serialization bug rather than intended behaviour. - No
limit_month_total/limit_month_codeentries are present in the response, though the CLI schema supports them. - Related: #1569 (
totalQuotaalways 99), #2937 (third-party quota display policy). This report is specifically about the returned ratios being zero during real usage.
Ask
- Fix
/coding/v1/usagesto return the true per-window ratios, or document the intended semantics if 0 is meaningful here. - Alternatively, expose the subscription-stats figures (5h / 7d / monthly code usage) on the coding API so first-party and opt-in third-party tooling can read real quota state.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the CLI /usage panel to the request for GET /coding/v1/usages, then inspect the bundled schema that defines usedRatio. Compare the displayed values with the raw response and the documented subscription-stats values; done means the CLI exposes accurate window ratios or clearly documents the endpoint's intended zero semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cli, typescript
- Domain
- api, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100