Chargeback and showback for AI coding agents

To allocate AI coding agent spend to teams, map every paid request to one team, then either report each team’s total (showback) or bill it to the team’s budget (chargeback). Each tool records spend under a different identity, so the team mapping is the hard part.
Checked against Claude Code’s costs page, the Claude Code Analytics API and Usage and Cost Analytics API references, the Claude apps gateway spend-limit and configuration pages, AWS’s Bedrock inference profile docs and GitHub’s cost center and budget docs, as of 2026-11-15. The OpenTelemetry attribute names are carried over from the per-developer cost post, checked 2026-10-28.
Showback and chargeback do different jobs
Showback tells each team what its agents cost. It changes behavior through visibility, and nobody’s budget moves. Chargeback moves the cost into the team’s own budget, so the team’s cost center pays the invoice line. Chargeback is a finance decision that depends on the mapping being right, so start with showback for one or two months and fix the mapping before any charge goes out.
The per-developer view comes first in any allocation. The cap post covers limits on each person. Team allocation adds up those people, and it needs a team key on each one.
Pick the team key each source can see
Each billing path reports spend under a different key, and only some of them carry a team.
- Claude Team and Enterprise. The spend report in org analytics shows estimated spend per user and per model, with CSV export, updated daily. Usage inside the seat allowance is not metered in dollars, so the report covers only usage-credit spend. On Enterprise, the Enterprise Analytics API returns per-user usage and cost across Claude surfaces, including Claude Code.
- Claude Console. The Usage and Cost Analytics API groups cost by workspace, API key, model and actor. It needs an Admin API key, and workspace keys do not work. The Claude Code workspace collects all Claude Code usage from the Console, so use the actor as the team key, not the workspace.
Map cloud and Copilot spend to teams
Cloud and Copilot spend need a different key from the Claude Console and Team views.
- Amazon Bedrock, Google Cloud and Microsoft Foundry. The cloud bill shows the total, not the split. A self-hosted Claude apps gateway can set
session_name: emailonassume_role, so AWS sees each developer’s requests under their own assumed-role session. That needs gateway server v2.1.281 or later, and the docs say the fallback request for abandoned streams stays on the shared session. - Application inference profiles.
CreateInferenceProfileaccepts atagsfield, and AWS tracks usage and cost for requests made with the profile. A profile per team, tagged with the team, gives the cloud bill a team key. The gateway prices each request by the upstream ID it sends, and it gives an application-inference-profile ARN as one example of such an ID. - GitHub Copilot. Cost centers can hold users, repositories, organizations and enterprise teams. License-based products such as Copilot are charged to the users in the cost center. Usage-based products such as Actions are charged to the repositories or organizations in it.
| Source | Team key | Dollar basis | Export | Main caveat |
|---|---|---|---|---|
| Claude Team or Enterprise spend report | Member (email) | Estimated, usage credits only | CSV, daily | Seat allowance is not in dollars |
| Claude Code Analytics API | Actor (email or API key name) | Estimated, cents per model | JSON, one day per request | Console-authenticated usage only |
| Usage and Cost Analytics API | Actor or workspace | Cost at list and after discounts | JSON, bucketed | Admin key; revisions for about 7 days |
| Claude apps gateway | OIDC sub, group or organization cap | Gateway estimate, not the invoice | Admin API and /effective |
Caps enforce spend; they do not bill |
| Bedrock with gateway session names | Developer email in the STS session | Cloud billing | Cloud cost reports | Needs gateway v2.1.281 or later |
| Bedrock application inference profile | Profile tagged per team | Cloud billing | Cloud cost reports | Routing a team to its profile is config you set |
| GitHub Copilot cost center | Users in the cost center | AI credits and license cost | Budgets and the impact dashboard | One cost center per team |
Build the team roster
Every export above joins to one roster. Keep it outside the tools, so a reorganization changes one file.
- Export the people list from your identity provider. Keep the email, the OIDC
suband the GitHub login for each person. - Assign each person to exactly one team. The Copilot cost-center docs do not say whether one user can sit in two cost centers, so do not rely on that.
- Add a cost-center owner for each team, the person who accepts the monthly number.
- Version the roster and record its date with each report.
Roll up Claude Code spend by team
The Claude Code Analytics API returns one UTC day per request. It returns estimated cost per model in cents, and it pages with next_page until has_more is false. The command below sums one day per actor and prints the cents. Join the output to roster.tsv on the email, then sum by team. Rows whose actor is an API key have no email, so add an api-key-name-to-team.tsv mapping for them. Keep anything that matches neither file in an explicit unallocated bucket and report it with the team totals, so spend is never dropped silently.
curl -sS "https://api.anthropic.com/v1/organizations/usage_report/claude_code?starting_at=2026-11-16" \
-H "anthropic-version: 2026-10-21" \
-H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
| jq -r '.data[] | [(.actor.email_address // .actor.api_key_name), ([.model_breakdown[].estimated_cost.amount] | add // 0)] | @tsv'
The response estimated_cost.amount is in cents, so divide by 100 for dollars. Loop over starting_at for each day of the month, and follow next_page on each day, because the command reads only the first page.
Put a cap on each team
A team cap is not a Claude Team or Console control. The Console workspace spend limit covers the whole Claude Code workspace, so it caps total spend for every developer in it. The Team and Enterprise spend limits apply to the organization, a group or a member. The gateway’s group caps resolve per member, so a group cap is a per-seat default, not a shared pool for the team. On Copilot, a cost-center budget is the closest control to a team cap, but only if you select Stop usage when budget limit is reached. Without that option the budget is alert-only: it sends notifications and charges keep accruing.
Gotchas that break team totals
- The seat allowance is not in dollars. A Team or Enterprise report covers usage credits only. Report the allowance as a seat line, and do not add it to the dollar total.
- Claude Code prices at list price by default. Only managed settings can set
modelPricing, so set contracted rates there before you publish team numbers. The costs page says the figures stay estimates. - The Analytics API skips subscription usage. The Claude Code Analytics API covers Console-authenticated usage. Team and Enterprise seat usage sits in the claude.ai reports.
- Late data. The Usage and Cost Analytics API refreshes within 4 hours and can take up to 24 hours. Values can change until about 7 days after month end, so close each month then.
- Cloud spend has no team key by default. Without per-developer session names or per-team inference profiles, the bill shows one principal.
- Copilot budgets only cap with the stop option. A cost-center budget applies after the shared AI credits pool is used up, and it blocks further usage only when Stop usage when budget limit is reached is selected. Otherwise it is alert-only. See capping spend per developer.
A checklist before you publish team totals
- Map every person to one team in a roster you version.
- Set contracted rates in managed settings and confirm they apply.
- Report the seat allowance and usage-credit spend as separate lines.
- Use the actor, not the workspace, as the Claude Code team key.
- Set one cost center per team for Copilot.
- Reconcile to the invoice after the 7-day revision window, and record the date you pulled each export.
Enforcing this with AIControls
The steps above depend on each vendor’s reports, and none of them joins spend to a team in one place. AIControls sits in front of Claude Code as a gateway. It supports Claude Code through the gateway for both the CLI and VS Code, issues per-user tokens, and sets per-user and per-session cost and budget limits on that traffic. It also supports Copilot in VS Code. Read governance for AI coding agents for the wider policy picture, and the Tokenomics post for how to frame the business case behind these numbers.
Sources
- Claude Code: Manage costs, Claude apps gateway configuration and gateway spend limits.
- Anthropic APIs: Claude Code Analytics API and Usage and Cost Analytics API.
- Amazon Bedrock: Create an application inference profile.
- GitHub: Cost centers and Set up budgets.
Frequently asked questions
What is the difference between showback and chargeback for AI coding agents?
Showback reports each team's share of AI coding agent spend so the team can see it, but nothing is billed to the team. Chargeback moves the cost to the team's own budget or cost center. Start with showback. Chargeback needs a team mapping that finance accepts, a monthly total that reconciles to the invoice, and a named budget owner for each team.
Which identity should I use to allocate Claude Code spend to a team?
Use the person's email or OIDC sub, then map each person to one team in a roster you control. The Claude Code Analytics API returns estimated cost per actor per day, with the actor as a user email or an API key name. The Usage and Cost Analytics API can group cost by actor or workspace. Team tags can also come from OpenTelemetry resource attributes, but the roster is the only mapping that covers every source.
Can GitHub Copilot spend be split by team?
Yes, with cost centers. A cost center can hold users, repositories, organizations and enterprise teams. Copilot license costs are charged by the users in the cost center, and a budget applies to the whole cost center. The docs say you cannot set different budgets for teams inside one cost center, so give each team its own cost center.
Why do team totals not match the invoice?
Claude Code computes its dollar figures at list price unless managed settings set contracted rates in modelPricing. Usage inside a Team or Enterprise seat allowance is not metered in dollars at all. The Usage and Cost Analytics API refreshes within 4 to 24 hours and can revise a month's values until about 7 days after the month ends. Reconcile team totals only after that window.