<?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: Markys Lindred</title>
    <description>The latest articles on DEV Community by Markys Lindred (@markys_lindred_e543b9af61).</description>
    <link>https://dev.to/markys_lindred_e543b9af61</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%2F4008849%2F5db13d25-7740-488d-afbd-8cf0203f8c8a.png</url>
      <title>DEV Community: Markys Lindred</title>
      <link>https://dev.to/markys_lindred_e543b9af61</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/markys_lindred_e543b9af61"/>
    <language>en</language>
    <item>
      <title>How I cut my LLM API bill by ~60% (5 levers that actually work)</title>
      <dc:creator>Markys Lindred</dc:creator>
      <pubDate>Tue, 30 Jun 2026 01:30:26 +0000</pubDate>
      <link>https://dev.to/markys_lindred_e543b9af61/how-i-cut-my-llm-api-bill-by-60-5-levers-that-actually-work-1on3</link>
      <guid>https://dev.to/markys_lindred_e543b9af61/how-i-cut-my-llm-api-bill-by-60-5-levers-that-actually-work-1on3</guid>
      <description>&lt;p&gt;After a few surprise invoices from OpenAI and Anthropic, I spent a weekend figuring out where the money actually goes when you call an LLM API. Here are the five levers that moved my bill the most, roughly in order of impact.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Cache your static prefix
&lt;/h2&gt;

&lt;p&gt;Every chat turn re-sends the same system prompt. All three major providers let you cache that prefix and bill repeat reads at ~10% of the input rate. On a chatbot with a 2,000-token system message this alone cut my input cost ~80%.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Output is ~5× input — cap it
&lt;/h2&gt;

&lt;p&gt;On every frontier model, output tokens cost about five times input tokens. Generation is autoregressive; input is processed in parallel. Setting &lt;code&gt;max_tokens&lt;/code&gt; aggressively and prompting for terse answers is the single easiest win.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Route by difficulty
&lt;/h2&gt;

&lt;p&gt;Don't send "extract this email" to a flagship. A two-tier setup — a cheap model (Haiku / Flash-Lite / Nano) for the easy 80%, a flagship for the hard 20% — saved me 60–85% versus running everything through the big model.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Batch what can wait
&lt;/h2&gt;

&lt;p&gt;Nightly summaries, eval runs, enrichment — anything that can tolerate 24h — gets a flat 50% discount via the Batch API on every major vendor.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Watch the tokenizer
&lt;/h2&gt;

&lt;p&gt;Non-English text (Cyrillic, CJK) tokenizes 2–4× worse than English, so it costs 2–4× more. If you serve a multilingual audience this is a real multiplier, and some models (Gemini, DeepSeek) handle it better than the GPT-4 family.&lt;/p&gt;

&lt;h2&gt;
  
  
  Estimating before you ship
&lt;/h2&gt;

&lt;p&gt;The thing that helped most was estimating cost &lt;em&gt;before&lt;/em&gt; writing the code. I've been using a free calculator that takes a prompt + model and shows per-call and at-scale cost with input/output priced separately: &lt;a href="https://gpt-cost.com/" rel="noopener noreferrer"&gt;gpt-cost.com&lt;/a&gt;. It also has per-model pages (e.g. &lt;a href="https://gpt-cost.com/models/claude-opus-4-8/" rel="noopener noreferrer"&gt;Claude Opus 4.8&lt;/a&gt;) and a deeper write-up on &lt;a href="https://gpt-cost.com/blog/cheapest-llm-api-2026/" rel="noopener noreferrer"&gt;the cheapest LLM by workload&lt;/a&gt; that informed a lot of the above.&lt;/p&gt;

&lt;p&gt;What levers am I missing? Curious what's worked for others at scale.ai, llm, webdev, cost&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>llm</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
