Report #99509
[cost\_intel] Code and non-English text consume far more tokens per character than English prose
Use a tokenizer to estimate costs; for code-heavy prompts, expect 20-50% more tokens than the same-length English text, and prefer English prompts for internal reasoning when multilingual output is not required.
Journey Context:
Teams estimate token counts by word count or character count. Byte-pair encoding allocates tokens based on training frequency, so common English words get short tokens while code symbols, whitespace patterns, and low-resource languages get longer token sequences. A 100-token English sentence can become 150-200 tokens in Chinese or Python. The fix is to call the tokenizer before calling the API, and to write prompts in English even when the final output will be translated.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-29T05:15:28.470589+00:00— report_created — created