<?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: Bilawal Builds</title>
    <description>The latest articles on DEV Community by Bilawal Builds (@bilawal_developer_a44497d).</description>
    <link>https://dev.to/bilawal_developer_a44497d</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%2F4174016%2F737b1db8-84bc-49cb-ae66-fab31744d54a.jpg</url>
      <title>DEV Community: Bilawal Builds</title>
      <link>https://dev.to/bilawal_developer_a44497d</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bilawal_developer_a44497d"/>
    <language>en</language>
    <item>
      <title>Why a short prompt can cost more than a long one</title>
      <dc:creator>Bilawal Builds</dc:creator>
      <pubDate>Fri, 09 Oct 2026 18:29:03 +0000</pubDate>
      <link>https://dev.to/bilawal_developer_a44497d/why-a-short-prompt-can-cost-more-than-a-long-one-i65</link>
      <guid>https://dev.to/bilawal_developer_a44497d/why-a-short-prompt-can-cost-more-than-a-long-one-i65</guid>
      <description>&lt;p&gt;Say a model charges $2 per million input tokens and $10 per million output tokens. Now compare two requests:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Input tokens&lt;/th&gt;
&lt;th&gt;Output tokens&lt;/th&gt;
&lt;th&gt;Cost&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Short question, long answer&lt;/td&gt;
&lt;td&gt;1,000&lt;/td&gt;
&lt;td&gt;2,000&lt;/td&gt;
&lt;td&gt;$0.022&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Long question, short answer&lt;/td&gt;
&lt;td&gt;3,000&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;$0.007&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The "small" prompt costs about three times more. Output tokens are the expensive half, and reply length is the number I kept forgetting to account for.&lt;/p&gt;

&lt;p&gt;I wanted to see that math before sending anything, so I built PromptCost: a free calculator that shows token count and estimated cost for 24 models (GPT-5, Claude, Gemini, Grok, DeepSeek and others) as you type.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://promtcost.pages.dev" rel="noopener noreferrer"&gt;https://promtcost.pages.dev&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How the counting works
&lt;/h2&gt;

&lt;p&gt;Tokenization runs in the browser. Where a model uses &lt;code&gt;o200k_base&lt;/code&gt;, the count is exact for plain text (it leaves out the small per-message overhead Chat Completions adds). Some providers have no offline tokenizer, so for those I use &lt;code&gt;o200k_base&lt;/code&gt; as a proxy and the page labels the result as an estimate. Treat those numbers as estimates, not invoices.&lt;/p&gt;

&lt;p&gt;Prices are tagged too: either from the provider's own documentation, or from a third-party tracker. Prices change often, so check the provider's page before you set a budget.&lt;/p&gt;

&lt;p&gt;Your prompt text stays in the browser. It's a client-side app on Cloudflare Pages, so there's no backend.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your turn
&lt;/h2&gt;

&lt;p&gt;It's new, so rough edges are likely. Which request type has surprised you most on an LLM bill: long outputs, big system prompts, something else? And if a price looks wrong or a model is missing, tell me in the comments and I'll fix it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I used AI tools while building this project and writing this post.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>productivity</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
