Skip to content

About

Claude Code and Kimi Code plan usage in the GNOME top bar: percent consumed, reset times, and tokens spent today and this week

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

agent-usage

CI License: MIT GNOME Shell 48 to 50

Claude Code and Kimi Code plan usage in the GNOME top bar.

The panel indicator and its popup, in the shell's dark style and its light style

  • Plan usage from the provider. How much of each quota window is used, read from the provider's own API, never estimated: Claude Code's 5-hour and weekly windows, Kimi Code's 5-hour window and plan. Bars turn amber at 75% and red at 90%.
  • Tokens and requests today and over the last 7 days, counted from the local session logs, which keep working when a quota endpoint does not. The terminal view also splits today by model.
  • Says how old the figures are. Each agent shows when its quota was last fetched, and a reading that could not be refreshed is marked as last known.
  • A terminal view, agent-usage, with the same reading on any desktop.

Requirements

  • GNOME Shell 48, 49 or 50 for the panel indicator. The shell will not load an extension whose metadata.json does not list its version.
  • Python 3.8 or newer, standard library only.
  • A systemd user session to run the collector. Without one, run agent-usage --daemon yourself.
  • Claude Code or Kimi Code, signed in with a subscription. An API-key sign-in gives token counts but no quota bars, because the quota is per plan.

There is no key to paste: the collector uses the token each tool saved when you signed in. A tool that is not installed is not shown.

Install

git clone https://github.com/pgiahuy/agent-usage.git && cd agent-usage
./install.sh

Log out and back in once. GNOME Shell only picks up a new extension at login.

Everything goes under your home directory:

Path Contents
~/.local/share/agent-usage/ the collector
~/.local/bin/agent-usage the command
~/.local/share/gnome-shell/extensions/agent-usage@pgiahuy.github.io/ the extension
~/.config/systemd/user/agent-usage.service the service
~/.cache/agent-usage/ readings and ring icons

To upgrade, run ./install.sh again. It reloads the indicator without a logout, except when extension.js or metadata.json changed or the previous install had no preferences page; it says so when that happens.

For a system-wide .deb or an APT repository, see docs/packaging.md.

Usage

Click the indicator for the popup. Refresh fetches the quota now rather than at the next check, unless the last reading is under 30 seconds old or the provider is rate-limiting, and renews a token that has expired.

The settings are under Agent Usage in the Extensions app: how often to check quota (2 to 60 minutes, default 5), which agents to show, the popup layout (tiles, compact or large numbers) and the panel style (ring or text).

From a terminal:

agent-usage            # the reading
agent-usage --json     # the reading as JSON
agent-usage --daemon   # the collector, in the foreground

If Claude Code or Kimi Code keeps its data elsewhere, set CLAUDE_CONFIG_DIR or KIMI_CODE_HOME in ~/.config/environment.d/agent-usage.conf, since a systemd user service does not read your shell profile:

CLAUDE_CONFIG_DIR=/data/claude
KIMI_CODE_HOME=/data/kimi-code

Then log out and back in, or run systemctl --user daemon-reload && systemctl --user restart agent-usage.

Troubleshooting

Run the read-only check first. It names the problem and the command to fix it.

./tools/doctor.sh
  • Nothing in the panel. Usually one of: the session was not restarted after the install; user extensions are switched off (gsettings get org.gnome.shell disable-user-extensions prints true); or GNOME Shell is newer than extension/metadata.json lists.
  • "agent-usage daemon is not running". Check systemctl --user status agent-usage and journalctl --user -u agent-usage -n 50.
  • "rate limited, retrying in ...". The provider limits how often its usage endpoint is asked. The collector backs off on its own and keeps the last reading on screen.
  • Kimi shows "token expired". Press Refresh. If it then says "kimi is running", the token renews the next time that kimi session talks to Kimi.

Uninstall

./uninstall.sh           # keeps the cache and the settings
./uninstall.sh --purge   # also deletes ~/.cache/agent-usage and resets the settings

The indicator leaves the panel at once, or at the next login if GNOME Shell cannot unload it.

Privacy

The collector talks only to the providers, with your own credentials: quota checks to api.anthropic.com and api.kimi.com, and on Refresh, a token renewal. There is no telemetry. SECURITY.md lists what it reads, sends and writes, and how to report a vulnerability.

Contributing

Issues and pull requests are welcome: see CONTRIBUTING.md and docs/hacking.md. Participation is covered by the code of conduct. Changes are listed in CHANGELOG.md.

License

MIT

About

Claude Code and Kimi Code plan usage in the GNOME top bar: percent consumed, reset times, and tokens spent today and this week

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages