Source page: https://www.o10.io/tokens

Plain-text reference for reading, copying, and citation. Examples are illustrative; use your own credentials for API requests.

Model data: https://www.o10.io/api/models.json
Content index: https://www.o10.io/llms.txt

# AI tokens: input, output and the cost of context

Tokens are units a model uses to represent input or output. Language-model APIs often price input and output tokens separately. Token counts vary by tokenizer, language, content, and endpoint.

## Key takeaways

### What is tokens?

Tokens are units a model uses to represent input or output. Language-model APIs often price input and output tokens separately. Token counts vary by tokenizer, language, content, and endpoint.

## Count what the endpoint bills
A prompt can include instructions, conversation history, retrieved passages, tool descriptions, and other context. Output usage may include more than the text shown to the user, depending on the endpoint. Consult that endpoint's usage fields and billing documentation.
Do not treat a word-to-token estimate as an invoice calculation. Measure real usage for representative requests, especially for code, multilingual content, or structured data.

## Calculate input and output separately
Multiply input tokens by the input rate and output tokens by the output rate, using the price unit advertised by the provider. Add other billed usage. A blended rate is valid only for the particular input/output mix used to calculate it.
Illustrative example: 1,000 input tokens at $2 per million cost $0.002. Another 1,000 output tokens at $6 per million cost $0.006. The total is $0.008 before other charges; doubling the output changes the cost even though the prompt is identical.

## Reduce context without losing required evidence
Remove redundant instructions and unrelated retrieval results, and set output limits that still allow the task to finish. Check whether the chosen endpoint supports caching or batch processing and whether your traffic meets its conditions.
Shorter is not automatically better. If removing a source causes incorrect answers or additional retries, the application may spend more per accepted result. Evaluate changes using task outcomes as well as token totals.

## Methodology

Cost examples are illustrative. Measure quality and total costs on your own tasks, and check current endpoint terms before implementation.

## Related links

- [AI inference: from model output to production system](https://www.o10.io/ai-inference)
- [AI agents: useful actions, measurable outcomes](https://www.o10.io/ai-agents)
- [LLM routing: choose a model per task with explicit constraints](https://www.o10.io/routing)
- [Inference spend: calculate cost per accepted outcome](https://www.o10.io/inference-spend)

## Source URL

https://www.o10.io/tokens
