Skip to content

feat: add per-model 7-day usage breakdown in popup menu - #22

Open
ThomasSAMP wants to merge 4 commits into
Haletran:mainfrom
ThomasSAMP:feat/per-model-weekly
Open

feat: add per-model 7-day usage breakdown in popup menu#22
ThomasSAMP wants to merge 4 commits into
Haletran:mainfrom
ThomasSAMP:feat/per-model-weekly

Conversation

@ThomasSAMP

Copy link
Copy Markdown

Summary

Adds optional per-model 7-day usage sections to the popup menu, in addition to the existing global 5-hour and 7-day windows.

The Anthropic OAuth /api/oauth/usage endpoint exposes per-model 7-day windows alongside the global ones (seven_day_opus, seven_day_sonnet, seven_day_oauth_apps, etc.). This PR auto-discovers any
seven_day_<name> keys in the API response and renders one section per non-null entry, so the menu reflects exactly what the user's plan exposes — no schema churn needed if Anthropic adds new model-specific
quotas later.

What's new

  • Auto-discovered per-model sections — for every non-null seven_day_<name> field, render a section with title, percentage, progress bar, and reset time
  • Friendly labels for known suffixes (opus → "Opus", sonnet → "Sonnet", haiku → "Haiku", oauth_apps → "OAuth Apps") with a titlecased fallback for anything else
  • show-per-model-weekly setting (default: on) controlling visibility of the whole block
  • New "Menu Display" preferences group containing the toggle
  • The block hides itself silently when the API returns no per-model data (e.g. Pro plan), so there's no visual noise for users who don't have these quotas

Screenshots

claude-usage-feature

Test plan

  • Tested on Fedora 43 + GNOME Shell on Wayland (Max plan)
  • Verified API response shape with curl against /api/oauth/usage
  • Verified popup menu shows new sections after relogging
  • Verified toggling show-per-model-weekly in settings hides/shows the block live
  • Verified null entries are filtered (Opus / OAuth Apps / Cowork hidden when not on those quotas)
  • Verified {utilization: 0, resets_at: null} entries render as "0.0%" / "Not used yet"

Notes

  • No new CSS — reuses existing claude-usage-section, claude-section-title, claude-percent-label, claude-progress-bg, claude-progress-bar, claude-reset-label style classes
  • No new dependency
  • Schema gettext-domain unchanged
  • Compatible with the existing GNOME Shell version range declared in metadata.json (46–49)

Add a boolean setting to control whether the popup menu shows
per-model 7-day usage sections (e.g. Opus, Sonnet) when exposed
by the API.
Auto-discover seven_day_<model> keys in the API response and
render one section per non-null entry under the global 7-day
section. Keys map to friendly names for known models (Opus,
Sonnet, Haiku, OAuth Apps) and fall back to a titlecased
suffix for unknown codenames.

The whole block hides silently when the API returns nothing
useful or when show-per-model-weekly is off.
Add a new "Menu Display" preferences group containing a
SwitchRow bound to show-per-model-weekly. Document the new
feature in the README.
The Anthropic web UI surfaces the seven_day_omelette quota as
"Claude Design". Add the mapping to PER_MODEL_LABEL_MAP so the
popup menu uses the same friendly label as claude.ai.
imajus added a commit to imajus/claude-usage-extension that referenced this pull request May 16, 2026
From Haletran#22 (Thomas).

Adds optional per-model 7-day sections (Opus/Sonnet/Haiku/OAuth Apps/etc)
auto-discovered from API response, gated behind a 'show-per-model-weekly'
setting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant