1. What a Token Actually Is (and Why Characters Lie)
Large language models do not read text character-by-character or word-by-word. Instead, they split input into subword chunks called tokens using Byte Pair Encoding (BPE) or SentencePiece vocabularies. Modern OpenAI models (GPT-6.2 Astra, GPT-6.2 Sol, GPT-6 Luna) use the o200k_base vocabulary of 200,000 tokens, whereas Claude 5.5, Gemini 4, DeepSeek V4, and Qwen4 Max ship their own trained tokenizers.
In plain English prose, 1 token averages roughly 4 characters, or about 0.75 words. That heuristic breaks down quickly in real engineering workloads. Indented JSON payloads, UUID strings, stack traces, and minified HTML often average only 2.2 to 3.0 characters per token because punctuation and whitespace splits trigger frequent token boundaries.
Non-English text also varies dramatically by tokenizer. A larger multilingual vocabulary like o200k_base or DeepSeek V4's tokenizer packs common CJK, Spanish, and French subwords more efficiently than legacy 50K-token vocabularies, but you should still measure representative payloads locally before committing to a model tier.
- Plain English prose: ~1.33 tokens per word (approx. 4.0 chars/token).
- TypeScript / Python code: ~1.6–2.0 tokens per word due to symbols and indentation.
- Verbose JSON logs: up to 40% higher token count than compact YAML or CSV.
3. Prompt Caching: The Highest-Leverage Cost Optimization
If your application sends a 4,000-token system prompt plus 15 MCP/function tool definitions on every user request, you are paying repeatedly for identical prefix tokens. Prompt caching stores the computed KV-cache state of that static prefix on the provider's GPU cluster and bills subsequent cache hits at a fraction of normal input pricing.
Anthropic discounts cache reads by 95% on Claude Sonnet 5.5 ($0.10/1M vs. $2.00/1M) and Claude Opus 5.5 ($0.20/1M vs. $4.00/1M), OpenAI discounts cached input by 95% on GPT-6.2 Sol ($0.10/1M vs. $2.00/1M), and DeepSeek V4.1 Flash discounts cache hits automatically by 98% ($0.003/1M vs. $0.15/1M) without explicit cache-control headers.
- Keep static instructions, tool schemas, and few-shot examples at the very top of your prompt.
- Place dynamic timestamps, user IDs, and retrieved RAG chunks at the end so you do not bust the cache prefix.
- Check minimum cacheable prefix thresholds (typically 1,024 tokens for OpenAI/Anthropic).
4. 1M+ Context Windows vs. Effective Cost
A 1,000,000+ token context window is now standard across Claude Sonnet 5.5 (1M), GPT-6.2 Sol (1.05M), Gemini 4 Neon (1M), Gemini 3.8 Flash (1M), Qwen4 Max (1M), and DeepSeek V4 Pro (1M)—and Grok 4.20 even stretches to 2M tokens. Still, massive context does not mean you should stuff an entire monorepo into every prompt. At $2.00 per 1M input tokens, a single 500K-token call costs $1.00 before generating a single output word—and prefill latency rises sharply.
Use targeted retrieval, file summaries, or our free LLM Token Counter and API Cost Calculator to benchmark prompt sizes before deploying automated loops or background cron agents.