How it works
A call reports input tokens and output tokens. Some providers also report cached input, served from a cache rather than processed at the full input rate. If the cache figure is absent, leave it absent. Do not store a zero and call it measured. A run total adds the calls you meant to include, retries as well as the last call, and it should say so. The total is still a count. A price lives on a pricing page and can change while the counts stay put. Cost is the counts times that price, per token type, afterwards.
A solicitor asks for a lease summary covering term, break clause, and repair duties. The first call is mostly input. The summary is a smaller output count. After the solicitor says the break clause was missed, a second call sends the lease again. If that call reports cached input, those tokens are a third number, not a repeat of the input line. The counts do not say the summary was complete.
A worked example
Two calls on one lease summary
Task: summarise the lease into term, break clause, and repair duties.
Call 1. Input tokens: 18000. Output tokens: 400. Cached input: not reported.
The summary names the term and the repairs. The break clause is missing, and the solicitor says so.
Call 2. Input tokens: 18000. Output tokens: 220. Cached input: 17000, reported by this provider.
The reply adds the break clause.
Run usage, both calls included: input 36000, output 620, cached input 17000. Cached input is not added into input a second time. The price that would turn these counts into money comes from the pricing page, and it is not part of the usage figure. The counts also do not say the three headings are now present.
Illustrative example, not a production trace and not a measured result.
What goes wrong
- Cached input is ignored, or a missing cache field is stored as zero. The lease rerun looks fully priced at the input rate, and the invoice later does not match.
- Retries are dropped, or included with no note. Two readers add the same lease and publish two official totals.
- The token total is labelled as cost. No price from the pricing page has been applied, so the figure cannot be checked against a bill, and a later price change is invisible.
How to measure it
Store input, output, and cached input as separate counts, and only store cached input when the provider reported it. Decide in writing whether a run total includes retries and failed calls. Apply the price afterwards, from the pricing page, per token type.
Reconcile a sample of runs with the provider invoice for the same period. A gap usually means a missing call, a double count, or a cache field handled wrongly. Do not use the token total as a stand-in for task success.
Further reading
How Abracadabra helps
Token counts explain the shape of a call. They are not a cost, and they are not a finished lease summary. Keep the task outcome beside the usage so spend can be read against work that completed.
A trace says the run finished. Abracadabra says whether the person got the job they came to do, and keeps that outcome on the conversation. It complements tracing and OpenTelemetry. It does not ingest spans or replace a trace tool.
Request access to read this on your own agent.