In this article
Include root work, children and retries; cached input and reasoning are subsets, while missing usage and cache-write details prevent exact billing reconstruction.
Count the work that produced acceptance
A root answer can be short while its specialists make many model calls. Measuring only the final response length hides the task’s resource use. The Agents API observability guide recommends inspecting root and subagent turns, including retries, together with applicable tool, sandbox and third-party charges. The Responses guide likewise warns that delegation can increase tokens. The research question is what the available records can support, rather than how to make a small root message look inexpensive.
Keep category arithmetic correct
The observability guide states that cached tokens are included in input tokens and reasoning tokens in output tokens. Adding either detail to its parent category again inflates the total. Choose a consistent accounting level and retain provenance for each value. Do not combine a session aggregate with the same individual turns as though they were disjoint work. Where aggregation semantics or coverage are uncertain, preserve that uncertainty and reconcile it instead of presenting a mechanically summed number as authoritative.
Preserve unknown values as unknown
Recorded usage is best-effort, can be null and may change as accounting arrives. Missing usage is not zero, and the counts are not a final bill. The guide also notes that Agents API usage does not expose a separate cache-write count, so those fields cannot determine exact model charges where cache-write pricing applies. This is a substantive limit on reconstruction. A high cached-input percentage also does not establish low total task cost when repeated calls, output and other resources remain substantial.
A possible six-month capability
An editorial scenario through May 6, 2027 is a budget controller that estimates the remaining cost of completing an agent graph from reconciled historical tasks. Turn-level attribution, explicit unknowns and an acceptance ledger provide the mechanism. It is not a promised billing oracle. The condition is sufficiently complete records and task families with usable cost patterns. Persistent missing usage, shifting pricing dimensions or unpredictable integration retries would weaken the forecast and require wider estimates or stricter admission rather than spurious precision.
Validate accounting with recognizable cases
A proposed fixture includes a root turn, child turns, a retry and delayed usage. Verify subset arithmetic, pagination and unknown-state handling before comparing architectures. Budget counter scope explains why a limit is not a complete cost account. Terminal request records explain reconciliation across observations. No actual invoice or measured savings is claimed. A useful account states which task produced the accepted artifact, which resources were observed and what still prevents an exact total, making comparisons reproducible rather than deceptively precise.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.