<?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: Maksym Sokolov</title>
    <description>The latest articles on DEV Community by Maksym Sokolov (@maksymsokolov).</description>
    <link>https://dev.to/maksymsokolov</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%2F1120400%2F9dc184be-6c3f-4460-be00-f90fedc90923.jpeg</url>
      <title>DEV Community: Maksym Sokolov</title>
      <link>https://dev.to/maksymsokolov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maksymsokolov"/>
    <language>en</language>
    <item>
      <title>How Claude Code token pricing and cache TTL actually work☕️</title>
      <dc:creator>Maksym Sokolov</dc:creator>
      <pubDate>Wed, 23 Sep 2026 18:13:05 +0000</pubDate>
      <link>https://dev.to/maksymsokolov/claude-code-pricing-what-youre-actually-paying-for-479p</link>
      <guid>https://dev.to/maksymsokolov/claude-code-pricing-what-youre-actually-paying-for-479p</guid>
      <description>&lt;p&gt;Most developers are asking "how do I use fewer tokens?"&lt;/p&gt;

&lt;p&gt;The better question is: &lt;strong&gt;how does the price actually form?&lt;/strong&gt; Because once you understand that, you'll stop bleeding money in ways you didn't even know were happening.&lt;/p&gt;

&lt;p&gt;There are 4 token types — and they're not priced equally.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(Using Claude Sonnet 4.6 as our baseline)&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  💸 The 4 Token Types
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;① Input tokens — 1×&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Everything Claude reads: your messages, file contents, MCP tools, CLAUDE.md, system prompts. Your baseline cost.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;② Output tokens — 5×&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Everything Claude writes back. ~5× more than input. But here's the sneaky part: &lt;strong&gt;that output becomes input on the next turn.&lt;/strong&gt; Every token Claude generated gets re-sent as context in your next message. Bloated responses compound across a session.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;③ Cache write tokens — 1.25× or 2×&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When Claude caches your context, you pay a write premium — paid upfront, and again every time the cache expires and gets rewritten. The exact cost depends on which TTL tier you're on (more on that below).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;④ Cache read tokens — 0.1×&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is where the magic lives.&lt;/em&gt; Reading from cache costs &lt;strong&gt;10× less&lt;/strong&gt; than fresh input. That gap is what makes Claude Code economically viable for large codebases.&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%2F1asklq1oq5rjja24l3aq.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%2F1asklq1oq5rjja24l3aq.png" alt="Relative price for million tokens" width="800" height="456"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  ⏰ TTL: The Clock That Controls Your Bill
&lt;/h2&gt;

&lt;p&gt;There are &lt;strong&gt;two cache durations&lt;/strong&gt; — and they have different write prices:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;TTL&lt;/th&gt;
&lt;th&gt;Write cost&lt;/th&gt;
&lt;th&gt;Read cost&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;5 minutes&lt;/td&gt;
&lt;td&gt;1.25× base&lt;/td&gt;
&lt;td&gt;0.1×&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1 hour&lt;/td&gt;
&lt;td&gt;2.00× base&lt;/td&gt;
&lt;td&gt;0.1×&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Both TTLs read at the same cheap 0.1× rate. The difference is only at write time.&lt;/p&gt;

&lt;p&gt;The 1-hour write costs 60% more per token than the 5-minute write. That premium only pays off if you actually reuse the cache across a gap longer than 5 minutes — otherwise you paid extra for nothing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which one you get depends on how you run Claude Code:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pro/Max subscribers&lt;/strong&gt; (logged-in CLI) → 1-hour TTL by default&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API key users&lt;/strong&gt; (pay-as-you-go) → 5-minute TTL by default&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So if you're on the API path, the coffee-break penalty is &lt;em&gt;far more acute&lt;/em&gt;. A 6-minute pause that costs a subscriber almost nothing can trigger a full rewrite for an API user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The TTL is rolling, not fixed from session start.&lt;/strong&gt; Every cache hit resets the clock. Stay active and the cache stays warm indefinitely. The danger isn't a single long pause — it's not knowing the clock is ticking at all.&lt;/p&gt;

