<?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: Unitovo Tools</title>
    <description>The latest articles on DEV Community by Unitovo Tools (@unitovo_tools).</description>
    <link>https://dev.to/unitovo_tools</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%2F4095722%2F4a022683-44d1-440b-b958-3e94d3d13c6d.png</url>
      <title>DEV Community: Unitovo Tools</title>
      <link>https://dev.to/unitovo_tools</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/unitovo_tools"/>
    <language>en</language>
    <item>
      <title>How I estimate LLM API costs before shipping</title>
      <dc:creator>Unitovo Tools</dc:creator>
      <pubDate>Wed, 26 Aug 2026 12:23:44 +0000</pubDate>
      <link>https://dev.to/unitovo_tools/how-i-estimate-llm-api-costs-before-shipping-4g0j</link>
      <guid>https://dev.to/unitovo_tools/how-i-estimate-llm-api-costs-before-shipping-4g0j</guid>
      <description>&lt;p&gt;LLM pricing looks simple until a real application starts making repeated calls, sending long prompts, and carrying conversation history forward.&lt;/p&gt;

&lt;p&gt;Before shipping a feature, I use a small estimation model:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Separate input and output tokens
&lt;/h2&gt;

&lt;p&gt;Providers usually price input and generated tokens differently. The basic estimate is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cost = (input tokens × input rate + output tokens × output rate) / 1,000,000&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then multiply that result by requests per user and expected active users.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Model repeated context explicitly
&lt;/h2&gt;

&lt;p&gt;A chat request may resend system instructions and conversation history. A 1,000-token user message can therefore produce a request several times larger than expected.&lt;/p&gt;

&lt;p&gt;For a rough forecast, I calculate three scenarios:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lean:&lt;/strong&gt; short prompts, limited history, compact output&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expected:&lt;/strong&gt; normal production usage&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Heavy:&lt;/strong&gt; long context, retries, tools, and verbose output&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Add operational overhead
&lt;/h2&gt;

&lt;p&gt;The token bill is not the whole cost. I also reserve room for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;failed requests and retries&lt;/li&gt;
&lt;li&gt;evaluation and staging traffic&lt;/li&gt;
&lt;li&gt;embeddings or reranking&lt;/li&gt;
&lt;li&gt;moderation calls&lt;/li&gt;
&lt;li&gt;currency changes and provider price updates&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Check whether self-hosting really helps
&lt;/h2&gt;

&lt;p&gt;For local models, token prices are replaced by GPU memory and infrastructure constraints. VRAM requirements depend on parameter count, precision, context length, KV cache, and runtime overhead.&lt;/p&gt;

&lt;p&gt;I built two free browser-based tools to make these estimates faster:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://unitovo.online/tools/ai-api-cost-calculator/" rel="noopener noreferrer"&gt;AI API Cost Calculator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://unitovo.online/tools/gpu-vram-calculator/" rel="noopener noreferrer"&gt;GPU VRAM Calculator&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The calculations run in the browser and do not require an account. They are planning estimates, so current provider pricing and real workload measurements should remain the final source of truth.&lt;/p&gt;

&lt;p&gt;What variables have surprised you most in production LLM costs?&lt;/p&gt;

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