AI Models & Companies · AI Developer Tools and APIs
What does 'tokens' mean when you're being billed for an AI API
A token is a chunk of text — often a word or part of a word — that an AI model processes as its basic unit of input and output, and API billing is typically based on the total number of tokens processed rather than a simpler measure like characters or requests.
Key takeaways
- A token is a chunk of text, often roughly a word or part of a word, that a model uses as its basic processing unit.
- API pricing is typically based on the number of tokens in both the input sent to the model and the output it generates.
- Input and output tokens are sometimes billed at different rates, since generating output is generally more computationally expensive than processing input.
- Longer prompts and longer responses both directly increase token usage and cost, which matters for applications processing large amounts of text.
What a Token Actually Is
A token is a chunk of text — often roughly a word or part of a longer word — that an AI model breaks text into as its basic unit of processing, rather than processing raw individual characters or whole sentences directly; a rough rule of thumb is that a token is somewhat shorter than an average word.
How Tokens Translate Into a Bill
API billing for most providers is based on the total number of tokens processed — both the tokens in the prompt sent to the model and the tokens the model generates in its response — rather than a simpler measure like total characters, number of requests, or a flat per-use fee.
Why Input and Output Are Often Priced Differently
Many providers charge different rates for input tokens versus output tokens, since generating new text is generally more computationally expensive for the model than processing text it’s given to read — this distinction matters for estimating real costs of an application that generates long responses versus one that mostly processes existing text.
Why This Matters for Building an Application
Because both longer prompts and longer generated responses directly increase token usage, an application processing large documents or generating long-form output will accumulate cost differently than one handling short, simple exchanges — worth estimating before assuming a rough cost based only on number of requests.
Bottom Line
Tokens are the basic text-processing unit AI models use, and API costs are calculated based on how many tokens are processed in both directions — understanding this is necessary for realistically estimating what a given application will actually cost to run.
Count Your Tokens
See an instant token, word, and character count for any text with our free Token Counter — no signup required.
Go deeper
Related questions
- What's the Difference Between an AI API's Free Tier and Paid Usage?
- What Is an AI API and How Do Developers Use It?
- What Is the Difference Between Using an AI Chat App and Calling Its API Directly?
- Why Do AI APIs Sometimes Return Different Output Than the Same Prompt in a Chat App?
- What Does 'Rate Limiting' Mean for an AI API?
- How Do Developers Handle an AI API Going Down or Being Slow?
Sources
- [1]OpenAI API documentation — OpenAI
- [2]Anthropic API documentation — Anthropic
Written by Editorial Team
Last updated August 7, 2026
Get one well-sourced answer a week
No spam. Unsubscribe anytime.