Copilot Premium Requests Status

VS Code extension that shows GitHub Copilot premium requests usage in the status bar (included vs billed), with manual and automatic refresh.
About
Never guess your Copilot usage again. Track included vs billed requests in real-time, right in your editor's status bar. No context switching, no billing dashboard hunting.
Read full story →
Features
- Status bar summary:
Included | Billed
- Tooltip with details: included, billed, total, user, auth source, last sync
- Secure token storage in VS Code Secrets
- Fallback auth through VS Code GitHub session
- Configurable product filter, refresh interval, icon, and status bar alignment
- Commands for refresh and token management
Requirements
- VS Code
^1.90.0
- GitHub account with access to billing usage endpoint
- Recommended: fine-grained PAT with permission Plan: read-only
Installation (local development)
npm install
npm run build
Then run the extension in VS Code using Run Extension (F5).
Run locally in VS Code
- Open this project folder in VS Code.
- Run:
npm install
npm run build
- Press
F5 (or use Run and Debug → Run Extension).
- In the new Extension Development Host window:
- Open Command Palette (
Cmd+Shift+P)
- Run Copilot Premium Requests: Set / Update Token (Secure)
- Paste PAT with Plan: read-only
- Check status bar for usage values
Add extension to your VS Code (VSIX)
- Build package:
npm install
npm run package
- Install generated
.vsix file:
- In VS Code open Extensions view
... menu → Install from VSIX...
- Select the generated
.vsix
Alternative (CLI):
code --install-extension ./copilot-premium-requests-status-0.1.0.vsix
Commands
Copilot Premium Requests: Refresh Now
Copilot Premium Requests: Set / Update Token (Secure)
Copilot Premium Requests: Clear Stored Token
Configuration
Extension settings namespace: copilotPremiumRequests
refreshIntervalMinutes (number, default: 15, min: 5)
productFilter (string, default: Copilot, empty = all products)
statusBarAlignment (left | right, default: right)
icon (string, Codicon syntax, default: $(github))
How authentication works
- Extension checks secret storage key:
copilotPremiumRequests.pat
- If missing, it requests VS Code GitHub auth session (
user)
- Token is used to call GitHub API for current month usage
API used
GET /user
GET /users/{username}/settings/billing/premium_request/usage?year={year}&month={month}
Base URL: https://api.github.com
API version header: X-GitHub-Api-Version: 2022-11-28
Development
Scripts
npm run build — compile TypeScript to dist/
npm run watch — compile in watch mode
npm run package — package extension with npx -y @vscode/vsce@latest package
Release
To create a new release and push .vsix to GitHub Releases:
- Update version in
package.json (semver format)
- Commit changes
- Create tag (matches version):
git tag v0.2.0
git push origin main
git push origin v0.2.0
- GitHub Actions workflow triggers automatically:
- Builds and packages extension
- Creates GitHub Release with
.vsix artifact
Project structure
src/
extension.ts # VS Code activation, status bar, commands, timers
githubBilling.ts # GitHub auth + API client + usage aggregation
dist/
extension.js
githubBilling.js
Troubleshooting
- Status shows auth error
- Set PAT again using command: Set / Update Token (Secure)
- Ensure PAT has required permission: Plan: read-only
- No data in selected product
- Clear
productFilter or verify exact product name returned by API
- Data seems stale
- Run Refresh Now or lower
refreshIntervalMinutes
Security notes
- PAT is stored in VS Code Secret Storage (not in workspace files)
- Do not commit tokens to source control
- Packaging uses
npx -y @vscode/vsce@latest to avoid keeping vulnerable transitive dependencies in local devDependencies
Current project status
- TypeScript build: ✅
- Output artifacts in
dist/: ✅
- Type diagnostics in source files: ✅ (no errors)
License
MIT — see LICENSE.