Skip to content

Instantly share code, notes, and snippets.

@myinusa
Created October 9, 2025 10:05
Show Gist options
  • Select an option

  • Save myinusa/fbb97800e08f771e7349c4a72ccbc9d1 to your computer and use it in GitHub Desktop.

Select an option

Save myinusa/fbb97800e08f771e7349c4a72ccbc9d1 to your computer and use it in GitHub Desktop.
Copilot Premium Request
#!/usr/bin/env bash
limit=1500
USER=$(gh api user -q .login)
response=$(gh api -H "X-GitHub-Api-Version: 2022-11-28" \
"/users/$USER/settings/billing/premium_request/usage?year=$(date +%Y)&month=$(date +%-m)")
used=$(jq '[.usageItems[] | select(.sku=="Copilot Premium Request") | .grossQuantity] | add' <<< "$response")
pct=$(awk "BEGIN {printf \"%.2f\", ($used/$limit)*100}")
echo "Copilot Premium Requests: $used / $limit used ($pct%)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment