Skip to content

Architecture

Falco Schmutz edited this page Jul 7, 2026 · 1 revision

Architecture

Two independent front-ends over one shared data model (the API's limits[]).

claude-usage-panel@fschmutz.github.io/   # GNOME Shell extension (GJS / ESM)
├── extension.js        # panel button, dropdown, alerts, sparkline, Cursor section
├── prefs.js            # libadwaita preferences
├── stylesheet.css
├── schemas/            # GSettings schema
└── lib/
    ├── claudeUsage.js  # token read + /oauth/usage fetch + limits[] normalize
    ├── cost.js         # optional ccusage cost (subprocess)
    └── cursorUsage.js  # optional Cursor Admin API spend

macos/                  # native SwiftUI MenuBarExtra app (SwiftPM)
└── Sources/ClaudeUsagePanel/
    ├── Usage.swift               # token (file + Keychain) + fetch + normalize
    ├── Cost.swift                # ccusage via Process
    ├── Cursor.swift             # Cursor Admin API
    └── ClaudeUsagePanelApp.swift # MenuBarExtra, model, views, Settings

Data source

GET https://api.anthropic.com/api/oauth/usage with the local OAuth token and the anthropic-beta: oauth-2025-04-20 header. The response's limits[] array (kind / percent / severity / resets_at / scope.model) drives one card per limit. Everything is read-only with respect to the credentials.

Quality

pre-commit (ESLint, swift-format, shellcheck, shfmt, markdownlint, gitleaks) runs locally and in CI on every push.

Clone this wiki locally