Skip to content

Repository files navigation

Kimi Code Indicator

A GNOME Shell extension that displays your Kimi Code subscription usage as a compact circular indicator in the top panel.

Screenshot

Features

  • Outer Ring — Session usage (5-hour rolling window)
  • Inner Circle — Weekly usage
  • Clock Hand — A pointer rotating around the ring, indicating how far through the current session window you are (0% at start → 100% at reset)
  • Popup Menu — Click the indicator to see exact percentages with time-to-reset in parentheses (e.g. Weekly: 5% (6d 19h)), your membership plan, parallel request limit, and a manual refresh button
  • Auto Refresh — Fetches data every 60 seconds (configurable)
  • Retry on Failure — If the initial fetch fails, retries 3 times with 1s / 2s / 4s backoff

Installation

make all
cp -r . ~/.local/share/gnome-shell/extensions/kimi-code-usage@lanesun.anlbrain.com/
glib-compile-schemas ~/.local/share/gnome-shell/extensions/kimi-code-usage@lanesun.anlbrain.com/schemas/

Restart GNOME Shell (log out and back in on Wayland), then enable the extension:

gnome-extensions enable kimi-code-usage@lanesun.anlbrain.com

API Key Setup

The extension fetches usage data from https://api.kimi.com/coding/v1/usages, which requires a Kimi Code API key.

How to get the API key

  1. Log in to kimi.com/code
  2. Create an API key in your console
  3. The key looks like sk-kimi-...

Configure the extension

  1. Open the extension settings (via Extensions app or gnome-extensions prefs kimi-code-usage@lanesun.anlbrain.com)
  2. Under Kimi Code, paste the key into the API Key field and confirm
  3. The indicator fetches data immediately on next enable, and refreshes every 60 seconds

Customization

All visual parameters are configurable in the settings:

Setting Description
Ring Color / Thickness / Gap Outer ring appearance (session usage)
Circle Color / Radius Inner circle appearance (weekly usage)
Hand Color / Length / Thickness Clock hand appearance
Hand Outline Color / Width Hand border for visibility
Panel Position Left / Center / Right
Position Index Sort order within the panel
Update Interval Auto-refresh interval in seconds (default: 60)

Data Source

The extension sends an authenticated GET request to https://api.kimi.com/coding/v1/usages (same endpoint used by cc-switch for quota display) with an Authorization: Bearer <API key> header and parses the JSON response:

  • usage — weekly quota (used / limit, resetTime)
  • limits[] — rolling windows; the 300-minute (5h) entry is the session quota
  • user.membership.level — membership plan shown in the menu
  • parallel.limit — max parallel requests shown in the menu

If the fetch fails or returns no quota data, all indicators show 0% and the popup menu displays the failure reason. The last successful reading stays visible while transient failures recover.

License

MIT

About

A GNOME Shell extension that displays your Kimi Code subscription usage as a compact circular indicator in the top panel.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages