<?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: Mohamed Abidi</title>
    <description>The latest articles on DEV Community by Mohamed Abidi (@hamaabidi).</description>
    <link>https://dev.to/hamaabidi</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%2F4184501%2F28183dc6-1d3a-4793-8c3b-488dad198bc7.jpg</url>
      <title>DEV Community: Mohamed Abidi</title>
      <link>https://dev.to/hamaabidi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hamaabidi"/>
    <language>en</language>
    <item>
      <title>Gemini API cost: two prices double before January</title>
      <dc:creator>Mohamed Abidi</dc:creator>
      <pubDate>Fri, 23 Oct 2026 19:28:16 +0000</pubDate>
      <link>https://dev.to/hamaabidi/gemini-api-cost-two-prices-double-before-january-20m0</link>
      <guid>https://dev.to/hamaabidi/gemini-api-cost-two-prices-double-before-january-20m0</guid>
      <description>&lt;p&gt;If you picked Gemini 4 Argon this year because it cost the same as Claude Sonnet, check Google's pricing page again. On December 1, Argon goes from $2 to $4 per million input tokens and from $10 to $20 per million output tokens. Same model, same traffic, twice the invoice.&lt;/p&gt;

&lt;p&gt;Gemini 3.8 Flash follows on January 1: $0.75 to $1.50 input, $3.75 to $7.50 output.&lt;/p&gt;

&lt;p&gt;Price increases on an API are rare enough that most cost estimates don't plan for them. So let's take one concrete workload, price it on every current Gemini model before and after the change, and then look at the four things that move a Gemini bill more than the price list does: thinking tokens, caching, the Batch API and grounding.&lt;/p&gt;

&lt;p&gt;I maintain a Gemini price table for a cost calculator, so I re-check Google's pricing page every few weeks. In October, two rows had something I hadn't seen on an LLM price list before: a second price with a start date. No announcement in my inbox, no deprecation notice, just a footnote on the page.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A document pipeline of 300,000 requests a month costs &lt;strong&gt;$6,000 on Gemini 4 Argon today and $12,000 from December 1&lt;/strong&gt;. On Gemini 3.8 Flash: $2,250 today, $4,500 from January 1.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Thinking tokens bill as output.&lt;/strong&gt; 1,500 thinking tokens per request add 75% to the Flash bill, and they don't appear in the answer.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Batch API cancels the increase exactly&lt;/strong&gt; (50% off) for work that can wait. A cached 5,000-token prefix cuts another 45–48%. Gemini 3.1 Flash-Lite runs the same job for $780.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How is the Gemini API billed?
&lt;/h2&gt;

&lt;p&gt;Per million tokens, input and output separately. Cached input costs 10% of the input price, the Batch API halves input and output, and Pro models charge more once a prompt passes 200,000 tokens. These are the paid-tier list prices from &lt;a href="https://ai.google.dev/gemini-api/docs/pricing" rel="noopener noreferrer"&gt;Google's pricing page&lt;/a&gt;, in USD per million tokens, checked October 14, 2026:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;Output&lt;/th&gt;
&lt;th&gt;Cached input&lt;/th&gt;
&lt;th&gt;Scheduled change&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 4 Argon&lt;/td&gt;
&lt;td&gt;$2&lt;/td&gt;
&lt;td&gt;$10&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;td&gt;$4 / $20 from Dec 1, 2026&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 3.1 Pro Preview&lt;/td&gt;
&lt;td&gt;$2&lt;/td&gt;
&lt;td&gt;$12&lt;/td&gt;
&lt;td&gt;$0.20&lt;/td&gt;
&lt;td&gt;$4 / $18 over 200K tokens&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 3.8 Flash&lt;/td&gt;
&lt;td&gt;$0.75&lt;/td&gt;
&lt;td&gt;$3.75&lt;/td&gt;
&lt;td&gt;$0.075&lt;/td&gt;
&lt;td&gt;$1.50 / $7.50 from Jan 1, 2027&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 3.5 Flash-Lite&lt;/td&gt;
&lt;td&gt;$0.30&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;td&gt;$0.03&lt;/td&gt;
&lt;td&gt;none&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 3.1 Flash-Lite&lt;/td&gt;
&lt;td&gt;$0.25&lt;/td&gt;
&lt;td&gt;$1.50&lt;/td&gt;
&lt;td&gt;$0.025&lt;/td&gt;
&lt;td&gt;none&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 2.5 Flash-Lite&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;td&gt;$0.40&lt;/td&gt;
&lt;td&gt;$0.01&lt;/td&gt;
&lt;td&gt;none (older generation)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Output is 5× input on Argon and Flash, 6× on Pro. That ratio matters later, when thinking tokens show up.&lt;/p&gt;

&lt;h2&gt;
  
  
  The example: a document extraction pipeline
&lt;/h2&gt;

&lt;p&gt;Say you run a pipeline that reads inbound documents (contracts, invoices, support emails) and extracts structured fields. It isn't an agent: one request per document, no back-and-forth. These numbers are an illustration; swap in your own.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Instructions, JSON schema and a few worked examples: &lt;strong&gt;5,000 tokens&lt;/strong&gt;, identical on every request&lt;/li&gt;
&lt;li&gt;The document itself: &lt;strong&gt;3,000 tokens&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;The extracted JSON: &lt;strong&gt;400 tokens&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Volume: &lt;strong&gt;10,000 documents a day&lt;/strong&gt;, so 300,000 a month&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's 8,000 input tokens and 400 output tokens per request. A month is 2.4 billion input tokens and 120 million output tokens.&lt;/p&gt;

&lt;p&gt;To get your own per-request numbers, paste a real prompt into a &lt;a href="https://contextwaise.com/tools/token-counter" rel="noopener noreferrer"&gt;token counter&lt;/a&gt; that counts for Gemini, Claude and GPT. Gemini averages about 4 characters per token in English, so a 3,000-token document is roughly 12,000 characters.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does it cost on each Gemini model?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;Output&lt;/th&gt;
&lt;th&gt;Monthly today&lt;/th&gt;
&lt;th&gt;After the increase&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 4 Argon&lt;/td&gt;
&lt;td&gt;$4,800&lt;/td&gt;
&lt;td&gt;$1,200&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$6,000&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;$12,000&lt;/strong&gt; (Dec 1)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 3.1 Pro Preview&lt;/td&gt;
&lt;td&gt;$4,800&lt;/td&gt;
&lt;td&gt;$1,440&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$6,240&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;no change&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 3.8 Flash&lt;/td&gt;
&lt;td&gt;$1,800&lt;/td&gt;
&lt;td&gt;$450&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$2,250&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;$4,500&lt;/strong&gt; (Jan 1)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 3.5 Flash-Lite&lt;/td&gt;
&lt;td&gt;$720&lt;/td&gt;
&lt;td&gt;$300&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$1,020&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;no change&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 3.1 Flash-Lite&lt;/td&gt;
&lt;td&gt;$600&lt;/td&gt;
&lt;td&gt;$180&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$780&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;no change&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 2.5 Flash-Lite&lt;/td&gt;
&lt;td&gt;$240&lt;/td&gt;
&lt;td&gt;$48&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$288&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;no change&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three things stand out.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Input is 77–80% of the bill on the bigger models.&lt;/strong&gt; The 400-token answer is the cheap part. The 5,000 tokens of instructions you send 300,000 times a month are not.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The ranking flips on December 1.&lt;/strong&gt; Today Argon is slightly cheaper than Gemini 3.1 Pro for this job ($6,000 vs $6,240). From December 1 it costs almost twice as much ($12,000 vs $6,240). If 3.1 Pro passes your evals, it's the cheaper strong model from then on. It's still labelled Preview, so weigh that too.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flash-Lite is 2–8× cheaper than Flash.&lt;/strong&gt; Extraction into a fixed schema is the kind of task small models often handle. Run your eval set on 3.1 Flash-Lite before assuming you need Flash.&lt;/p&gt;

&lt;p&gt;I checked the table with this &lt;a href="https://contextwaise.com/gemini-api-pricing" rel="noopener noreferrer"&gt;Gemini API cost calculator&lt;/a&gt;, entering 8,000 input and 400 output tokens at 300,000 requests a month. It also shows the post-increase prices.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why is my Gemini bill higher than the math?
&lt;/h2&gt;

&lt;p&gt;Usually because of one of three things the table above doesn't include.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Thinking tokens
&lt;/h3&gt;

&lt;p&gt;Gemini's newer models think before they answer, and &lt;a href="https://ai.google.dev/gemini-api/docs/thinking" rel="noopener noreferrer"&gt;thinking tokens&lt;/a&gt; are billed as output at the full output price. They don't show up in the response text, so you only see them in the usage metadata.&lt;/p&gt;

&lt;p&gt;Say Gemini 3.8 Flash thinks for 1,500 tokens before writing the 400-token JSON. Output per request goes from 400 to 1,900 tokens:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Gemini 3.8 Flash&lt;/th&gt;
&lt;th&gt;Output tokens / month&lt;/th&gt;
&lt;th&gt;Output cost&lt;/th&gt;
&lt;th&gt;Monthly total&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;No thinking&lt;/td&gt;
&lt;td&gt;120M&lt;/td&gt;
&lt;td&gt;$450&lt;/td&gt;
&lt;td&gt;$2,250&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1,500 thinking tokens&lt;/td&gt;
&lt;td&gt;570M&lt;/td&gt;
&lt;td&gt;$2,137.50&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;$3,937.50&lt;/strong&gt; (+75%)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same, from Jan 1&lt;/td&gt;
&lt;td&gt;570M&lt;/td&gt;
&lt;td&gt;$4,275&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$7,875&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Field extraction rarely needs long reasoning. Set a low thinking budget (or thinking level, depending on the model) in the request config, and compare accuracy on your eval set with thinking low and off.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Grounding with Google Search
&lt;/h3&gt;

&lt;p&gt;Grounding is billed per search, not per token. Gemini 3 and newer models share 5,000 free search requests a month, then $14 per 1,000. If every one of the 300,000 documents triggered one search, that's (300,000 − 5,000) × $14 / 1,000 = &lt;strong&gt;$4,130 a month&lt;/strong&gt;, more than the whole Flash bill. A grounded request can trigger more than one search, so treat that as a floor. Turn grounding on only for the requests that need fresh facts.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Long prompts on Pro
&lt;/h3&gt;

&lt;p&gt;Gemini 3.1 Pro bills the whole request at $4 input and $18 output once the prompt passes 200,000 tokens. This pipeline never gets close, but a "just send the whole repo" coding tool or a long chat history does. Gemini 2.5 Pro has the same threshold ($1.25 → $2.50 input).&lt;/p&gt;

&lt;h2&gt;
  
  
  Does caching lower Gemini API cost?
&lt;/h2&gt;

&lt;p&gt;Yes, and this pipeline is close to the ideal case: the same 5,000-token prefix starts every request. Cached input costs 10% of the input price.&lt;/p&gt;

&lt;p&gt;Gemini has two kinds of &lt;a href="https://ai.google.dev/gemini-api/docs/caching" rel="noopener noreferrer"&gt;context caching&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Implicit caching&lt;/strong&gt; is automatic. When a request starts with the same tokens as a recent one, those tokens are billed at the cached price. Nothing to set up, no storage fee, but hits aren't guaranteed. Put the fixed instructions first and the document last, or nothing matches.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Explicit caching&lt;/strong&gt; stores a prefix you create, for a time you choose, with guaranteed hits and a storage fee per million tokens per hour: $0.50 on Gemini 3.8 Flash. Gemini 4 Argon supports implicit caching only.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The prefix has to be long enough to cache: 4,096 tokens on these models. A 2,000-token system prompt doesn't qualify, which is one reason to keep your worked examples in the prefix rather than trimming them to save tokens.&lt;/p&gt;

&lt;p&gt;If all 5,000 prefix tokens hit the cache:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Without caching&lt;/th&gt;
&lt;th&gt;With the prefix cached&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;Gemini 4 Argon (today)&lt;/td&gt;
&lt;td&gt;$6,000&lt;/td&gt;
&lt;td&gt;$3,150&lt;/td&gt;
&lt;td&gt;47.5%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 4 Argon (from Dec 1)&lt;/td&gt;
&lt;td&gt;$12,000&lt;/td&gt;
&lt;td&gt;$6,300&lt;/td&gt;
&lt;td&gt;47.5%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 3.8 Flash (today)&lt;/td&gt;
&lt;td&gt;$2,250&lt;/td&gt;
&lt;td&gt;$1,237.50&lt;/td&gt;
&lt;td&gt;45%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On Flash, an explicit cache for that prefix costs 0.005M tokens × $0.50 × 720 hours = &lt;strong&gt;$1.80 a month&lt;/strong&gt; to keep warm. For a pipeline that runs all day, buying guaranteed hits is an easy call.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does the Batch API cancel the price increase?
&lt;/h2&gt;

&lt;p&gt;For this pipeline, exactly. The &lt;a href="https://ai.google.dev/gemini-api/docs/batch-mode" rel="noopener noreferrer"&gt;Batch API&lt;/a&gt; takes 50% off input and output for jobs submitted asynchronously, and the increase is 2×:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Standard, after increase&lt;/th&gt;
&lt;th&gt;Batch, after increase&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 4 Argon&lt;/td&gt;
&lt;td&gt;$12,000&lt;/td&gt;
&lt;td&gt;$6,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 3.8 Flash&lt;/td&gt;
&lt;td&gt;$4,500&lt;/td&gt;
&lt;td&gt;$2,250&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The catch is latency. Google targets a 24-hour turnaround (often much sooner), so batch only fits work nobody is waiting on: nightly extraction, backfills, evals, classification. If documents land in a queue anyway, a few hours' delay is often invisible to users. Batch also stacks with caching.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is the Gemini API free?
&lt;/h2&gt;

&lt;p&gt;Partly. Gemini 3.8 Flash, the Flash-Lite models and the Gemini 2.5 models have a free tier in Google AI Studio and the API, within rate limits. Gemini 4 Argon and Gemini 3.1 Pro are paid only.&lt;/p&gt;

&lt;p&gt;The catch is data: on the free tier, Google may use your prompts and responses to improve its products. On the paid tier it doesn't. The free tier is fine for prototyping. For customer documents like the ones in this example, you want the paid tier.&lt;/p&gt;

&lt;h2&gt;
  
  
  Price your own requests
&lt;/h2&gt;

&lt;p&gt;Every response carries &lt;code&gt;usage_metadata&lt;/code&gt;. Log it, then price it. With the Python &lt;code&gt;google-genai&lt;/code&gt; SDK:&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="n"&gt;PRICES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;  &lt;span class="c1"&gt;# USD per 1M tokens, Gemini 3.8 Flash until Dec 31, 2026
&lt;/span&gt;    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.75&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;3.75&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_read&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.075&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;request_cost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;cached&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cached_content_token_count&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="n"&gt;fresh&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;prompt_token_count&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;cached&lt;/span&gt;        &lt;span class="c1"&gt;# prompt count includes cached tokens
&lt;/span&gt;    &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;candidates_token_count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;thoughts_token_count&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;fresh&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;PRICES&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;cached&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;PRICES&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_read&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;PRICES&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&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="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1_000_000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two fields catch people out: &lt;code&gt;thoughts_token_count&lt;/code&gt; is billed as output even though it isn't in the answer, and &lt;code&gt;cached_content_token_count&lt;/code&gt; tells you whether implicit caching is actually hitting. If it's zero on the second request with the same prefix, your prefix isn't stable.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to do before December 1
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Log &lt;code&gt;usage_metadata&lt;/code&gt; for a day of real traffic. Get average input, output, thinking and cached tokens per request.&lt;/li&gt;
&lt;li&gt;Reprice it at the new prices: $4 / $20 for Argon, $1.50 / $7.50 for 3.8 Flash. Put that number in next quarter's budget, not today's.&lt;/li&gt;
&lt;li&gt;If you're on Argon, run your eval set on Gemini 3.1 Pro and on a Flash model. From December 1, Pro costs half of Argon's input price and 60% of its output price.&lt;/li&gt;
&lt;li&gt;Move anything nobody waits on to the Batch API. For async work, that undoes the increase.&lt;/li&gt;
&lt;li&gt;Put the fixed instructions first, check that cached tokens show up from the second request, and set a thinking budget on simple tasks.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Are you moving off Argon before December 1, or absorbing the increase? I'm curious what your evals say about 3.1 Pro versus Argon on the same job.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>gemini</category>
      <category>llm</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Claude API cost: I priced one AI agent on every model</title>
      <dc:creator>Mohamed Abidi</dc:creator>
      <pubDate>Tue, 20 Oct 2026 12:59:25 +0000</pubDate>
      <link>https://dev.to/hamaabidi/claude-api-cost-i-priced-one-ai-agent-on-every-model-29b</link>
      <guid>https://dev.to/hamaabidi/claude-api-cost-i-priced-one-ai-agent-on-every-model-29b</guid>
      <description>&lt;p&gt;Every Claude pricing page gives you the same thing: a table of dollars per million tokens. Sonnet 5.5 is $2 in and $10 out. Fine. But nobody ships "a million tokens". You ship a support agent, a coding assistant, a RAG endpoint, and you want to know what it will cost next month.&lt;/p&gt;

&lt;p&gt;The per-token price doesn't answer that, because the number that decides your bill isn't on the price list: how many tokens your app sends per request, and how fast that number grows.&lt;/p&gt;

&lt;p&gt;So let's price one concrete agent, step by step, on every current Claude model. Then we'll see where the money actually goes, and which two settings change the answer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A 5-step support agent at 30,000 conversations a month costs &lt;strong&gt;$3,690 on Sonnet 5.5&lt;/strong&gt;, $7,380 on Opus 5.5, $18,450 on Fable 5.1 and $184.50 on Haiku 5.5.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;88% of that is input tokens&lt;/strong&gt;, not the answer: every step re-sends the system prompt, the tools and everything said so far.&lt;/li&gt;
&lt;li&gt;Prompt caching cuts the same bill by &lt;strong&gt;61–67%&lt;/strong&gt; (Sonnet: $3,690 → $1,289). Model choice moves it 100×.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How does Claude API pricing work?
&lt;/h2&gt;

&lt;p&gt;Every request is billed on two counts: the tokens it reads (input) and the tokens it writes (output). Output costs 5× input on every current Claude model. Here are the list prices, in USD per million tokens, from &lt;a href="https://platform.claude.com/docs/en/about-claude/pricing" rel="noopener noreferrer"&gt;Anthropic's pricing page&lt;/a&gt;, checked October 14, 2026:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;Output&lt;/th&gt;
&lt;th&gt;Cached read&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Claude Fable 5.1&lt;/td&gt;
&lt;td&gt;$10&lt;/td&gt;
&lt;td&gt;$50&lt;/td&gt;
&lt;td&gt;$0.25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Opus 5.5&lt;/td&gt;
&lt;td&gt;$4&lt;/td&gt;
&lt;td&gt;$20&lt;/td&gt;
&lt;td&gt;$0.20&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 5.5&lt;/td&gt;
&lt;td&gt;$2&lt;/td&gt;
&lt;td&gt;$10&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 5.5&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;td&gt;$0.50&lt;/td&gt;
&lt;td&gt;$0.01&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two discounts sit on top: prompt caching (repeated input billed at the "cached read" price) and the &lt;a href="https://platform.claude.com/docs/en/build-with-claude/batch-processing" rel="noopener noreferrer"&gt;Batch API&lt;/a&gt; (50% off everything, for work that can wait up to 24 hours).&lt;/p&gt;

&lt;p&gt;That table is all a price list can tell you. The rest depends on your app.&lt;/p&gt;

&lt;h2&gt;
  
  
  The example: a 5-step support agent
&lt;/h2&gt;

&lt;p&gt;Say you run a support agent. A user asks a billing question, and the agent works through it in 5 model calls: look up the account, fetch the invoice, check the refund status, and so on. These numbers are an illustration; swap in your own.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;System prompt + tool definitions: &lt;strong&gt;6,000 tokens&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;The user's question: &lt;strong&gt;200 tokens&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Each step, the model writes &lt;strong&gt;300 tokens&lt;/strong&gt; (a tool call or the answer)&lt;/li&gt;
&lt;li&gt;Each tool returns &lt;strong&gt;2,000 tokens&lt;/strong&gt; (JSON from your billing API)&lt;/li&gt;
&lt;li&gt;Volume: &lt;strong&gt;1,000 conversations a day&lt;/strong&gt;, so 30,000 a month&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The trap is that an agent doesn't send "the new stuff" on each call. The Messages API is stateless, so every call re-sends the whole conversation so far:&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="n"&gt;calls&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;6_200&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;2_300&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;step&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;step&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
&lt;span class="c1"&gt;# [6200, 8500, 10800, 13100, 15400]
&lt;/span&gt;
&lt;span class="n"&gt;input_tokens&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;calls&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# 54,000 per conversation
&lt;/span&gt;&lt;span class="n"&gt;output_tokens&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;     &lt;span class="c1"&gt;# 1,500 per conversation
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The fifth call reads 15,400 tokens to write 300. Across the conversation, input outweighs output 36 to 1.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiykyhq4nsi97rembild6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiykyhq4nsi97rembild6.png" alt="Vintage travel-poster illustration of three pack-laden donkeys climbing a winding mountain path above a turquoise lake, representing the growing context carried through successive AI agent calls." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What does it cost per month on each Claude model?
&lt;/h2&gt;

&lt;p&gt;Multiply: 54,000 input tokens × 30,000 conversations = 1.62 billion input tokens a month. 1,500 output tokens × 30,000 = 45 million output tokens.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;Output&lt;/th&gt;
&lt;th&gt;Monthly total&lt;/th&gt;
&lt;th&gt;Per conversation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Claude Fable 5.1&lt;/td&gt;
&lt;td&gt;$16,200&lt;/td&gt;
&lt;td&gt;$2,250&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$18,450&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$0.615&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Opus 5.5&lt;/td&gt;
&lt;td&gt;$6,480&lt;/td&gt;
&lt;td&gt;$900&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$7,380&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$0.246&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 5.5&lt;/td&gt;
&lt;td&gt;$3,240&lt;/td&gt;
&lt;td&gt;$450&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$3,690&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$0.123&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 5.5&lt;/td&gt;
&lt;td&gt;$162&lt;/td&gt;
&lt;td&gt;$22.50&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$184.50&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$0.006&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Input is 87.8% of the bill on every model, because the input/output price ratio is the same 5× across the lineup. If you've been trimming your answers to save money, you've been optimizing the 12%.&lt;/p&gt;

&lt;p&gt;The spread between models is the other lesson: Fable 5.1 costs exactly 100× Haiku 5.5 for the same traffic. Whether Haiku can actually resolve your billing questions is a question for your eval set, not the price list. But if it passes on even half your traffic, routing that half is the biggest saving available.&lt;/p&gt;

&lt;p&gt;To check this table, I entered one conversation as one "request" (54,000 input, 1,500 output, 30,000 a month) into this &lt;a href="https://contextwaise.com/claude-api-pricing" rel="noopener noreferrer"&gt;Claude API cost calculator&lt;/a&gt;, which prices every model side by side. A spreadsheet works too; the formula is below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why is the Claude API so expensive?
&lt;/h2&gt;

&lt;p&gt;It usually isn't the price per token. It's three things that multiply it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Re-sent context.&lt;/strong&gt; Every agent step re-reads the system prompt, the tool schemas and every earlier tool result. In the example, the same 6,000-token system prompt is billed 5 times per conversation, 150,000 times a month.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fat tool results.&lt;/strong&gt; The 2,000-token tool result is the biggest line in the example. Raw JSON from an API carries IDs, timestamps, null fields and nested metadata the model never uses, and it stays in the context for every later step.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hidden output.&lt;/strong&gt; Extended thinking is billed as output tokens. A model that "thinks" for 2,000 tokens before a 300-token answer bills 2,300 output tokens at the output price.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One more, which catches people comparing models: Claude 4.7 and later use a tokenizer that produces about 30% more tokens for the same text. A lower price per token on a newer model can still mean a similar bill. Count a real prompt on the model you'll use before you compare.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does prompt caching change?
&lt;/h2&gt;

&lt;p&gt;Prompt caching bills a repeated prompt prefix at the cached-read price. In an agent loop, almost everything is a repeated prefix: call 3 starts with everything call 2 sent.&lt;/p&gt;

&lt;p&gt;With a cache marker at the end of each call (and enough traffic that the shared 6,000-token system prompt stays warm), each conversation reads 44,600 tokens from cache and writes only the new 9,400. Cache writes cost 1.25× input on the 5-minute cache, so I've included them (calculators that leave writes out, including the one above, show a slightly lower number):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Without caching&lt;/th&gt;
&lt;th&gt;With caching&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;Claude Fable 5.1&lt;/td&gt;
&lt;td&gt;$18,450&lt;/td&gt;
&lt;td&gt;$6,109.50&lt;/td&gt;
&lt;td&gt;67%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Opus 5.5&lt;/td&gt;
&lt;td&gt;$7,380&lt;/td&gt;
&lt;td&gt;$2,577.60&lt;/td&gt;
&lt;td&gt;65%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 5.5&lt;/td&gt;
&lt;td&gt;$3,690&lt;/td&gt;
&lt;td&gt;$1,288.80&lt;/td&gt;
&lt;td&gt;65%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 5.5&lt;/td&gt;
&lt;td&gt;$184.50&lt;/td&gt;
&lt;td&gt;$71.13&lt;/td&gt;
&lt;td&gt;61%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On Sonnet 5.5, a cached read costs $0.10 per million tokens against $2 uncached, 95% off. What's left of the bill is mostly cache writes and output.&lt;/p&gt;

&lt;p&gt;Caching has rules that can silently turn it off (a timestamp in the system prompt, a reordered tool list, a user who comes back after 6 minutes). That's tomorrow's post in this series. For a cost estimate, the point is simpler: &lt;strong&gt;an uncached agent estimate is roughly 3× too high in this scenario&lt;/strong&gt;, so don't kill a project on it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpkovpnuoeyxolvuvms6d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpkovpnuoeyxolvuvms6d.png" alt="Vintage gouache illustration of a stone granary containing stacked grain sacks beside terraced green fields and a turquoise lake. A farmer carries one new sack toward the granary, symbolizing cached context being reused instead of processed again." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The threshold that changes the cheapest model
&lt;/h2&gt;

&lt;p&gt;Haiku 5.5 has a long-context tier: prompts over 100,000 input tokens are billed at $0.50 input and $2.50 output, 5× its normal price. Other current Claude models bill their full context window at standard prices.&lt;/p&gt;

&lt;p&gt;Five steps never get close. But agents that loop (coding agents, research agents) do. In the example, the context grows 2,300 tokens per step, so &lt;strong&gt;step 42&lt;/strong&gt; is the first call over 100,000 tokens. From there, every Haiku call costs 5× more, and the gap to Sonnet shrinks from 20× to 4×.&lt;/p&gt;

&lt;p&gt;If your agent runs long, either keep the context under the threshold (summarize or drop old tool results) or price Haiku at its long-context rate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your own formula
&lt;/h2&gt;

&lt;p&gt;Log the &lt;code&gt;usage&lt;/code&gt; object every response returns, then price it:&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="n"&gt;PRICES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;  &lt;span class="c1"&gt;# USD per 1M tokens, Sonnet 5.5
&lt;/span&gt;    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;2.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;10.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_read&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_write&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;2.50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;# 5-minute write = 1.25× input
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;request_cost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;input_tokens&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;PRICES&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;output_tokens&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;PRICES&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cache_read_input_tokens&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;PRICES&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_read&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cache_creation_input_tokens&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;PRICES&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cache_write&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="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1_000_000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;input_tokens&lt;/code&gt; in the response counts only the uncached part, so the four fields add up without double counting. Sum &lt;code&gt;request_cost&lt;/code&gt; per conversation and you have the number that matters: &lt;strong&gt;cost per resolved task&lt;/strong&gt;, not cost per token. The field names are in the &lt;a href="https://platform.claude.com/docs/en/api/messages" rel="noopener noreferrer"&gt;Messages API reference&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is the Claude API free, or included in Claude Pro?
&lt;/h2&gt;

&lt;p&gt;No to both. The API is pay-as-you-go per token; new accounts may receive trial credit. Claude Pro and Max subscriptions cover the Claude apps, and API usage is billed separately (&lt;a href="https://claude.com/pricing" rel="noopener noreferrer"&gt;Claude plans&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  What to do Monday morning
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Log &lt;code&gt;usage&lt;/code&gt; for 100 real conversations and compute average input and output tokens &lt;strong&gt;per conversation&lt;/strong&gt;, not per call.&lt;/li&gt;
&lt;li&gt;Price that on two models: the one you use and the next one down. Run your eval set on the cheaper one.&lt;/li&gt;
&lt;li&gt;Turn on prompt caching and check that &lt;code&gt;cache_read_input_tokens&lt;/code&gt; is most of the input from the second call on.&lt;/li&gt;
&lt;li&gt;Look at your largest tool result and cut the fields the model never reads.&lt;/li&gt;
&lt;li&gt;If any run goes past ~40 steps, check where its context crosses a pricing threshold.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What does one task cost in your app, and how many model calls does it take? I'm curious how far real agents are from the 5-step example.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>agents</category>
      <category>claude</category>
    </item>
  </channel>
</rss>
