<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Behrooz</title>
    <description>The latest articles on DEV Community by Behrooz (@behrouzbk).</description>
    <link>https://dev.to/behrouzbk</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F903931%2F2239ff54-2aee-4801-aff6-2b1ea1c13183.jpeg</url>
      <title>DEV Community: Behrooz</title>
      <link>https://dev.to/behrouzbk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/behrouzbk"/>
    <language>en</language>
    <item>
      <title>The language token tax: why your non-English prompts cost more, and what to do about it</title>
      <dc:creator>Behrooz</dc:creator>
      <pubDate>Thu, 29 Oct 2026 21:47:52 +0000</pubDate>
      <link>https://dev.to/behrouzbk/the-language-token-tax-why-your-non-english-prompts-cost-more-and-what-to-do-about-it-ib2</link>
      <guid>https://dev.to/behrouzbk/the-language-token-tax-why-your-non-english-prompts-cost-more-and-what-to-do-about-it-ib2</guid>
      <description>&lt;p&gt;AI APIs don't bill you per word. They bill you per &lt;strong&gt;token&lt;/strong&gt;, and a token is whatever&lt;br&gt;
the model's tokenizer decided a piece of text should be.&lt;/p&gt;

&lt;p&gt;That sounds like a detail until you count. Here's one instruction, "Always answer in&lt;br&gt;
JSON format.", on GPT-4o's tokenizer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;English: &lt;strong&gt;6 tokens&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Hindi: &lt;strong&gt;9 tokens&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Punjabi: &lt;strong&gt;18 tokens&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Same meaning, three times the price. I've started calling this the &lt;strong&gt;language token&lt;br&gt;
tax&lt;/strong&gt;, and if you ship LLM features outside English, you're paying it on every call.&lt;/p&gt;
&lt;h2&gt;
  
  
  Tokens are not words
&lt;/h2&gt;

&lt;p&gt;Modern tokenizers learn their vocabulary from training data. They see a huge amount of&lt;br&gt;
English, so common English words become single tokens: &lt;code&gt;answer&lt;/code&gt;, &lt;code&gt;format&lt;/code&gt;, &lt;code&gt;always&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Languages that show up less often in that data don't get that treatment. Their words&lt;br&gt;
are split into smaller pieces, sometimes down to single characters or raw bytes. More&lt;br&gt;
pieces means more tokens, and more tokens means a bigger bill and less room in the&lt;br&gt;
context window.&lt;/p&gt;
&lt;h2&gt;
  
  
  I measured it in 55 languages
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/behrouzbk/tokensaver" rel="noopener noreferrer"&gt;tokensaver&lt;/a&gt;, the open-source prompt-cost tool&lt;br&gt;
I maintain, has a test that runs the same sentence in 55 languages. So I counted every&lt;br&gt;
one of them with &lt;code&gt;o200k_base&lt;/code&gt;, the tokenizer behind GPT-4o and OpenAI's other current&lt;br&gt;
models:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Language&lt;/th&gt;
&lt;th&gt;Tokens&lt;/th&gt;
&lt;th&gt;vs. English&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;English&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;1.0×&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Spanish&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;1.2×&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;French, Russian, Persian, Chinese (Simplified)&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;1.3×&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;German, Arabic, Hindi, Japanese&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;1.5×&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Korean, Swahili&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;1.7×&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bengali&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;1.8×&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tamil, Burmese&lt;/td&gt;
&lt;td&gt;14&lt;/td&gt;
&lt;td&gt;2.3×&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Telugu&lt;/td&gt;
&lt;td&gt;17&lt;/td&gt;
&lt;td&gt;2.8×&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Punjabi (Gurmukhi)&lt;/td&gt;
&lt;td&gt;18&lt;/td&gt;
&lt;td&gt;3.0×&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;36 of the 55 languages needed at least 1.5× as many tokens as English.&lt;/strong&gt; Not one of&lt;br&gt;
them came out cheaper.&lt;/p&gt;

&lt;p&gt;You can check this yourself in a few lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tiktoken&lt;/span&gt;

&lt;span class="n"&gt;enc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tiktoken&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_encoding&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;o200k_base&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;lang&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;English&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Always answer in JSON format.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hindi&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;हमेशा JSON प्रारूप में उत्तर दें।&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Tamil&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;எப்போதும் JSON வடிவத்தில் பதிலளிக்கவும்.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;lang&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;enc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; tokens&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  It used to be much worse
&lt;/h2&gt;

&lt;p&gt;The older &lt;code&gt;cl100k_base&lt;/code&gt; tokenizer, used by GPT-4 and GPT-3.5 Turbo, shows how much has&lt;br&gt;
changed. Same sentence:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Language&lt;/th&gt;
&lt;th&gt;cl100k_base (older)&lt;/th&gt;
&lt;th&gt;o200k_base (current)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;English&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hindi&lt;/td&gt;
&lt;td&gt;28 (4.7×)&lt;/td&gt;
&lt;td&gt;9 (1.5×)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bengali&lt;/td&gt;
&lt;td&gt;36 (6.0×)&lt;/td&gt;
&lt;td&gt;11 (1.8×)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tamil&lt;/td&gt;
&lt;td&gt;47 (7.8×)&lt;/td&gt;
&lt;td&gt;14 (2.3×)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Telugu&lt;/td&gt;
&lt;td&gt;71 (11.8×)&lt;/td&gt;
&lt;td&gt;17 (2.8×)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Newer tokenizers have narrowed the gap a lot, but they haven't closed it. Two practical&lt;br&gt;
takeaways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;If you're still on an older model, the tax may be several times bigger than you
think.&lt;/strong&gt; Moving to a newer model can cut tokens for non-English prompts even before
you touch the prompt.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Every provider tokenizes differently.&lt;/strong&gt; Claude and Gemini use their own tokenizers,
and there's no offline way to count them exactly. Measure on the model you actually
use.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A word of caution: this is one short sentence. Ratios move around with the text, so&lt;br&gt;
treat these numbers as a direction, not a price list. Before you budget a product in&lt;br&gt;
another language, count your own prompts in that language.&lt;/p&gt;
&lt;h2&gt;
  
  
  What you can't fix, and what you can
&lt;/h2&gt;

&lt;p&gt;You can't change how a tokenizer splits Tamil. But a lot of what makes prompts expensive&lt;br&gt;
has nothing to do with language:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pretty-printed JSON.&lt;/strong&gt; Indentation and line breaks cost tokens in every script.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Duplicated rules.&lt;/strong&gt; A rule pasted twice is paid for twice, in any language.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extra whitespace.&lt;/strong&gt; Trailing spaces and runs of blank lines.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are exactly the fixes that work everywhere, so I made sure tokensaver applies them&lt;br&gt;
in any language. I tested it on three sample prompts with that kind of waste: one each&lt;br&gt;
in English, Persian and Chinese. Here are the results on GPT-4o with&lt;br&gt;
&lt;code&gt;tokensaver optimize --apply all&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Prompt&lt;/th&gt;
&lt;th&gt;Before&lt;/th&gt;
&lt;th&gt;After&lt;/th&gt;
&lt;th&gt;Saved&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;English&lt;/td&gt;
&lt;td&gt;486&lt;/td&gt;
&lt;td&gt;386&lt;/td&gt;
&lt;td&gt;−20.6%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Persian&lt;/td&gt;
&lt;td&gt;350&lt;/td&gt;
&lt;td&gt;259&lt;/td&gt;
&lt;td&gt;−26.0%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Chinese (Simplified)&lt;/td&gt;
&lt;td&gt;273&lt;/td&gt;
&lt;td&gt;189&lt;/td&gt;
&lt;td&gt;−30.8%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The non-English prompts saved &lt;em&gt;more&lt;/em&gt;, in percentage terms. When every word costs more&lt;br&gt;
tokens, removing a duplicated paragraph removes more tokens too.&lt;/p&gt;

&lt;p&gt;Trying it on your own prompt takes two commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;prompt-tokensaver
tokensaver optimize prompt.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every suggestion shows the tokens and dollars it saves on your model. Safe changes, like&lt;br&gt;
minifying JSON, are applied automatically; tokensaver re-parses the JSON to make sure&lt;br&gt;
the data didn't change. Anything that could change meaning, like removing a duplicate,&lt;br&gt;
waits for you to review it. It runs fully offline, so your prompts never leave your&lt;br&gt;
machine.&lt;/p&gt;

&lt;p&gt;To see what the same prompt costs across models, cheapest first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tokensaver compare prompt.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Filler is language-specific, so it needs native speakers
&lt;/h2&gt;

&lt;p&gt;One kind of waste &lt;em&gt;is&lt;/em&gt; tied to language: polite filler. "I would like you to please…" or&lt;br&gt;
"Thanks in advance!" costs tokens and changes nothing about what the model does.&lt;/p&gt;

&lt;p&gt;You can't write those rules from a dictionary. You need someone who knows which phrases&lt;br&gt;
are truly empty, and which ones only look empty.&lt;/p&gt;

&lt;p&gt;This week, a native Persian speaker contributed exactly that. tokensaver now removes&lt;br&gt;
«لطفاً» ("please"), «از تو می‌خواهم که…» ("I want you to…") and «ممنون می‌شوم اگر…»&lt;br&gt;
("I'd appreciate it if…"). It handles the different ways people actually type them, with&lt;br&gt;
or without the invisible zero-width joiner in the middle of a word.&lt;/p&gt;

&lt;p&gt;Just as interesting is what we &lt;strong&gt;left out&lt;/strong&gt;: «اگر امکان دارد», "if possible". It looks&lt;br&gt;
like filler, but "if possible, also write tests" is a real condition. Delete it and an&lt;br&gt;
optional request becomes mandatory. That's the kind of call only a native speaker can&lt;br&gt;
make with confidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your language next?
&lt;/h2&gt;

&lt;p&gt;The filler rule now understands English and Persian. If you speak another language, I'd&lt;br&gt;
love your help: list 3–5 phrases that never change what the model should do, in&lt;br&gt;
&lt;a href="https://github.com/behrouzbk/tokensaver/issues/5" rel="noopener noreferrer"&gt;issue #5&lt;/a&gt;. No code required, though PRs&lt;br&gt;
are very welcome.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You pay per token, and most non-English text needs more tokens for the same meaning:
1.5× or more for 36 of 55 languages in my test, up to 3× for Punjabi.&lt;/li&gt;
&lt;li&gt;Newer tokenizers are much fairer than older ones, so check which one your model uses.&lt;/li&gt;
&lt;li&gt;You can't fix the tokenizer, but JSON minification, duplicate removal and whitespace
cleanup work in any language. On my sample prompts they cut 26% in Persian and 31% in
Chinese.&lt;/li&gt;
&lt;li&gt;Measure your own prompts:
&lt;a href="https://github.com/behrouzbk/tokensaver" rel="noopener noreferrer"&gt;github.com/behrouzbk/tokensaver&lt;/a&gt; (MIT,
offline, &lt;code&gt;pip install prompt-tokensaver&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If this was useful, a ⭐ on the repo helps other people find it.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>python</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
