<?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: Michael Williams</title>
    <description>The latest articles on DEV Community by Michael Williams (@true_horison_37).</description>
    <link>https://dev.to/true_horison_37</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%2F4209581%2F1b3782d2-6f40-4686-8c58-4488635d32a7.png</url>
      <title>DEV Community: Michael Williams</title>
      <link>https://dev.to/true_horison_37</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/true_horison_37"/>
    <language>en</language>
    <item>
      <title>I priced every call in my Claude Code logs. 12% of them cost 31%.</title>
      <dc:creator>Michael Williams</dc:creator>
      <pubDate>Wed, 28 Oct 2026 13:12:00 +0000</pubDate>
      <link>https://dev.to/true_horison_37/i-priced-every-call-in-my-claude-code-logs-12-of-them-cost-31-3gdg</link>
      <guid>https://dev.to/true_horison_37/i-priced-every-call-in-my-claude-code-logs-12-of-them-cost-31-3gdg</guid>
      <description>&lt;p&gt;I've been leaning on Claude Code hard for a few weeks, with long sessions and lots of sub-agents. I wanted to know where the money actually goes, so I priced every call in my logs at list price. 954 of my 7,802 calls sent more than 400k tokens of context. Those 12% of calls cost 31% of the total.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I counted
&lt;/h2&gt;

&lt;p&gt;Claude Code keeps a &lt;code&gt;.jsonl&lt;/code&gt; file per session under &lt;code&gt;~/.claude/projects&lt;/code&gt;. Each API call is logged with its token counts: input, cache writes, cache reads and output. The same message can show up on several lines, so I counted each message id once.&lt;/p&gt;

&lt;p&gt;I took a call's context to be input plus cache reads plus cache writes. Then I priced everything at Anthropic's list prices as of 26 Oct. Opus 5.5 is $4 in and $20 out per million tokens, with cache reads at $0.20. I'm on a plan, so treat these as API-equivalent figures.&lt;/p&gt;

&lt;h2&gt;
  
  
  The result
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;band        calls   % calls    cost    % cost
&amp;lt;100k        2787    35.7%   $114.83   20.3%
100-200k     2898    37.1%   $174.04   30.8%
200-400k     1163    14.9%   $101.71   18.0%
400k+         954    12.2%   $174.78   30.9%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's $565 across all the logs. Sub-agents were $289 of it, a bit over half. Output tokens barely matter. Nearly all the cost is context being sent again and again.&lt;/p&gt;

&lt;p&gt;Every call re-sends the whole conversation. Cache reads are cheap per token, but at 400k tokens a call even the cheap rate adds up. A session that runs past a few hundred thousand tokens pays that price on every turn after.&lt;/p&gt;

&lt;p&gt;The other thing I noticed was limits. I hit the 5-hour limit on 14 separate occasions in about two weeks. In the 5 hours before each one I'd used between roughly $19 and $43 of list-price usage. That spread is too wide to say anything about the limit from my logs alone.&lt;/p&gt;

&lt;p&gt;What I'd try, though I haven't tested it: clear the session when a task is done instead of carrying on. Start the next task from a short summary. Use a cheaper model for sub-agents that only read and search. I haven't measured whether any of that saves money yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run it on your own logs
&lt;/h2&gt;

&lt;p&gt;I put the script on GitHub: &lt;a href="https://github.com/TrueHorison/ctxtax" rel="noopener noreferrer"&gt;ctxtax&lt;/a&gt;. It's one Python file with no packages to install, and it only reads local files. It prints numbers, never message text.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-O&lt;/span&gt; https://raw.githubusercontent.com/TrueHorison/ctxtax/main/ctxtax.py
python ctxtax.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few limits. It's three weeks of my kind of work. List prices aren't what subscribers pay. The 400k cut-off is my choice. And it only reads Claude Code logs.&lt;/p&gt;

&lt;h2&gt;
  
  
  The thing I can't work out alone
&lt;/h2&gt;

&lt;p&gt;The usage-limit threads are full of "my limit feels smaller" with no way to compare. &lt;code&gt;python ctxtax.py --meter&lt;/code&gt; prints one line per limit hit: the day, the usage in the 5 hours before it, and the model mix. It prints numbers only. If a few people paste theirs in the comments, we'd have a record we can actually compare.&lt;/p&gt;

&lt;p&gt;What share of your cost comes from the 400k+ calls?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written with AI help.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claudecode</category>
      <category>productivity</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
