🧬Token Usage
Also known as Token Count, LLM Usage, Input and Output Tokens
How many tokens a call used. Input and output are each counted.
Think of it like
Think of it like a taxi meter. It counts the trip, and you pay for what it counts.
Example
Emma logs the usage of every call. She finds one chat sends 9,000 input tokens of old history each time for a 50-token reply, and trims it.
Why it matters
Usage is what you pay for. Watching it is how you find calls that are slow or cost too much.
Definition
Example code
json
"usage": {
"input_tokens": 1240,
"output_tokens": 312
}Common mistake
Key takeaways
- 1Input and output. Counted apart.
- 2Comes with each reply. Log it.
- 3History adds up. Each turn resends it.