Go/Cobra CLI for GitHub Enterprise Copilot premium request analytics.
It targets the GitHub Enterprise Cloud billing endpoint:
GET /enterprises/{enterprise}/settings/billing/premium_request/usage
Set the target enterprise with --enterprise or COPREM_ENTERPRISE.
Install the latest version with Go:
go install github.com/bariiss/coprem@latestInstall a specific release:
go install github.com/bariiss/coprem@v0.1.0Make sure your Go binary directory is on PATH:
export PATH="$(go env GOPATH)/bin:$PATH"You can also download prebuilt binaries from GitHub Releases. Release archives are published for macOS, Linux, and Windows on amd64 and arm64.
go build ./...
go build -o coprem .Releases are created from Git tags by GitHub Actions and GoReleaser.
Create and push a semantic version tag:
git tag v0.1.0
git push origin v0.1.0The release workflow builds archives for:
- macOS amd64 and arm64
- Linux amd64 and arm64
- Windows amd64 and arm64
Each release includes platform archives and checksums.txt.
Run with explicit flags:
coprem premium --enterprise ENTERPRISE_SLUGOr set defaults for your shell:
export COPREM_ENTERPRISE=ENTERPRISE_SLUG
export COPREM_TOKEN=github_pat_or_classic_pat
coprem premiumIf you already use the GitHub CLI, coprem can read that token instead:
gh auth login
coprem premium --enterprise ENTERPRISE_SLUG --gh-user GITHUB_USERThe CLI reads a token from the first available source:
--token-env <NAME>COPREM_TOKENGITHUB_TOKENGH_TOKENCOPILOT_PREMIUM_TOKENgh auth token
The endpoint requires an enterprise administrator or billing manager token. GitHub's docs state that this premium request billing endpoint does not support GitHub App tokens or fine-grained PATs, so use a classic PAT or an authenticated gh profile with the right enterprise billing access.
Optional local helper:
coprem auth save-zshrc --gh-user GITHUB_USER
source ~/.zshrcThat writes a managed block like this to ~/.zshrc:
# BEGIN coprem
export COPREM_TOKEN='...'
# END copremCOPREM_ENTERPRISE can also be set in the same shell file if you do not want to
pass --enterprise every time:
export COPREM_ENTERPRISE=ENTERPRISE_SLUGThe helper stores the token in plaintext in ~/.zshrc; using gh auth login is cleaner when possible.
Current month, cumulative:
coprem premium --enterprise ENTERPRISE_SLUGUse a specific logged-in GitHub CLI account without changing the active profile:
coprem premium --enterprise ENTERPRISE_SLUG --gh-user GITHUB_USEROr persist that account's token for future shells:
coprem auth save-zshrc --gh-user GITHUB_USER
source ~/.zshrcLast month, grouped by model:
coprem premium --enterprise ENTERPRISE_SLUG --timeframe last-month --group-by modelGrouped by user. This uses the Copilot seats API to discover users, then queries premium request usage once per user:
coprem premium --enterprise ENTERPRISE_SLUG --gh-user GITHUB_USER --group-by userTotal per user is the default. Add a model breakdown when needed:
coprem premium --enterprise ENTERPRISE_SLUG --group-by user --users alice,bob
coprem premium --enterprise ENTERPRISE_SLUG --group-by user --breakdown model --users alice,bobIf the token cannot read enterprise Copilot seats, refresh the GitHub CLI token or pass a user list explicitly:
gh auth refresh -h github.com -u GITHUB_USER -s admin:enterprise
coprem premium \
--enterprise ENTERPRISE_SLUG \
--gh-user GITHUB_USER \
--group-by user \
--users alice,bobTables use color automatically on a terminal. Override with --color always or
--color never.
April 2026, daily CSV:
coprem premium --enterprise ENTERPRISE_SLUG --year 2026 --month 4 --granularity daily --format csvFilter by user, organization, model, product, or cost center:
coprem premium \
--enterprise ENTERPRISE_SLUG \
--organization ORG_LOGIN \
--user octocat \
--model GPT-5 \
--cost-center-id none \
--format jsonUse another enterprise or GitHub API host:
coprem premium \
--enterprise ENTERPRISE_SLUG \
--api-base-url https://api.github.comFor GHE.com dedicated subdomains, set --api-base-url https://api.SUBDOMAIN.ghe.com.