What is token accounting?

Definition

AI token accounting captures how many tokens a model receives and produces, often separating cached, reasoning and ordinary output categories. The records support context management, cost estimation, quotas and usage reports.

A proxy must normalize provider-specific usage fields without inventing precision. Tokenizers and billing categories can differ, so accounting should retain the provider's authoritative values and identify requests where complete usage data is unavailable.

ELI5

Token accounting records how many tokens an AI request sends and receives. It may separate ordinary input, cached input, hidden reasoning categories, and visible output so teams can manage context, cost, quotas, and usage reports.

For example, a gateway can store the provider's reported input and output counts for every request. Because providers use different tokenizers and billing categories, the gateway should retain authoritative values and mark missing data instead of inventing precision.

Why track input and output tokens separately?

They can have different prices and resource costs, and separating them helps explain where a request's usage and bill originated.

Do all models count tokens the same way?

No. Tokenizers and usage categories vary, so counts from different models may not represent identical amounts of text or computation.

  1. A flat routing illustration beside the words Route Any Model
Definition card for token accounting: What is token accounting?

AI token accounting records the input, output and related token usage associated with model requests.