# GitHub AI credit usage API adds token counts from Dec. 1

- Canonical: https://www.baristalabs.io/blog/github-ai-credit-usage-api-token-counts
- Published: 2026-12-03
- Author: Sean McLellan
- Excerpt: GitHub's AI credit usage API now returns six token counts per model, from Dec. 1 on. A new user_id column also shifts usage report columns.

AI Development

Sean McLellan

Lead Architect & Founder

December 3, 2026 6 min read

Constructed diagram Illustration: a new card slotted into a row moves every card behind it, and token counts sort into six compartments. Not product UI.

GitHub's AI credit usage REST API now returns per-model token counts, starting with usage on December 1, 2026. GitHub announced the change on December 2, along with two other billing data changes: usage reports gained a `user_id` column on December 1, and from January 1, 2027, the billing usage report API returns only the past 24 months. If a script or dashboard tracks Copilot cost, update it this month.

The column change can already break things. GitHub put `user_id` right after `username`, so every later column moved one place to the right. A script that reads usage report columns by position may now be reading the wrong field without raising an error.

## What changed in the GitHub AI credit usage API?

The three AI credit usage endpoints now include token counts in each usage item. According to the [GitHub changelog](https://github.blog/changelog/2026-12-02-per-model-token-breakdown-in-the-ai-usage-rest-api/), the endpoints are:

- Enterprise: `GET /enterprises/{enterprise}/settings/billing/ai_credit/usage`
- Organization: `GET /organizations/{org}/settings/billing/ai_credit/usage`
- User: `GET /users/{username}/settings/billing/ai_credit/usage`

Each usage item carries six raw counts "without pricing or discount adjustments": `tokenInput`, `tokenOutput`, `tokenImageInput`, `tokenImageOutput`, `tokenCacheRead` and `tokenCacheWrite`. The cache-write count excludes extended cache creation. GitHub says the counts "use the same definitions as the AI usage report" and that they respect the endpoints' existing filters for time period, user and model.

Nothing changes in permissions. If you already call these endpoints, the new fields appear in the same responses. GitHub says token counts are available to admins on Copilot Business and Copilot Enterprise, and to anyone on Copilot for individuals.

![Constructed timeline diagram titled GitHub billing usage data: three changes to plan for. Three markers sit on a horizontal line. Dec 1, 2026: usage reports add user_id, columns after username shift one place right; to do, read report columns by header name. Dec 1, 2026: AI credit usage API returns token counts, six raw counts per usage item, earlier periods return 0; to do, store token fields from Dec 1 onward. Jan 1, 2027: billing usage report API keeps 24 months, older data is no longer returned; to do, export older usage data before Jan 1, 2027.](https://www.baristalabs.io/blog/inline/github-ai-credit-usage-api-token-counts.jpg)

Constructed diagram Constructed from GitHub Changelog entries of November 23 and December 2, 2026. Not product UI.

## Token history starts on December 1

The API doesn't fill in older token data. GitHub says token counts "generally start with usage on December 1, 2026," that customers with early access may have partial data from before then, and that "for periods before capture starts, token fields return 0."

A zero in `tokenInput` for November means the API didn't record tokens then, not that nobody used any. If you chart token volume over time, treat zeros before December 1 as missing data. For detail on earlier usage, GitHub points to the AI usage report, which you download from the AI usage page in billing settings.

Scroll sideways to see all 3 columns.

| Question | AI credit usage REST API | Downloaded AI usage report |
|---|---|---|
| Token detail before December 1, 2026 | No; token fields return 0 | Yes |
| Token fields | Six counts, including image input and output | Input, output, cache read and cache write, per the [billing reports reference](https://docs.github.com/billing/reference/billing-reports) |
| How you get it | API call by an admin, or by anyone on Copilot for individuals, filtered by year, month, day, user, model or product | Download from the AI usage page in billing settings |

The BaristaLabs post on [what GitHub's token report can and can't tell you about Copilot cost](https://www.baristalabs.io/blog/github-copilot-token-report-cost-diagnosis) covers how to read those token classes once you have them.

## How do you pull Copilot token counts from the API?

You make the same request as before and read the new fields. The [billing usage REST docs](https://docs.github.com/rest/billing/usage) say the organization endpoint requires an organization administrator, accepts a fine-grained token with "Administration" organization permissions (read), and keeps only the past 24 months. The query parameters are `year`, `month` (defaulting to the current month), `day`, `user`, `model` and `product`.

A minimal pull for one organization and one month with the GitHub CLI looks like this:

```bash
gh api -H "X-GitHub-Api-Version: 2026-03-10" \
  "/organizations/ORG/settings/billing/ai_credit/usage?year=2026&month=12" \
  --jq '.usageItems[] | {model, netAmount, tokenInput, tokenOutput, tokenCacheRead, tokenCacheWrite}'
```

The field names and the version header come from GitHub's billing usage REST docs. BaristaLabs did not run this against a live organization for this post, so check the output against your own billing page before you build a dashboard on it.

## The user_id column shifts every later column

The second change affects anyone who parses usage report files. The [changelog for the new column](https://github.blog/changelog/2026-12-02-usage-reports-now-include-a-user-id-column/) says reports that include `username` now include `user_id` next to it. That covers the detailed usage report, the AI usage report and the premium request usage report, including exports you create with the REST API. The summarized usage report hasn't changed. It applies to all GitHub Enterprise Cloud account types and to standalone organizations on GitHub Team.

GitHub's instruction is direct: "If your scripts or tools read these reports by column position, update them to read columns by header name." In Python, that means `csv.DictReader` and `row["user_id"]` rather than `row[3]`.

The column also fixes two old gaps. The [billing reports reference](https://docs.github.com/billing/reference/billing-reports) says `user_id` "stays the same when the user changes their username," and that it's included for deleted accounts, whose `username` is empty. You can match it to an audit log event's `actor_id` or `user_id`. Bot accounts get an ID too. Usage that isn't tied to an account leaves the column empty.

Two side effects matter if you reconcile totals. Usage from different deleted accounts now shows up on separate rows instead of one combined row with an empty username. And because GitHub rounds each row separately, totals you add up yourself "may differ slightly in the last decimal places." A reconciliation check with a zero tolerance may start failing for that reason alone.

## What the 24-month limit means for older usage data

The third change has a deadline. According to the [changelog](https://github.blog/changelog/2026-12-02-billing-usage-report-api-limited-to-the-past-24-months/), starting January 1, 2027, the Get billing usage report endpoints return only data from the past 24 months, which matches the AI credit and premium request endpoints. It affects users and organizations on all plans and GitHub Enterprise Cloud enterprises, including those with data residency.

GitHub's advice is to export anything older than 24 months from these endpoints before January 1, 2027. If finance or audit work compares year-over-year spend from the API, pull and store that history now.

## Who should change something this month

BaristaLabs' interpretation, based on the three changelogs:

- **Teams with a cost dashboard or chargeback script built on usage report files** should check it first. The column shift has been live since December 1.
- **Admins who track Copilot spend by model** can now pull token detail on a schedule instead of downloading reports by hand. The data begins December 1.
- **Organizations with more than two years of GitHub billing history** that they still query through the API should export it before January 1, 2027.
- **Teams that only look at the billing page** don't need to change anything.

Token counts also make cost questions more specific. When AI credit spend jumps, you can now see in your own tooling whether input, output or cache token counts rose, model by model. That's useful because billing defaults are moving too: the BaristaLabs post on [Copilot code review billing moving to the organization on December 30](https://www.baristalabs.io/blog/copilot-code-review-billing-default-december-30) covers a setting that changes who pays for reviews, and [GitHub Enterprise's included Copilot access](https://www.baristalabs.io/blog/github-enterprise-copilot-access-cost) meters usage from the first request.

## Recommended first step: fix the parser, then add token fields

BaristaLabs recommends doing these in order, starting with what can already break:

1. **Find every script, spreadsheet import or BI connector** that reads GitHub usage reports, and switch it to read columns by header name. Key per-person rollups on `user_id` instead of `username`.
2. **Loosen reconciliation tolerances** to allow for last-decimal rounding differences.
3. **Add the six token fields** to your scheduled AI credit usage pull, starting with December 2026. Mark earlier months as "no token data" rather than zero.
4. **Export billing usage data older than 24 months** before January 1, 2027, if you need it.

For how per-tool request counts relate to these numbers, see the BaristaLabs post on [Copilot usage metrics counting Claude Code and OpenCode](https://www.baristalabs.io/blog/copilot-usage-metrics-totals-by-client). For help connecting Copilot cost data to your own reporting, see [AI consulting](https://www.baristalabs.io/services/ai-consulting).

## Sources and scope

- [GitHub Changelog: Per-model token breakdown in the AI usage REST API](https://github.blog/changelog/2026-12-02-per-model-token-breakdown-in-the-ai-usage-rest-api/), December 2, 2026
- [GitHub Changelog: Usage reports will include a user ID column starting December 1](https://github.blog/changelog/2026-11-23-usage-reports-will-include-a-user-id-column-starting-december-1/), November 23, 2026
- [GitHub Changelog: Usage reports now include a user ID column](https://github.blog/changelog/2026-12-02-usage-reports-now-include-a-user-id-column/), December 2, 2026
- [GitHub Changelog: Billing usage report API limited to the past 24 months](https://github.blog/changelog/2026-12-02-billing-usage-report-api-limited-to-the-past-24-months/), December 2, 2026
- [GitHub Docs: REST API endpoints for billing usage](https://docs.github.com/rest/billing/usage), read December 3, 2026
- [GitHub Docs: Billing reports reference](https://docs.github.com/billing/reference/billing-reports), read December 3, 2026

These sources don't say whether GitHub will backfill token counts for usage before December 1, 2026, and they don't give prices per token. BaristaLabs did not call the endpoints for this post.

Copilot cost reporting

Get Copilot token data into your cost reports

Bring the scripts, spreadsheets or dashboards that read your GitHub usage reports. BaristaLabs can help you switch them to header-based parsing, add the new token fields and set a schedule for the API pull.

[Plan my Copilot usage pull](https://www.baristalabs.io/contact?service=ai-consulting&placement=end&source=blog&slug=github-ai-credit-usage-api-token-counts) [Explore AI consulting](https://www.baristalabs.io/services/ai-consulting)

A list of the reports and tools you use today is enough to start.

Turn this idea into a pilot

## Which workflow should go first?

Use the readiness check to compare impact, effort, risk, owner, and next step before requesting a review.

- 3-5 minutes
- Deterministic score
- No sensitive data

[Check workflow readiness](https://www.baristalabs.io/assessment)

Practical AI Workflow Notes

## Enjoyed this? Get our plain-English workflow notes.

We send occasional short notes on putting AI to work in everyday operations, from taming messy documents and customer follow-ups to simple reporting and safety guardrails.

Email address

Send me the notes

A relaxed way to stay in touch if you're still exploring and aren't ready to chat yet.

Occasional emails with practical ideas only. Unsubscribe anytime.

Article-specific next step

Plan my Copilot usage pull

[Plan my Copilot usage pull](https://www.baristalabs.io/contact?service=ai-consulting&placement=sidebar&source=blog&slug=github-ai-credit-usage-api-token-counts)

![Sean McLellan profile photo](https://www.baristalabs.io/profile-sean-mclellan.jpg)

## Sean McLellan

Lead Architect & Founder

Sean McLellan is the founder and lead architect at BaristaLabs. He brings more than two decades of software architecture experience to BaristaLabs products and client work for small teams. Client work starts with an assessment of one workflow. Fixed-scope discovery then defines a bounded pilot, explicit human-review boundaries, and the source-traceable proof needed for the next decision.

[More articles by Sean McLellan](https://www.baristalabs.io/authors/sean-mclellan)

[Twitter](https://twitter.com/seanmclellan) [GitHub](https://github.com/seanmclellan)
