<?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: Huang振华</title>
    <description>The latest articles on DEV Community by Huang振华 (@huang_6e29ac19ab0836a7c).</description>
    <link>https://dev.to/huang_6e29ac19ab0836a7c</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%2F4247898%2F348e714b-0275-492f-9623-dd957c612019.png</url>
      <title>DEV Community: Huang振华</title>
      <link>https://dev.to/huang_6e29ac19ab0836a7c</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/huang_6e29ac19ab0836a7c"/>
    <language>en</language>
    <item>
      <title>How Much Are Claude Code, Codex &amp; OpenCode Actually Costing You? (Zero-Dependency Local Spend Auditor)</title>
      <dc:creator>Huang振华</dc:creator>
      <pubDate>Mon, 16 Nov 2026 14:21:11 +0000</pubDate>
      <link>https://dev.to/huang_6e29ac19ab0836a7c/how-much-are-claude-code-codex-opencode-actually-costing-you-zero-dependency-local-spend-1n1h</link>
      <guid>https://dev.to/huang_6e29ac19ab0836a7c/how-much-are-claude-code-codex-opencode-actually-costing-you-zero-dependency-local-spend-1n1h</guid>
      <description>&lt;p&gt;If you bounce between &lt;strong&gt;Claude Code&lt;/strong&gt;, &lt;strong&gt;OpenAI Codex CLI&lt;/strong&gt;, &lt;strong&gt;Google Antigravity&lt;/strong&gt;, &lt;strong&gt;OpenCode&lt;/strong&gt;, &lt;strong&gt;xAI Grok CLI&lt;/strong&gt;, and &lt;strong&gt;Cline / Roo Code&lt;/strong&gt;, you quickly run into a blind spot: every agent stores local token telemetry in a completely different format — and even uses incompatible prompt-cache accounting rules.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Anthropic / Antigravity / OpenCode&lt;/strong&gt; log uncached input, &lt;code&gt;cache_read&lt;/code&gt;, and &lt;code&gt;cache_write&lt;/code&gt; as &lt;strong&gt;separate additive buckets&lt;/strong&gt; (&lt;code&gt;total_input = input + cache_read + cache_write&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI / Codex CLI / Grok CLI&lt;/strong&gt; log &lt;code&gt;cached_tokens&lt;/code&gt; as an &lt;strong&gt;inclusive subset&lt;/strong&gt; already inside &lt;code&gt;input_tokens&lt;/code&gt; (plus Codex silently compresses older sessions into &lt;code&gt;~/.codex/archived_sessions/*.jsonl.zst&lt;/code&gt;, while OpenCode v2 migrated from JSON files to a local SQLite &lt;code&gt;opencode.db&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To see my real 30-day token burn without uploading a single prompt or file path anywhere, I built a &lt;strong&gt;zero-dependency, 100% read-only Python stdlib auditor&lt;/strong&gt; (&lt;code&gt;audit_ai_spend.py&lt;/code&gt;) + an open-source &lt;strong&gt;API vs. GPU Break-Even Calculator&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run It in 1 Command (Zero &lt;code&gt;pip install&lt;/code&gt;, 100% Local Read-Only)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -fsSL https://ai-cost-radar-nlu.pages.dev/audit_ai_spend.py &lt;span class="o"&gt;|&lt;/span&gt; python3 - --days 30 --lang en --region global
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;(Security tip: you can inspect the script first with &lt;code&gt;curl -fsSL https://ai-cost-radar-nlu.pages.dev/audit_ai_spend.py | less&lt;/code&gt; — it uses only Python's standard library &lt;code&gt;json&lt;/code&gt;, &lt;code&gt;sqlite3&lt;/code&gt; in &lt;code&gt;?mode=ro&lt;/code&gt; read-only URI mode, and in-memory &lt;code&gt;zstd&lt;/code&gt; decoding.)&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Supported Local Coding &amp;amp; Agent Clients
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Client&lt;/th&gt;
&lt;th&gt;Local Telemetry Source&lt;/th&gt;
&lt;th&gt;Accounting Nuance Handled&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Claude Code&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;~/.claude/projects/**/*.jsonl&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Streaming &lt;code&gt;message.id&lt;/code&gt; dedupe + additive cache math&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;OpenAI Codex&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;~/.codex/sessions/**/*.jsonl&lt;/code&gt; + &lt;code&gt;archived_sessions/*.jsonl.zst&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;In-memory &lt;code&gt;.zst&lt;/code&gt; decode + &lt;code&gt;response_id&lt;/code&gt; retry dedupe (skips duplicate &lt;code&gt;event_msg:token_count&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Google Antigravity&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;~/.gemini/antigravity/brain/*/.system_generated/logs/transcript.jsonl&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reads &lt;code&gt;PLANNER_RESPONSE&lt;/code&gt; steps &amp;amp; skips &lt;code&gt;transcript_full.jsonl&lt;/code&gt; to prevent 2x double-counting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;OpenCode&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;~/.local/share/opencode/opencode.db&lt;/code&gt; + legacy JSON&lt;/td&gt;
&lt;td&gt;Read-only SQLite &lt;code&gt;?mode=ro&lt;/code&gt; with per-row timestamp cutoff + legacy JSON ID dedupe&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;xAI Grok CLI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;~/.grok/sessions/*/*/updates.jsonl&lt;/code&gt; + &lt;code&gt;summary.json&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Filters &lt;code&gt;turn_completed&lt;/code&gt; events with inclusive &lt;code&gt;inputTokens&lt;/code&gt; + &lt;code&gt;cacheCreationTokens&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cline / Roo Code&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;globalStorage/.../tasks/*/ui_messages.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Extracts &lt;code&gt;api_req_started&lt;/code&gt; cost &amp;amp; additive cache reads/writes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;WorkBuddy / Qwen&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;~/.workbuddy&lt;/code&gt;, &lt;code&gt;~/.codebuddy&lt;/code&gt;, &lt;code&gt;~/.qwen&lt;/code&gt;, &lt;code&gt;~/.qoder&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Multi-turn JSONL &amp;amp; read-only SQLite session aggregation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  3 Surprises From Auditing 47,000+ Real Local Agent Calls
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Codex &lt;code&gt;.jsonl.zst&lt;/code&gt; archives hide most of your 30-day history&lt;/strong&gt;: Scanning only uncompressed &lt;code&gt;~/.codex/sessions&lt;/code&gt; missed &lt;strong&gt;over 60%&lt;/strong&gt; of my 30-day Codex calls that had been rotated into &lt;code&gt;.jsonl.zst&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;90%+ prompt-cache hit rates completely change the API vs. Self-Hosted GPU math&lt;/strong&gt;: Naive token calculators multiply total context tokens by full uncached input rates, overestimating agent bills by &lt;strong&gt;4x–6x&lt;/strong&gt;. Once you account for real cache read discounts, renting a dedicated 24GB GPU pod (e.g., RTX 4090 / A100 on RunPod) only beats Pay-As-You-Go APIs when &lt;em&gt;post-cache&lt;/em&gt; spend crosses &lt;strong&gt;~$125/month&lt;/strong&gt; — below that, Pay-As-You-Go or a lightweight ~$5/month &lt;strong&gt;LiteLLM semantic-cache proxy&lt;/strong&gt; wins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A single runaway debug loop can eat 25% of your monthly budget&lt;/strong&gt;: In the companion web tool, you can drag-and-drop multiple &lt;code&gt;.jsonl&lt;/code&gt; / &lt;code&gt;.csv&lt;/code&gt; logs locally in your browser (zero server upload) and toggle &lt;strong&gt;"Exclude #1 Spike Session"&lt;/strong&gt; to compare your steady-state daily burn and export a zero-code &lt;code&gt;LiteLLM config.yaml&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Try the Interactive Calculator &amp;amp; Source Code
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live Calculator &amp;amp; Spend Auditor (English / USD)&lt;/strong&gt;: &lt;a href="https://ai-cost-radar-nlu.pages.dev/ai-coding-spend-auditor/" rel="noopener noreferrer"&gt;https://ai-cost-radar-nlu.pages.dev/ai-coding-spend-auditor/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository (MIT, Python 3.12+ stdlib + Vanilla ES2024)&lt;/strong&gt;: &lt;a href="https://github.com/huangbuqubunao-alt/ai-cost-radar" rel="noopener noreferrer"&gt;https://github.com/huangbuqubunao-alt/ai-cost-radar&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;(Transparency note: the open-source repo has zero trackers; selected cloud host cards on the web directory may carry partner referral links at identical official catalog prices.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If your daily-driver coding CLI stores token logs in another path or schema, drop a comment below and I'll add exact parser support for it!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>opensource</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
