Skip to main content
AI Development

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

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.

Sean McLellan profile photo

Sean McLellan

Lead Architect & Founder

6 min read
Editorial illustration on pale cool-gray paper: at left, a long teal tray holds a row of blank white index cards with one lavender card slotted in near the front, and faint outlines show each card behind it one step further right; a thin copper line runs from the lavender card to a teal six-compartment tray at right holding different amounts of small blank lavender tokens
Constructed diagramIllustration: 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, 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.
Constructed diagramConstructed 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.

QuestionAI credit usage REST APIDownloaded AI usage report
Token detail before December 1, 2026No; token fields return 0Yes
Token fieldsSix counts, including image input and outputInput, output, cache read and cache write, per the billing reports reference
How you get itAPI call by an admin, or by anyone on Copilot for individuals, filtered by year, month, day, user, model or productDownload 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 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 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:

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 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 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, 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 covers a setting that changes who pays for reviews, and GitHub Enterprise's included Copilot access meters usage from the first request.

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. For help connecting Copilot cost data to your own reporting, see AI consulting.

Sources and scope

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.

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

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.

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.