quota-bar Svelte Themes

Quota Bar

Windows tray app showing 5h quota for Codex and Claude. Two coloured bars, dynamic tooltip, in-app login via official CLIs, auto-updates.

QuotaBar

Windows tray app that keeps the 5-hour and 7-day quota windows for Claude and Codex visible at a glance, with countdowns to the next reset, an inferred API spend, and a subscription-tier badge.

Inspired by steipete/CodexBar (macOS). MIT licensed.

QuotaBar popover showing Claude Max 20x and Codex Pro 20x with usage bars, cost summary, and a 7-day sparkline

Features

  • Tray icon, two coloured bars. Top is Claude (#DE7356), bottom is Codex (#0EA982). When only one provider is signed in, the second bar shows that provider's 7-day weekly window instead. Repaints every 500 ms with an LRU PNG cache so most ticks are no-ops.
  • Click for the popover. Per-provider cards with 5h-session and 7d-weekly progress bars, exact percent remaining, and live countdowns to the next reset. Auto-hides on focus loss unless you pin it.
  • Subscription-tier badge. Each card surfaces the plan (Pro, Max 5x, Max 20x, Pro 20x, Team, ...) next to the provider name. Derived from Anthropic's subscription_type + rate_limit_tier and OpenAI's plan_type field.
  • API-usage cost. Reads ~/.codex/sessions/**/*.jsonl and ~/.claude/projects/**/*.jsonl, multiplies token counts by a per-model USD rate table (ported from CodexBar), and shows today's spend + the trailing 30 days. Click to expand per-model breakdown. A 7-day sparkline sits inline. Tiered pricing handled for Claude Sonnet >200k input and GPT-5 / 5.4 >272k input.
  • Idle-aware Claude bar. When Anthropic omits the 5h window after a long idle period, QuotaBar synthesises an "idle" placeholder so the bar stays visible instead of disappearing.
  • Toggle remaining vs used. Settings -> Display flips both the popover bars and the tray icon between "shrinks as you consume" (default) and "grows as you consume". Choice persists across restarts.
  • Notifications. Optional Windows toast when a 5h session crosses 90% used, deduped per resets_at so you only get one per window. On by default; toggle in Settings.
  • Pin + drag. Pin button keeps the popover open after focus loss. The header is a drag region — grab any empty space (cursor switches to the four-arrow move icon) to reposition the popover anywhere on screen.
  • Quota + status links. Inline icons on each card open the provider's usage dashboard and status page in the default browser.
  • Refresh diagnostics. Each card shows when it was last refreshed and how long the round-trip took (Refreshed 12s ago - 230ms).
  • Auto-update. New tagged releases install themselves on next 24-hour check (or click Updates in the popover).

Install

Grab the latest MSI from the Releases page. The installer is not currently EV-code-signed, so Windows SmartScreen may warn on first run - click More info -> Run anyway.

Once installed, QuotaBar auto-updates whenever a new tag is published.

Sign-in

  • Codex: install Codex CLI, run codex login. QuotaBar reads ~/.codex/auth.json and refreshes the token automatically after 8 days.
  • Claude: install Claude Code CLI, run claude /login. QuotaBar reads from the Windows Credential Manager or ~/.claude/.credentials.json, and falls back to the sessionKey cookie on claude.ai (Edge / Chrome / Brave) when the OAuth token is rejected.

You can also click Login inside the popover - QuotaBar will run the CLI for you, show the auth URL, and refresh once the CLI finishes.

How it works

+---------------------+         +-----------------------+
|  Tray icon (32x32)  | <------ |  tray ticker (500 ms) |
|  - top bar (Claude) |         |  - reads AppState     |
|  - bottom bar (Codx)|         |  - quantises % to 10s |
+---------------------+         |  - LRU caches PNG     |
                                +-----------------------+
                                          ^
                                          |
+---------------------+         +-----------------------+
|  Popover (Svelte)   | <------ |  AppState (RwLock)    |
|  - cards + countdown|         |  - per-provider       |
|  - cost + sparkline |         |    snapshot + status  |
|  - LoginDialog      |         |  - display mode       |
|  - UpdateBanner     |         |  - notify dedup       |
+---------------------+         +-----------------------+
        |                                 ^
        | invoke                          | update + cost
        v                                 |
+---------------------+         +-----------------------+
|  IPC commands       | ------> |  Scheduler            |
|  get_providers      |         |  - 1 task / provider  |
|  refresh_now        |         |  - 60 s + jitter      |
|  login_provider     |         |  - exp back-off       |
|  set_display_mode   |         |  - 90% toast hook     |
|  set_pinned         |         +-----------------------+
|  set_notifications  |                   ^
+---------------------+                   |
                                  +---------------+
                                  | Provider trait|
                                  +---------------+
                                  | CodexProvider |  -> wham/usage
                                  | ClaudeProvider|  -> oauth/usage
                                  |               |  -> claude.ai web
                                  +---------------+

                  +-----------------------------+
                  |  cost::CostTracker          |
                  |  - scans codex/claude logs  |
                  |  - per-model pricing table  |
                  |  - 5 min cache              |
                  +-----------------------------+

Provider trait: add one folder + register one line to ship a third provider.

Develop

pnpm install
pnpm tauri dev

The tray icon appears in the notification area. Left-click toggles the popover; right-click opens the menu.

Tests

cd src-tauri
cargo test --lib              # all unit tests (124 at v0.2.5)
cargo test --lib smoke -- --ignored --nocapture   # real-API smoke tests
pnpm exec svelte-check --tsconfig ./tsconfig.json

Logs

Runtime logs land in %APPDATA%\QuotaBar\logs\quotabar.<date>.log (daily rotation, 7-day retention).

Build + release

pnpm tauri build

Outputs MSI to src-tauri/target/release/bundle/msi/ and NSIS installer under bundle/nsis/.

See docs/RELEASING.md for cutting a signed release through GitHub Actions.

License

MIT - see LICENSE.

Top categories

Loading Svelte Themes