Input tokens
Everything the model reads per API call: system prompt, tool definitions, full conversation history, tool results. In agents this is re-sent on every call, so it compounds turn after turn.
Session-level metrics — token usage, tool-call counts, latency, cost — are the vital signs of an AI agent. This explainer shows exactly what each metric means, why input tokens dominate agent costs, and lets you simulate a workload to watch the meter run.
Everything the model reads per API call: system prompt, tool definitions, full conversation history, tool results. In agents this is re-sent on every call, so it compounds turn after turn.
Everything the model writes: reasoning, tool-call arguments, final answers. Priced ~5× higher than input, but usually far smaller in volume for agents.
Each tool invocation = an extra model round-trip. More tools per turn means more calls, and every call re-reads the whole context. Tool results also get appended to history — growing all future inputs.
Wall-clock time per turn ≈ (API round-trips × overhead) + (output tokens ÷ generation speed) + tool execution time. Output tokens are the slow part — models generate tens of tokens per second but read thousands.
Each pair of 3D bars is one turn: cobalt = input tokens, tangerine = output tokens. Drag to orbit. Move the sliders and watch how fast input dwarfs output.
Drag with mouse or finger to rotate · bars re-grow when you change the workload
Fixed assumptions: user message = 150 tok, each tool call the model writes = 120 tok (output), each tool result returned = 700 tok (input on the next call).
T+1 API calls.$3.00 / 1M input · $15.00 / 1M output · cached input reads $0.30 / 1M. Cost = in×3/10⁶ + out×15/10⁶.
≈ 0.8 s fixed overhead per API call + output tokens ÷ 60 tok/s generation + 0.5 s per tool execution.
| Turn | Input tok | Output tok | Cost |
|---|
Turn 1 reads ~— input tokens; turn 8 reads ~— — same question size, ~—× the input bill. That growth curve is what session-level token observability is for.
Healthy agents often run 10–50× more input than output. A sudden jump means runaway context — a loop appending junk, or tool results that are too fat.
Spikes signal retry loops or a confused agent hammering the same tool. Set a hard budget (e.g., 25 calls/session) and alert at 80%.
Tokens are the input; dollars-per-outcome is the KPI. A $0.09 session that solves the ticket beats a $0.02 one that doesn’t.
With prompt caching, stable prefixes (system prompt, tool defs, old history) can be re-read at ~10% of the price. Flip the caching toggle above — same tokens, a fraction of the cost.
The source token model assumes eight turns, two tools per turn, six thousand initial context tokens and four hundred final output tokens per turn. Each user message adds one hundred fifty, each tool call one hundred twenty and each tool result seven hundred. History grows by two thousand one hundred ninety per turn. Three calls reread context within each turn, so first-turn input is twenty thousand nine hundred ten and eighth-turn input sixty six thousand nine hundred. Bars span sixty two point seven three and two hundred point seven at point zero zero three pixels per token. Summed input is three hundred fifty one thousand two hundred forty, output five thousand one hundred twenty, with twenty four modeled calls. No actual API calls occur. The source assigns three dollars per million fresh input tokens, fifteen per million output and thirty cents per million cached input. Those are fixture constants, not verified current provider prices. Its cache heuristic marks three hundred thirty four thousand five hundred twenty input tokens cacheable and sixteen thousand seven hundred twenty fresh. Total cost is one point one three zero five two without caching and point two two seven three one six with caching. Bars span about two hundred three point four nine and forty point nine two at one hundred eighty pixels per dollar. The cached-input price is ninety percent lower, but total modeled cost falls about seventy nine point nine percent because output and fresh input still cost money. Token counts themselves do not change. The light preset uses four turns, zero tools, two thousand context and three hundred output per turn. Inputs total eleven thousand three hundred and outputs twelve hundred, represented by two hundred three point four and twenty one point six pixels at point zero one eight per token. The assumed latency is four calls times point eight seconds overhead plus twelve hundred output tokens divided by sixty tokens per second, giving twenty three point two seconds. It is an estimate, not measured throughput. The source installs arithmetic controls and creates the worked table before constructing Three. With missing Three, clicking a preset still updates captions before its bar rebuild fails on an undefined object. This distinction preserves real local arithmetic behavior without claiming a working 3D chart, actual billing, exhaustive tool checks or public deployment.