Skip to content

fix(kimi): read the usages.limit_* quota shape before the legacy one - #30

Merged
vadymhimself merged 1 commit into
release/2.65.0-vadymhimself.15from
gauge/kimi-limits-rebased
Nov 15, 2026
Merged

vadymhimself merged 1 commit into
release/2.65.0-vadymhimself.15from
gauge/kimi-limits-rebased

Conversation

@vadymhimself

Copy link
Copy Markdown
Collaborator

Why

Kimi's GET /coding/v1/usages now answers with a usages object (limit_5h, limit_7d, limit_month_total, limit_month_code, each {used_ratio 0..1, reset_time}), the shape Kimi's own client reads (MoonshotAI/kimi-code packages/oauth/src/managed-usage.ts). The gateway only read the legacy limits[] / totalQuota blocks, so Kimi limits showed wrong. This is #6, rebased onto the current release line.

What

  • src/providers/quota/vendor-probes-key.ts: when usages is present, only limit_5h (5-hour), limit_7d (weekly) and limit_month_total (monthly) are read, and the legacy blocks are ignored. Ratios may be numbers or numeric strings; a missing or non-finite ratio is skipped. Without usages, the legacy parse is unchanged.
  • Version 2.65.0-vadymhimself.24 through release-version-sources sync (all 4 sources).

Tests

  • tests/providers/provider-quota.test.ts: the main case loads Kimi's documented payload from fixtures/external/kimi/ (copied from the vendor client's own test, README says so; no live body has been recorded). Two edge cases (legacy blocks next to usages are not read; 0, string and missing ratios) are marked as edge input, not provider samples.
  • Run alone and green: provider-quota (all Kimi cases), provider-api-keys, file-size ratchet (baseline +13 lines for the test file), test-layout, test-layout-tooling, release-version-sources, privacy-scan.

Eval added/updated: a Kimi usages answer in the vendor's documented shape shows 30% 5-hour, 20% weekly and 40% monthly, and legacy placeholder blocks beside it are ignored.

Supersedes #6.

🤖 Generated with Claude Code

…(rebased #6)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Nov 15, 2026
@vadymhimself
vadymhimself merged commit aa80674 into release/2.65.0-vadymhimself.15 Nov 15, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants