AI cost chargeback works when every model call carries the team, product and workflow that caused it, recorded at request time rather than guessed from the monthly invoice. Start with showback so teams see their spend without budget moving, agree how shared platform costs are split, and switch to chargeback only once the attribution matches the bill.
Why the provider invoice is not enough
Model providers bill by account, project or API key. Their exports show tokens, models and prices, but they know nothing about your cost centres, products or agents. When several teams share one key, or one AI platform serves the whole business, the invoice tells finance how much was spent and almost nothing about who spent it.
Splitting the bill by headcount or by a flat share feels fair at first, but it hides the signal that matters. A team running a chatty agent with long prompts pays the same as a team making a few careful calls, so neither has a reason to change. Chargeback only changes behaviour when each team can see its own consumption and trace it back to the features that drive it.
Attribute cost at the moment of the request
The reliable way to attribute AI spend is to label each request as it happens. That usually means routing model traffic through a gateway or a shared client library that every team uses, and refusing calls that arrive without the required labels.
What to record on every call
- Team and cost centre: who owns the budget for this traffic.
- Product or agent: which application or agent made the call, so spend maps to something a manager recognises.
- Workflow or task type: for example triage, drafting or retrieval, so you can see which steps are expensive.
- Model, input tokens, output tokens and cached tokens: the raw consumption.
- Unit price and its source: the price used at the time, so later price changes don't rewrite history.
- Environment: production, staging or evaluation, since test traffic often belongs to a different budget.
If you already keep an inventory of agents, as described in how to keep track of every AI agent your company runs, reuse its owner and cost centre fields instead of creating a second list that drifts.
Reconcile against the invoice
Your request log will never match the provider bill exactly: retries, failed calls, batch discounts and rounding all get in the way. Treat the invoice as the financial source of truth and use your own records to explain how it divides. Reconcile each billing period, publish the gap, and put the unexplained remainder in a visible line rather than spreading it silently.
Start with showback, then charge back
Showback means reporting each team's AI spend without moving money. It is the right first step because it exposes labelling gaps and odd numbers while the stakes are low. Teams learn which agents cost what, and engineers start asking the right questions about prompt size, model choice and caching.
Move to chargeback, where the cost lands in the team's own budget, only when three things are true: nearly all traffic carries labels, reconciliation gaps are small and explained, and team leads accept the method. Charging back on shaky data turns cost reviews into arguments about the data instead of decisions about the agents.
Handle shared and platform costs openly
Some AI spend has no single owner: the gateway itself, vector databases, evaluation runs, guardrail models and the platform team's own work. Decide up front how each is split and write it down.
Common approaches are a proportional share based on each team's direct usage, a fixed platform fee per team or agent, or keeping a central budget for shared services so that only direct model usage is charged back. Any of these can work. What matters is that the rule is stable, published and applied the same way every period.
Shared caches need particular care. When one team's request is answered from a cache another team warmed, decide whether the saving is shared or credited to the team that paid for the original call. The post on semantic caching for AI agents covers the isolation side of the same question.
Report unit costs, not just totals
A rising monthly total can mean waste or growth. Unit costs make the difference visible: cost per resolved ticket, per processed document or per completed agent run. Pair each team's spend with the business volume it served and trends become easier to judge.
Unit costs also connect chargeback to value. A team whose spend grows while its cost per outcome falls is doing well, and the report should show that. This links directly to measuring AI agent ROI against a pre-launch baseline, and to the controls in how to control what an AI agent costs to run.
Who should own AI chargeback
AI chargeback sits between engineering, finance and the business. Engineering owns the labelling and the gateway, finance owns the reconciliation and the allocation rules, and each product owner answers for their team's numbers. A named owner for the whole process stops it fading after the first quarter of reports.
If you are building or scaling AI agents across several teams and want cost attribution designed in from the start, talk to CodeDTX.
Frequently asked questions
What is the difference between showback and chargeback for AI costs?
Showback reports each team's AI spend so they can see it, but the cost stays in a central budget. Chargeback moves the cost into the team's own budget, so it affects their planning and decisions. Most organisations start with showback to fix labelling gaps and build trust in the numbers, then move to chargeback once attribution reliably matches the provider invoice and team leads accept the method.
Do we need an AI gateway to do chargeback?
Not strictly, but it makes chargeback far easier. A gateway or shared client library gives one place to require labels, record tokens and prices, and block untagged traffic. Without one, each team must instrument its own calls consistently, which tends to drift over time. Separate API keys per team are a simpler start, but they cannot show which agent or workflow inside a team is driving the spend.
How should shared AI platform costs be split?
Pick one rule and apply it consistently. Options include splitting shared costs in proportion to each team's direct model usage, charging a fixed platform fee per team or agent, or funding shared services centrally and charging back only direct usage. Write the rule down, publish it with every report, and review it occasionally rather than changing it whenever a team disputes its share.
What should happen to spend that cannot be attributed?
Keep it visible. Record unattributed spend as its own line in every report instead of spreading it across teams, because spreading it hides the labelling problem that caused it. Assign someone to investigate the largest unlabelled sources, such as an old script, a missing header or a new agent outside the gateway, and track the unattributed share until it is small enough to ignore.



