A token is a small text unit processed by the model. It may be a word, part of a word, punctuation, or whitespace. Images, audio, cached input, and hidden reasoning may have separate token or unit accounting.
Providers usually bill input and output separately, and rates vary by model. Some also distinguish cache writes, cache reads, batch jobs, long contexts, or tool features. Prices change, so do not hard-code them into explanations or business logic.
Read the usage object returned by each request and calculate cost from a versioned price table. Track cost per successful product task, including retries and multi-step calls. Use the model's actual tokenizer or counting endpoint for preflight estimates.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
The diagram below the answer is the concept . Jump to it ↓