If you're building with the OpenAI, Anthropic or Google APIs, your bill is measured in tokens — not words or characters. Knowing roughly how many tokens your prompt uses helps you predict cost and stay within context limits. Here's the quick version, plus a free token & cost calculator.
A token is a chunk of text — often a word or part of a word. Common rules of thumb for English:
Code, punctuation and non-English text tokenize differently, so these are estimates — use a real tokenizer for exact counts.
Cost = (input tokens × input price) + (output tokens × output price). Prices are quoted per 1 million tokens, and output usually costs more than input. So:
Is token count the same across models? No — different models use different tokenizers, so the same text can be a slightly different number of tokens.
Does output cost more than input? Usually yes — check each provider's per-million-token pricing.