&lt;p&gt;Go quiet past your TTL? The cache expires. Your next message triggers a full &lt;strong&gt;cache rewrite&lt;/strong&gt; — that's a &lt;strong&gt;12.5× price jump&lt;/strong&gt; for 5m cache, and &lt;strong&gt;20× for 1h cache&lt;/strong&gt;, compared to a simple cache hit.&lt;/p&gt;

&lt;p&gt;For Opus 5 at 200k context, a single 1h cache rewrite costs &lt;strong&gt;~$2.00&lt;/strong&gt;. Keeping it warm costs &lt;strong&gt;~$0.10&lt;/strong&gt;. That's per turn — let the cache expire three times in one session and you've spent $6.00 just on rewrites, without shipping a single extra feature.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Miss enough cache windows in one session and you can double your bill without shipping a single extra feature.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🔄 What Silently Kills Your Cache
&lt;/h2&gt;

&lt;p&gt;These actions force a full cache rewrite — even mid-session:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Switching models&lt;/li&gt;
&lt;li&gt;Changing effort level&lt;/li&gt;
&lt;li&gt;Toggling fast mode&lt;/li&gt;
&lt;li&gt;Connecting or disconnecting an MCP server&lt;/li&gt;
&lt;li&gt;Enabling or disabling a plugin&lt;/li&gt;
&lt;li&gt;Running &lt;code&gt;/compact&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Upgrading Claude Code (including auto-updates)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each one blows away the warm cache and starts the write cycle again.&lt;/p&gt;




&lt;h2&gt;
  
  
  💡 Three Tips to Stay in the Window
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;① Enable notifications&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open &lt;code&gt;/config&lt;/code&gt; inside Claude Code and set &lt;strong&gt;Notifications&lt;/strong&gt; to match your terminal (terminal bell, iTerm2, Ghostty, or Kitty). Claude pings you the moment it finishes, so you step away &lt;em&gt;after&lt;/em&gt; it responds, not during. Come back, send the next prompt, cache stays warm.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;② Add a status line&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Claude Code supports a live status line in your terminal showing context size, cost, and cache hit rate. Watching that number drop is the earliest signal your TTL is about to expire — before the expensive rewrite hits.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;③ Run &lt;code&gt;/usage&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Shows a full breakdown of token consumption including cache hits, cache writes, input and output. Helps you spot if you're bleeding money on rewrites without realizing it.&lt;/p&gt;




&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Token Type&lt;/th&gt;
&lt;th&gt;Cost&lt;/th&gt;
&lt;th&gt;When it triggers&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Input&lt;/td&gt;
&lt;td&gt;1×&lt;/td&gt;
&lt;td&gt;Every turn, fresh content&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Output&lt;/td&gt;
&lt;td&gt;5×&lt;/td&gt;
&lt;td&gt;Everything Claude writes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cache write (5m TTL)&lt;/td&gt;
&lt;td&gt;1.25×&lt;/td&gt;
&lt;td&gt;API default — first write, or after expiry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cache write (1h TTL)&lt;/td&gt;
&lt;td&gt;2.00×&lt;/td&gt;
&lt;td&gt;Subscriber default — pays off across longer gaps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cache read&lt;/td&gt;
&lt;td&gt;0.1×&lt;/td&gt;
&lt;td&gt;Every turn within TTL (same for both tiers)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Cache is your biggest lever. Writing it costs a little. Reading it costs almost nothing. Letting it expire costs you both.&lt;/p&gt;

&lt;p&gt;Stay in the window. Use notifications. Don't change your model mid-session without a reason.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Go make your coffee. Just come back before the clock runs out. ☕🙃&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;What's your current Claude Code cost per active day? Drop it in the comments — curious where people land.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claudecode</category>
      <category>devtools</category>
      <category>llm</category>
    </item>
  </channel>
</rss>
