Skip to content

feat: add Kimi (Moonshot) coding provider - #33

Closed
lamchun1110 wants to merge 1 commit into
deviffyy:mainfrom
lamchun1110:feat/kimi-provider
Closed

feat: add Kimi (Moonshot) coding provider#33
lamchun1110 wants to merge 1 commit into
deviffyy:mainfrom
lamchun1110:feat/kimi-provider

Conversation

@lamchun1110

Copy link
Copy Markdown
Contributor

Adds a Kimi provider so OpenQuota can show Kimi Coding usage alongside the other AI coding tools.

What

  • New provider at providers/kimi/ (modeled on providers/zai/): client, mapper, auth, mod.
  • Reports two quotas using the existing naming convention:
    • Session — the 5-hour rolling window (limits[0].detail)
    • Weekly — the main usage quota (usage)
  • Source: GET https://api.kimi.com/coding/v1/usages, Bearer API key.
  • Key is stored in the OS keychain (or KIMI_API_KEY / ~/.config/openquota/kimi.json), wrapped in Zeroizing, never logged — same posture as Z.ai/OpenRouter.
  • Registered in the runtime list (lib.rs), declared in providers/mod.rs, covered by the provider-registry contract (scripts/verify/verify-provider-registry-contract.js) and the provider-links test.
  • Unit tests: captured payload mapping, missing/invalid/rate-limited key distinction, optional rolling window, plan-level title-casing.

Verification

  • `cargo test -p openquota kimi` — 6/6 passing
  • `pnpm verify:contracts` — 11 runtimes; `pnpm check` — 0 errors

Caveat

The `/coding/v1/usages` endpoint is undocumented (discovered against the live API). The response shape has been stable in practice, but field paths may need adjustment if Moonshot changes it. Happy to gate behind a feature flag or adjust paths on request.

Contributed under the repo's MIT license. Built/tested on Linux and macOS.

Adds a Kimi provider reporting Session (5-hour rolling window) and Weekly
(main usage) quotas from GET https://api.kimi.com/coding/v1/usages using a
Bearer API key. Modeled on providers/zai: client + mapper + auth, keychain-
backed key (zeroized), with unit tests for the captured payload, error
states, and plan detection. Registered in the runtime list and covered by
the provider-registry contract and links test.
@lamchun1110

Copy link
Copy Markdown
Contributor Author

Superseded by #38, which combines Kimi and MiniMax into a single PR. The two were split across branches that touch the same shared files (registry, contract test, icon map) and would conflict on merge, and #38 also includes the status-bar icon fix so the logos render in the menu bar. Closing in favor of #38.

@lamchun1110 lamchun1110 closed this Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant