Guide · Token Basics

What Are AI Tokens? And Why They Decide Your API Bill

Every AI model — GPT-4o, Claude, Gemini, Llama — reads text as tokens, thinks in tokens, and bills you per token. Understanding them is the fastest way to cut your AI costs.

A token is a chunk of text

Language models don't see letters or words — they see tokens: short chunks of text produced by a tokenizer. A token might be a whole common word like hello, half of a longer word like understandunder + stand, a piece of punctuation, or a few characters of code. Each token maps to an ID the model was trained on.

For everyday English the rule of thumb is simple:

Why tokens matter: cost

APIs charge separately for input tokens (what you send) and output tokens (what the model replies), and output usually costs 3–5× more. A GPT-4o call with 10K input and 2K output tokens costs about $0.045. Run that 1,000 times a day and you're near $1,350/month.

The multi-turn trap In a chat, every turn re-sends the full conversation history as input. A 20-turn chat doesn't bill 20 messages — it bills their sum over and over. This is why long chats get expensive fast, and why prompt caching (50–90% off repeated input) matters so much.

Why tokens matter: context windows

Every model has a maximum context window — from 8K tokens on legacy models to 1M+ on Gemini-class flagships. Your system prompt, conversation history, retrieved documents and the reply all share that budget. Exceed it and the request fails or truncates.

How to count tokens

  1. Exact: use the provider's own tokenizer library (tiktoken for OpenAI, countTokens for Gemini).
  2. Fast estimate: divide characters by ~4 (English) or use our calculator's character-density method across Latin, CJK, code and more.
  3. Plan budgets: multiply estimated tokens by the model's per-million price — including cache discounts and batch mode.

Five ways to spend fewer tokens

Estimate your tokens free

Paste any text into AITokenCalculator's free token calculator to see instant token counts and dollar costs across 51 models from nine providers — including images, audio and multi-turn conversations.

Token counting FAQ

How many words is 1,000 tokens?

For English text, 1,000 tokens ≈ 750 words (about 1⅓ tokens per word). The exact ratio varies with vocabulary, formatting and language — code runs ~2.5 characters per token, while CJK languages can take 1.5 characters or fewer.

How do I calculate tokens from characters?

Divide character count by the model's average characters-per-token: ~4 for English with OpenAI/GPT tokenizers, ~3.7 for Gemini, ~4 for Claude and Llama. Our free token calculator does this instantly for any pasted text.

Do I pay for both input and output tokens?

Yes. Every API call bills input tokens (your prompt) and output tokens (the reply) at different rates — output is typically 3–5× more expensive. Multi-turn chats re-send earlier turns as input each time, so costs grow quadratically without caching.

What happens if my prompt exceeds the context window?

The request fails or gets truncated. Context windows range from 8K tokens on small legacy models to 1M+ on Gemini-class models. Staying within limits — and pricing tiers — matters because some providers charge more above certain context thresholds.

Is there a free token counter?

Yes — AITokenCalculator estimates tokens and cost for 51 models across nine providers, including image, audio and multi-turn chat workloads. No signup required.