Features
- Premium interactions quota tracking
- Chat quota tracking
- Device flow OAuth (no browser cookies needed)
- Plan label from Copilot subscription
- Status page integration with GitHub incidents
Authentication Method
Copilot uses GitHub OAuth device flow for authentication. No browser cookies are required.- Device Flow Setup
- Manual Token Entry
GitHub OAuth Device Flow
Setup:- Preferences → Providers → Copilot → Enable
- Click “Login to Copilot” or “Add Account”
- CodexBar displays a device code
- Visit the GitHub URL shown (e.g., https://github.com/login/device)
- Enter the device code
- Authorize CodexBar
- Token is saved to
~/.codexbar/config.json
- Device code request:
- Token polling:
Polls until user authorizes or times out.
- Token storage:
- Stored in
~/.codexbar/config.json→providers[].apiKeyforcopilot
- Stored in
read:user- Read user profile information
API Endpoints
Usage Fetch
Authorization: token <github_oauth_token>Accept: application/jsonEditor-Version: vscode/1.96.2Editor-Plugin-Version: copilot-chat/0.26.7User-Agent: GitHubCopilotChat/0.26.7X-Github-Api-Version: 2025-04-01
quotaSnapshots.premiumInteractions- Premium interactions quotaquotaSnapshots.chat- Chat quotacopilotPlan- Plan label
Snapshot Mapping
CodexBar displays Copilot usage as follows:- Primary meter: Premium interactions percent remaining → converted to used percent
- Secondary meter: Chat percent remaining → converted to used percent
- Plan label: From
copilotPlanfield - Reset dates: Not provided by the API
Status Page Integration
CodexBar monitors GitHub Status for incidents:- Polls Statuspage.io API every 5 minutes (configurable)
- Displays incident badge on menu bar icon
- Shows incident details in menu
- Click “View Status” to open status page
Troubleshooting
Device flow times out
Device flow times out
You didn’t authorize the device code in time.Solution:
- Click “Login to Copilot” again to get a new device code
- Visit the GitHub URL immediately
- Enter the device code within the time limit (usually 15 minutes)
Token unauthorized (401)
Token unauthorized (401)
No quota data returned
No quota data returned
The Copilot internal API may not be returning quota snapshots.Solution:
- Verify you have an active Copilot subscription
- Check that you’ve used Copilot recently (API may not return data for inactive accounts)
- Wait a few minutes and refresh
API version header mismatch
API version header mismatch
GitHub may have changed the required API version header.Solution:
- Check the latest Editor-Version and Editor-Plugin-Version from VS Code
- Report the issue with the new version values
CLI Usage
Key Files
- Usage fetcher:
Sources/CodexBarCore/Providers/Copilot/CopilotUsageFetcher.swift - Device flow:
Sources/CodexBarCore/Providers/Copilot/CopilotDeviceFlow.swift - Login flow:
Sources/CodexBar/Providers/Copilot/CopilotLoginFlow.swift - Token store:
Sources/CodexBar/CopilotTokenStore.swift(legacy migration helper)
Related Documentation
- Configuration - Config file format
- CLI Reference - CLI usage and options
- Provider Authoring - How providers work internally
