Copilot Premium Usage Monitor
Visual Studio Code extension to view your GitHub Copilot Premium (Request SKU) usage and stay within a self‑defined monthly budget – right from the status bar & a rich panel. ⚡ Quick Start
You’ll immediately get a status bar percentage + progress bar. Open the panel for detail, mode switching, and help. 📸 ScreenshotsDark mode
Light mode
✨ Key Features
🔐 Authentication & Modes
PAT scope: Use a classic or fine‑grained token that includes Plan: read-only. A VS Code GitHub auth session does NOT currently provide that permission for personal spend endpoints. Secure Storage Migration (Important)Previous versions stored the Personal Access Token (PAT) in your settings (
To reduce risk the extension now uses VS Code Secret Storage (backed by your OS keychain / credential manager). The legacy setting is deprecated and automatically migrated the first time a secure read/write occurs. After migration the plaintext value is cleared (unless you choose otherwise) and the token lives only in the encrypted/keychain store. What you need to know:
Commands related to secure storage:
Tips:
Why this matters: PATs grant access to billing endpoints and can sometimes reveal account information. Keeping them out of plaintext settings reduces accidental disclosure vectors (sync, dotfile commits, remote pair sessions, screenshots) with zero extra steps after migration. Nothing else about usage collection changes – the extension still only talks to Secure Token IndicatorThe panel shows a pill in the upper area once a secure token exists:
If you keep the plaintext value temporarily, functionality is unchanged; the indicator just reminds you to remove the redundant risk surface. Once cleared, the indicator flips to the green secure state automatically. ⚙ Settings (prefix:
|
Setting | Type | Default | Description |
---|---|---|---|
budget |
number | 10 | Monthly USD budget you configured on GitHub Billing Budgets page. |
mode |
enum auto|personal|org |
auto | Data source selection. Auto = org if set, else personal. |
org |
string | "" | GitHub organization login for org metrics. Leave blank for personal. |
token |
string (machine) | "" | PAT with Plan: read-only for personal spend. Marked machine‑overridable to avoid sync to cloud. |
warnAtPercent |
number | 75 | Warning threshold (percent used). 0 disables warning color. |
dangerAtPercent |
number | 90 | Danger threshold. 0 disables danger color. |
refreshIntervalMinutes |
number | 15 | Auto refresh interval (min 5). Personal mode only currently fetches spend. |
statusBarAlignment |
enum left|right |
left | Where to place status item. |
showLogOnError |
boolean | false | Open log channel automatically on first error. |
useThemeStatusColor |
boolean | true | Use theme default color when normal (higher contrast). Disable to always colorize. |
statusBarIconOverride |
string | "" | Optional Codicon (e.g. graph , pulse , dashboard ). Invalid names produce a one‑time warning & banner. |
disableFirstRunTips |
boolean | false | Hides the first‑run info banner permanently (re‑enable via command). |
Settings Sync Guidance
It’s safe to sync everything except the token. Add to ignored settings:
"settingsSync.ignoredSettings": ["copilotPremiumUsageMonitor.token"]
🧪 Commands (Command Palette)
Command | Purpose |
---|---|
Copilot Premium Usage Monitor: Open | Show panel (primary UI). |
Copilot Premium Usage Monitor: Sign in to GitHub | Acquire VS Code GitHub auth session (read:org ). |
Copilot Premium Usage Monitor: Choose Organization | Quick pick organization & store in settings. |
Copilot Premium Usage Monitor: Manage | Open filtered settings view. |
Copilot Premium Usage Monitor: Show Logs | Open Output Channel for diagnostics. |
Copilot Premium Usage Monitor: Re-enable First-run Tip | Resets the dismiss state of the help banner. |
🖥 Usage Flow
- Set
budget
and (optionally)org
. - Add PAT (for personal spend) OR sign in (for org metrics).
- Status bar shows: an icon, a percentage and a small progress bar; a
(stale)
tag appears only after errors. - Tooltip reveals dollars, thresholds, last (successful) sync with relative time.
- Panel: Press Refresh, change Mode, open Settings, Help, or Sign in.
Color logic: green (under warn), yellow (>= warn), red (>= danger), error styling (API/auth failure), inheriting theme foreground if useThemeStatusColor
is true and you’re below thresholds.
🛠 Troubleshooting & FAQ
Symptom | Likely Cause | Fix |
---|---|---|
Personal spend shows 404 | Enhanced Billing not enabled | Wait until GitHub enables it for your account. |
403 / auth error | Missing Plan: read-only |
Recreate PAT with required permission; paste into settings. |
Org list empty | No org membership / missing read:org |
Run Sign in command; verify org membership visibility. |
Icon override ignored | Invalid Codicon name | Use a valid name from the Codicon catalog. |
Stale tag persists | Last sync failed | Check Output Channel; resolve auth/network; manually Refresh. |
No color (just theme fg) | useThemeStatusColor true |
Disable that setting to always colorize usage bar. |
Incorrect / out-of-date data | Stale cache or transient API hiccup | Use the Refresh button in the panel or sidebar to bypass cache and re-fetch data immediately. |
Extra diagnostics: run Show Logs (or enable showLogOnError
).
Token Migration Timing (Secure Storage)
The move from plaintext setting to secret storage is usually instant, but UI/state can appear to “lag” for a second or two due to VS Code’s async secret APIs. Common transient observations:
Observation | Explanation | Action |
---|---|---|
Green secure pill shows but migration hint still visible for a moment | Residual plaintext value still detected until panel re-reads post‑clear | Wait a moment or click Clear Plaintext; it will disappear automatically. |
Warning pill (secure + plaintext) persists after you cleared the setting | Secret write finished first; panel cached prior config cycle | Trigger a manual Refresh or re-open panel; hint window will expire. |
No secure pill immediately after setting token | Secret not yet readable; extension assumes secure for a short window | Give it ~2–3s; if still absent, run Set Token command again and check logs. |
Secure pill remains after Clear Stored Token | Secure “assume” window (a short grace period) still active | Wait a couple seconds; if it persists, use Clear command again and look at Output Channel. |
If issues remain after ~5s: open Show Logs, copy any lines tagged [secrets]
, and file an issue.
🔒 Permissions, Data & Privacy
Functionality | Data Sent | Stored Locally | Notes |
---|---|---|---|
Personal spend | Auth header + billing usage request to api.github.com |
Current spend, last sync ts, last error | Only Copilot usage lines aggregated. |
Org metrics | Auth header + metrics request | Last sync ts, last error | Summaries only (engaged users & suggestions totals). |
Status bar | None (rendering only) | Current spend / thresholds | No external logging. |
No analytics, telemetry, or third‑party endpoints. Configuration & cached values stay in your VS Code profile (globalState & settings). PAT is only stored in settings if you enter it. The extension never writes elsewhere.
See also: SECURITY.md.
🧩 Contributing & Development
End‑user focused README kept intentionally lean for the Marketplace.
Development, testing, release & contribution guidelines live in .github/DEVELOPMENT.md.
🗓 Changelog
See CHANGELOG.md for versioned release notes.
📜 License
MIT – see LICENSE.
ℹ Disclaimer
Not affiliated with or endorsed by GitHub. “GitHub” and “Copilot” are trademarks of their respective owners.