npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-kimi-code-console-usage

v0.1.4

Published

Monitor Kimi Code (coding plan) quota from inside pi: footer status, /kimi-usage command, and low-quota warnings

Readme

pi-kimi-code-console-usage

npm version

A pi extension that monitors your Kimi Code coding-plan quota from inside the terminal — no browser, no console tab.

Current week
███████                                            14% used
Resets Aug 3 at 4:25am (UTC)

Current 5h window
██████▌                                            13% used
Resets 10:25am (UTC)

Membership: Intermediate
Parallel sessions: 0 / 20

Features

  • Footer statuskimi 5h 13% · wk 14%, always visible. Turns warning-colored when a quota runs low; dims to kimi usage: error on fetch failure.
  • Polling — refreshes every 5 minutes (configurable), plus a throttled refresh after each agent run settles.
  • /kimi-usage command — fresh fetch rendered as an overlay: weekly quota bar, rolling 5-hour window bar, localized reset times, membership tier, live parallel-session count, and booster-wallet balance if you have one. Esc / q / Enter closes.
  • Low-quota warnings — one-shot notification when the 5h window drops to ≤15% remaining or the weekly quota to ≤20% remaining (both configurable). Latched per quota window, so each warning fires once and re-arms after the quota resets.
  • Zero auth setup — reuses the OAuth credential from your existing kimi-coding login, including transparent token refresh on expiry.

Prerequisites

  • pi with the kimi-coding provider logged in (/login kimi-coding), normally via the pi-provider-kimi-code package. This extension imports that package's auth and usage-client internals instead of duplicating them.

Install

pi install npm:pi-kimi-code-console-usage

Then /reload (or restart pi). The footer status appears after the first fetch; run /kimi-usage for the full view.

To install the bleeding-edge version straight from the repo instead:

pi install git:github.com/khaosoi/pi-kimi-code-console-usage

Update

pi checks for package updates at startup and tells you when one is available. To update:

pi update npm:pi-kimi-code-console-usage

Configuration

Environment variables:

| Variable | Default | Meaning | | --- | --- | --- | | KIMI_USAGE_POLL_MINUTES | 5 | Poll interval in minutes (minimum 1; 0 disables polling) | | KIMI_USAGE_WARN_5H_PCT | 15 | Warn when the rolling 5h window has ≤ N% remaining | | KIMI_USAGE_WARN_WEEK_PCT | 20 | Warn when the weekly quota has ≤ N% remaining |

The token source and base URL are inherited from pi-provider-kimi-code: the stored OAuth credential first, then KIMI_API_KEY; KIMI_CODE_BASE_URL / KIMI_BASE_URL overrides are respected.

How it works

Kimi Code exposes the same usage data shown in the web console at a read-only endpoint:

GET https://api.kimi.com/coding/v1/usages
Authorization: Bearer <your OAuth access token>

The response carries the weekly quota, the rolling 5-hour window, membership level, and active parallel sessions — all as plan-relative percentages with reset timestamps. A fresh (0% used) 5h window comes back as a limits row with only the window descriptor and no quota fields — the footer renders that as 5h 0% rather than hiding it. This extension fetches it with the token pi already stores for the kimi-coding provider (~/.pi/agent/auth.json), refreshing the token through the provider's own file-locked refresh path when it expires.

Privacy

  • The only network call this extension makes is GET to api.kimi.com/coding/v1/usages, authenticated with your own token.
  • No telemetry, no third-party endpoints, no data leaves your machine except the usage query above.
  • Your token is read from pi's auth store at runtime and is never logged, rendered, or written anywhere by this extension.

Caveats

  • The usages endpoint is undocumented (the provider package tracks the official Kimi Code CLI). If Kimi changes it, fetches fail gracefully: the footer shows kimi usage: error until it recovers.
  • This package depends on pi-provider-kimi-code internals (src/usage.ts, src/oauth.ts, src/device.ts), pinned to ^0.6.9. A provider upgrade that renames those exports would need a matching update here.
  • Quota numbers are percentages of your plan's allocation; absolute token counts are not exposed by the endpoint.

Development

git clone https://github.com/khaosoi/pi-kimi-code-console-usage
cd pi-kimi-code-console-usage
npm install          # installs pi-provider-kimi-code for import resolution
pi -e ./index.ts     # load from the working tree

The extension is a single index.ts, loaded by pi via jiti — no build step.

License

MIT