Skip to content

Token Usage screen: provider quotas, cost stats, and tray/badge indicators #5733

Open

Description

@svenpeeters

What problem are you trying to solve?

Superset launches and babysits multiple AI coding agents, but gives no visibility into the one resource they all burn: provider quota. Today I alt-tab to claude.ai, the ChatGPT dashboard, or GitHub settings to learn whether a long agent run is about to hit a rate-limit wall, usually after it already has. Since Superset already knows which agents you run and has their CLIs' credentials on disk, it is the natural place to surface how much runway your agents have left and what it is costing you.

Proposed solution

A Token Usage screen in the desktop app (sidebar entry next to Tasks & PRs) that shows, per provider:

  • Rate-limit windows (e.g. Claude's 5-hour session + weekly buckets, Codex session/weekly) with a pace/reserve estimate: whether current usage lasts until the window resets.
  • Credits / manual resets where the provider exposes them.
  • 30-day cost & token stats estimated locally from the agents' own session logs (~/.claude/projects, ~/.codex/sessions) priced at API rates. No telemetry, everything stays on-device.
  • Ambient indicators: worst-window percentage in the macOS tray, a sidebar badge with a details popover, and notifications at 80%/95% usage. All three individually toggleable.

Data comes from the CLIs' own credential files (e.g. ~/.claude/.credentials.json/Keychain, ~/.codex/auth.json, ~/.config/github-copilot/hosts.json, ~/.gemini/oauth_creds.json) and the corresponding usage endpoints; providers without credentials collapse into a compact "no data yet" strip.

I have a working implementation on my fork (feat/desktop-token-usage, ~3.5k LOC incl. tests) covering Claude, Codex, Copilot, and Gemini, with the remaining built-in agents stubbed as unsupported. Amp/OpenCode need browser-cookie auth, so I left them out of scope for now. Happy to open the PR (or split it) once the approach is agreed on.

Implementation notes (for grooming):

  • Main-process collector with snapshot cache + disk persistence (usage-snapshot.json), 5-min background poll feeding tray/badge/notifications; per-provider 10s fetch timeout, last-good-value fallback, 429 backoff honoring Retry-After.
  • Providers plug into the shared agent registry (packages/shared/src/builtin-terminal-agents.ts), so new agents automatically appear as unsupported instead of being forgotten.
  • Renderer route /usage is fully data-driven; provider logos reuse the preset icon set.
  • Refreshed OAuth tokens are kept in memory only, to avoid racing the CLIs' own refresh logic. Gemini's public installed-app OAuth client is resolved at runtime from the user's gemini-cli install (never embedded, since GitHub push protection flags it).

Screenshots

Image Image Image Image

Activity

  1. IkramBagban commented on Jul 20, 2026

    @IkramBagban
    Contributor

    I am working on this.

    @Kitenite @svenpeeters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions