Guides / track llm cost by tool call
How to track LLM cost by tool call
To track LLM cost by tool call you record which tool a call belongs to, including the model calls tools make internally, then price and roll them up to the request that triggered them. Culpa, a local-first LLM cost, margin, and forecast ledger, prices each call and attributes it to the tool and the run, so nested spend lands where it was caused.
Why this happens
Tool calling doubles the number of places money leaves and most attribution only follows the first. The visible cost is the model deciding which tool to invoke, which is a small call carrying the tool schema. The hidden cost is what the tool then does, and if that tool summarises a document, reranks results or calls a sub-agent, it makes model calls of its own. Those calls are real spend and they usually get attributed to the tool as a standalone actor, or to nothing at all, rather than to the request that caused them. There's a second, quieter effect. Every tool definition sits in the input of every call that might use it, so tools you rarely invoke still bill on every request that carries their schema. A tool you added and forgot costs money for as long as it stays in the definition list.
What this usually looks like
- Your tool schemas grew and cost per request rose with them, on requests that used no tools.
- A tool makes its own model calls and nothing connects them to the request that triggered it.
- You can count tool invocations and can't price them.
- Nobody can say which tool is the expensive one, only which is the popular one.
- A deprecated tool is still in the definition list and still on every request.
Free, no card, no account
Run the free Cost Leak Scan
It shows your most expensive conversation before you install anything.
Mistakes that cost the most
| Mistake | Why it hurts | Do instead |
|---|---|---|
| Attributing only the tool-selection call. | The selection call is the cheap half. What the tool does next is usually the expensive half. | Attribute nested model calls to the tool AND roll them up to the triggering request. |
| Ignoring the cost of tool definitions on unrelated requests. | Schemas ride in the input of every call that could use them, whether or not anything is invoked. | Count the tokens your definition list adds and multiply by total requests, not tool uses. |
| Ranking tools by invocation count. | A rarely-used tool that summarises a long document can outspend a frequent trivial one. | Rank by priced cost, including everything the tool does downstream. |
| Leaving deprecated tools in the definition list. | They cost input tokens on every request forever, and nothing surfaces them because nothing calls them. | Audit the definition list against actual invocations and remove what never fires. |
Run this check tonight
- Count the tokens in your full tool definition list.
- Multiply that by every request that carries it, including requests that invoke nothing.
- Pick your most-invoked tool and add up the model calls it makes internally.
- List every tool defined but never invoked in the last month.
The tool schema tax, and the nested call behind it
A modelled agent carries six tool definitions totalling 1,400 input tokens, on 2 million requests a month, of which 15% actually invoke the summarisation tool. That tool makes one model call of its own at 12,000 input and 600 output tokens. Priced on Claude Haiku 4.5 at real rates of $1.00 and $5.00 per million from the price book, effective 2026-07-02. Volumes are modelled.
The schema tax is charged on 2 million requests and the nested calls on 300,000, so the two halves scale on different denominators and neither appears on a tool-invocation dashboard. Attributing only the selection call would have reported a fraction of this.
Every number, with its confidence and source
| Figure | What it means | Confidence | Source |
|---|---|---|---|
| $7,300.00 per month | modelled cost attributable to one tool, counting its schema tax and its nested model calls | calculated | Arithmetic shown in full on this page. 1,400 schema tokens x 2,000,000 requests = $2,800.00, plus 300,000 invocations x (12,000 input and 600 output) = $3,600.00 + $900.00 = $4,500.00. Real Claude Haiku 4.5 rates of $1.00 and $5.00 per million from the price book effective 2026-07-02. Every volume, the schema size and the invocation rate are modelled. |
| $2,800.00 per month | the schema portion alone, charged on requests that invoke no tool at all | calculated | 1,400 tool-definition tokens x 2,000,000 requests = 2,800,000,000 input tokens, at the real $1.00 per million input rate from the price book effective 2026-07-02. Reported separately because it scales on total requests rather than on invocations, which is why an invocation-count dashboard never shows it. |
What a generic answer can’t know
A provider sees a request with a tool schema in it and a later, unrelated request that happens to be the tool doing its work. Nothing in that view connects the two, so no external dashboard can roll nested spend up to the request that caused it. Culpa carries the run and tool identifiers through both hops, prices every call from a versioned price book in exact decimal, and keeps the ledger on your own infrastructure, so the answer to which tool is expensive includes what that tool does downstream rather than only what it cost to choose. That's also what makes the schema tax visible: it's a cost with no invocation attached, which means it only shows up if you're pricing input tokens against the requests that carried them.
Questions founders ask next
Do tool definitions cost money if the tool is never called?
Yes. Tool schemas sit in the input of every call that could use them, so they bill on every request that carries the definition list, invoked or not. A modelled list of 1,400 tokens across 2 million requests is $2,800.00 a month at a $1.00 per million input rate.
How do I attribute the model calls a tool makes internally?
Carry the run identifier and a tool identifier into the tool's own calls, then roll them up two ways: to the tool, so you can rank tools by real cost, and to the triggering request, so a run total includes everything it caused.
Which tools are usually the expensive ones?
Not the most invoked. Tools that summarise long documents, rerank retrieval results or delegate to a sub-agent make large model calls of their own, so a tool used on 15% of requests can outspend one used on all of them.
How do I find tools that cost money and do nothing?
Compare your tool definition list against actual invocations over a month. Anything defined and never invoked is pure schema tax, charged on every request that carried it, and nothing will surface it because nothing calls it.
On your infrastructure
Culpa runs on your infrastructure. Your prompts and responses never leave it. Culpa counts calls to run your plan, and it fails open, so if it ever breaks your app keeps running.
How Culpa works
Find the culprit. Not just the total.
Your dashboard shows what you spent. It stops short of who spent it. Culpa shows the conversation, the user and the feature behind it.
Your prompts stay local.
Culpa runs on your own infrastructure. What you send to a model reaches us at no point.
Every dollar has a name.
Follow any charge to the conversation, the user, the feature and the customer behind it.
See the bill before it lands.
Cost your next feature before you ship it. You get the likely bill and the worst case, at best, median, p90 and p99.
Three steps to your first answer.
Change one base URL.
Or drop in the Python or TypeScript library.
Find your most expensive conversation.
In the first session, not the first week.
Cost your next feature before you ship it.
Why the bill went up
Example dashboardCalls traced
418,209
across 3 projects
Spend this week
$378.41
+ $182 vs last week
Failed calls
312
74% retried, and you paid for all of them
+ $182 this week traced to one culprit
Spend over 14 days
Most expensive users
Next week forecast
Graded against reality. Accuracy shown as results land.
Keep reading
Sources: Anthropic pricing. Last reviewed 2026-08-03, rates effective 2026-07-02. Plain text version.