Fetch and display GitHub Copilot premium request usage via the GitHub REST API.
The GitHub Billing API does not expose the plan quota (e.g., 50, 300, or 1500 requests/month). This information is not available in any endpoint. Therefore:
~/.config/copilot-usage/config.jsonExplain this limitation clearly to the user when asking for their plan. Reference: https://docs.github.com/en/rest/billing/usage
gh CLI authenticated with scopes: manage_billing:copilot + usergh auth statusgh auth login then gh auth refresh -s manage_billing:copilotbash
bash scripts/copilot-usage.sh # current month
bash scripts/copilot-usage.sh --month 3 --year 2026 # specific month
bash scripts/copilot-usage.sh --model claude # filter by model
bash scripts/copilot-usage.sh --json # raw JSON output
bash scripts/copilot-usage.sh --set-plan pro+ # configure plan
bash scripts/copilot-alert.sh --threshold 80 # quota alert check
The grossQuantity returned by the API already includes the multiplier. The script reverse-calculates the actual number of prompts sent and shows both values. See references/multipliers.md for the full table.
Key insight: actual_prompts = grossQuantity / multiplier
Stored at ~/.config/copilot-usage/config.json:
json
{
"plan": "pro+",
"quota": 1500,
"set_at": "2026-04-08"
}
gh auth refresh -s manage_billing:copilotbash scripts/copilot-usage.sh --set-plan <plan>See references/api.md for full endpoint documentation and response schemas.