๐งฎ What are tokens?
Tokens are the basic units of text that large language models use to process inputs and generate outputs. A token might be:
– A single word (hello)
– A part of a word (incomprehensible โ split into multiple tokens)
– Or even a punctuation mark (!, ?)
๐ค Real-world examples:
โข โHello worldโ = ~3 tokens
โข โLarge Language Models (LLMs) are powerful tools.โ = ~9 tokens
โข A paragraph of 100 words = ~150 tokens on average
Different models may tokenize differently, but as a rule of thumb:
1 token โ 4 characters in English, or about ยพ of a word.
๐ What is an API call?
An API call is a request you send to the model. Each call usually includes:
– A prompt: what you ask the model to do
– System or user instructions
– Additional parameters (temperature, max tokens, etc.)
๐ก Whether youโre sending one message or chaining calls for an app, each request counts as one API call.
Some providers only charge based on tokens, while others (like AWS, DeepInfra, or Fireworks) may include a small flat fee per call.
๐ธ How is the total cost calculated?
Most providers calculate usage-based cost with this formula:
๐งพ Formula:
Total cost = ((Input tokens ร input price) + (Output tokens ร output price)) ร number of API calls, then divided by 1,000
๐ Example:
Input tokens = 800
Output tokens = 1200
API calls = 2
Price in = $0.005/token
Price out = $0.015/token
Cost = ((800ร0.005 + 1200ร0.015) ร 2) / 1000 = $0.072
๐ง Our calculator uses this exact logic and normalizes pricing per 1,000 tokens for easy comparison.
๐ง Why this matters
Whether you’re:
– A dev building with OpenAI or Mistral
– A startup comparing providers
– Or just curious about how much you’re spending
โฆunderstanding tokens and API billing helps you:
โ
Optimize prompt size
โ
Pick the right model
โ
Avoid billing surprises
๐ Learn more
๐ OpenAI Tokenizer โ https://platform.openai.com/tokenizer
๐ OpenAI Token Guide โ https://platform.openai.com/docs/introduction/tokenizers
๐ Anthropic Pricing โ https://docs.anthropic.com/claude/docs/pricing
๐ Google Gemini Pricing โ https://ai.google.dev/gemini-api/docs/pricing
๐ DeepInfra Docs โ https://deepinfra.com/docs#pricing
โ FAQ โ Frequently Asked Questions
๐ธ How many tokens in a tweet?
A typical tweet (~280 characters) = around 70โ80 tokens.
๐ธ Are input and output tokens billed the same?
Not always. Some models (like Claude or GPT-4 Turbo) charge less for input tokens than output ones. Check the model’s pricing details.
๐ธ Is there a minimum number of tokens per call?
Yes. Even a short call usually consumes at least a few tokens, and some providers may have a minimum billing amount per request.
๐ธ What if I send empty input?
Even without input, many models return system tokens or default completions โ and youโll still be billed for the output tokens and the call.

