> ## Documentation Index
> Fetch the complete documentation index at: https://aivision.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Read the relevant procedure and prerequisites before suggesting commands. Cite the section and give an observable check. Treat sample data as illustrative. Report product actions and results only when verified in the user's environment.

# Token accounting

> Understand input, cache, and output usage before comparing dashboards, traces, and bills.

Token usage measures the content processed by the model in collected requests. Agents often resend conversation history across turns, so usage can greatly exceed the text you typed and the final answer. Assess usage alongside the task, request count, cache, and tool activity.

Costs also depend on rates and billing mode. See [complete model costs](https://aivision.mintlify.site/en/guides/model-pricing.md) to add missing prices, understand cache charges, and value Coding Plan usage as a separate token-rate reference.

## Align the comparison scope

Use the same space, Agent, model, time range, and set of records. A Session may contain multiple traces, and a Trace may contain multiple model requests. A dashboard total and one model node measure different scopes.

Token counts are also different from cost. Even when a data source supplies monetary amounts, cache pricing, provider billing rules, and collection completeness affect comparisons. Use the provider's bill for actual charges.

## Read the known subtotal and reporting coverage

The native Trace list and detail summary use the same usage accounting. Read the completeness message beside the number:

| Display | Meaning |
| - | - |
| Full total unknown; known subtotal of 120 tokens | 120 sums the known call usage. Missing or overlapping usage prevents treating it as the complete Trace total. |
| 10 / 11 calls reported total tokens | Of the 11 collected and identified model calls, 10 have a known total. This is neither a count of all Spans nor a collection success rate. |
| 0 tokens | A known zero. Missing usage stays unknown rather than becoming zero. |

Model calls include generations and embeddings, with each call counted once. If a call has no reported total but its normalized input and output are both complete, their sum can establish a known total. Input, output, and total completeness are assessed separately: a known total can still have an unknown input or output breakdown.

The detail image below uses a separate example: two of three model calls sum to 120 tokens and the remaining call has unknown usage. Both list and detail retain the 120 subtotal, 2 / 3 coverage, and unknown full total. Find the model node with missing usage and check its source fields and collection configuration before comparing a dashboard or bill.

[![Native Trace detail showing a known subtotal of 120 tokens, an unknown full total, and two of three calls with known totals](https://mintcdn.com/aivision/EQjEGLsBZrtiRNwB/assets/figures/trace-feedback/summary.en.light.png?fit=max\&auto=format\&n=EQjEGLsBZrtiRNwB\&q=85\&s=02aac93c3b49579bb0a2955cae12cf26)](https://aivision.mintlify.site/assets/figures/trace-feedback/summary.en.light.png)

[![Dark native Trace detail showing a known subtotal of 120 tokens and two of three calls with known totals](https://mintcdn.com/aivision/EQjEGLsBZrtiRNwB/assets/figures/trace-feedback/summary.en.dark.png?fit=max\&auto=format\&n=EQjEGLsBZrtiRNwB\&q=85\&s=c20b8c2fff544972a2589f66512cee69)](https://aivision.mintlify.site/assets/figures/trace-feedback/summary.en.dark.png)

Detail summary with a known subtotal and 2 / 3 reporting coverage · demonstration data · click to enlarge

Even 11 / 11 only means those identified calls have known totals; it does not prove every call was collected. Nested model calls can report overlapping usage. The UI keeps the overlap warning and unknown total instead of presenting the subtotal as deduplicated consumption. When no model call is identified, this usage summary is omitted; that alone does not establish zero consumption.

## Does input already include cache?

| Current dashboard | Meaning of input | Total calculation |
| - | - | - |
| Claude Code | New input, excluding cache reads and writes | Input + cache read + cache creation + output |
| Codex | Total input, including cached input | Input + output |

For Codex, cached tokens are a subset of input; reasoning tokens are a subset of output. Do not add them again. Cache hit rate divides cached input by total input; do not infer a rate when the denominator is zero.

Other Agents and framework integrations can use different fields. Check the current metric tooltip and the model node's raw usage before reusing a formula just because a field is named `input_tokens`.

## Check a worked example

This hypothetical Claude Code request illustrates the field relationships:

| Item | Tokens |
| - | -: |
| New input | 5,000 |
| Cache read | 40,000 |
| Cache creation | 5,000 |
| Output | 3,000 |
| Total input, including cache | 50,000 |
| Total processing volume | 53,000 |

A dashboard can show 5,000 new input tokens while normalized input is 50,000. First verify that the record actually contains these four components. Adding cache to 50,000 again would double-count it.

[![Where 53,000 tokens come from](https://mintcdn.com/aivision/coKTz7l1X0d3dZJw/assets/diagrams/tokens.en.light.svg?fit=max\&auto=format\&n=coKTz7l1X0d3dZJw\&q=85\&s=ed00e776c2a3693390b7285036224f8c)](https://aivision.mintlify.site/assets/diagrams/tokens.en.light.svg)

[![Where 53,000 tokens come from](https://mintcdn.com/aivision/coKTz7l1X0d3dZJw/assets/diagrams/tokens.en.dark.svg?fit=max\&auto=format\&n=coKTz7l1X0d3dZJw\&q=85\&s=770e5da916609d44a1b992242fa85e7f)](https://aivision.mintlify.site/assets/diagrams/tokens.en.dark.svg)

Where 53,000 tokens come from

Click a diagram to open the full-size SVG.

## Check one of your own records

Start with a completed Trace containing a model call:

1. Open **Agent traces → Trace**, confirm the space, Agent, source, and time range, then open **Chain** in the details.
2. Select one model call. In native details, expand **Attributes** on the right and switch to **JSON**. In Langfuse details, inspect the usage badge and **Metadata**. Record the input, output, cache, and total fields actually present, with the Trace and node IDs.
3. Check whether fields are normalized and input already includes cache; do not apply a dashboard formula just because node fields have similar names. Calculate only with complete, defined buckets, and do not add cache to input that already includes it. For one model call, prefer its reported total; do not replace it with a sum of incomplete input or output buckets. For the whole Trace, also check reporting coverage and overlap warnings.
4. Return to **Data dashboard**, record the total and request count for the same interval, and check for other requests before explaining a difference.

The result is a set of numbers with IDs, a time range, source fields, and a calculation. If only the total is known, record that the breakdown is unknown. Gather collection or application-side usage evidence to investigate further; do not fill missing buckets with zero.

## Explain differences between views

| Symptom | Check first |
| - | - |
| Similar totals, different input subtotals | Whether input includes cache and whether trace usage was normalized. |
| Different totals | Request set, event and trace completeness, time range, and filters. |
| Session usage exceeds one Trace | Whether the Session includes several turns. |
| Agent or provider totals differ | Client collection versus server billing scope and cache definitions. |
| Missing usage or placeholders | Whether the source supplied the field; missing does not mean zero. |

Use the [dashboard](https://aivision.mintlify.site/en/guides/dashboard.md) to locate the time and model, then inspect raw usage in a model node of a [Trace](https://aivision.mintlify.site/en/guides/traces.md). Record both comparison scopes and field names, rather than just two totals.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.