<?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: danielneuron</title>
    <description>The latest articles on DEV Community by danielneuron (@danielneuron).</description>
    <link>https://dev.to/danielneuron</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%2F4269808%2F1528678f-8589-4137-b7e2-d79c9f255d35.png</url>
      <title>DEV Community: danielneuron</title>
      <link>https://dev.to/danielneuron</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/danielneuron"/>
    <language>en</language>
    <item>
      <title>Stop Eating Your AI Coding Bill: Parsing Claude Code, Codex &amp; Gemini Logs into Client Invoices (Zero-Dep TypeScript)</title>
      <dc:creator>danielneuron</dc:creator>
      <pubDate>Fri, 27 Nov 2026 23:53:57 +0000</pubDate>
      <link>https://dev.to/danielneuron/stop-eating-your-ai-coding-bill-parsing-claude-code-codex-gemini-logs-into-client-invoices-551g</link>
      <guid>https://dev.to/danielneuron/stop-eating-your-ai-coding-bill-parsing-claude-code-codex-gemini-logs-into-client-invoices-551g</guid>
      <description>&lt;p&gt;If you freelance or run a boutique dev shop in 2026, your Claude Code, OpenAI Codex CLI, Gemini CLI, and OpenRouter/API spend on client repos can quietly hit $150–$600/month.&lt;/p&gt;

&lt;p&gt;Most developers eat that cost out of pocket because attributing token spend to each client's Git repository and producing a clean itemized pass-through invoice takes hours of spreadsheet wrangling.&lt;/p&gt;

&lt;p&gt;So I built &lt;strong&gt;&lt;a href="https://github.com/danielneuron/promptbill" rel="noopener noreferrer"&gt;PromptBill&lt;/a&gt;&lt;/strong&gt; — a &lt;strong&gt;100% local-first, zero runtime dependency, MIT open-core CLI &amp;amp; local web studio&lt;/strong&gt; that scans local agent logs, attributes spend per Git repository, and outputs client-ready PDF &amp;amp; accounting CSV invoices in seconds.&lt;/p&gt;

&lt;p&gt;Try the interactive demo (no install, sample data):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx github:danielneuron/promptbill scan --demo
npx github:danielneuron/promptbill ui --demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Four Interesting Engineering Details Under the Hood
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Deduplicating Streaming Claude Code JSONL Logs
&lt;/h3&gt;

&lt;p&gt;Claude Code writes session logs under &lt;code&gt;~/.claude/projects/**/*.jsonl&lt;/code&gt;. Streaming assistant events can emit multiple chunks sharing the same &lt;code&gt;message.id&lt;/code&gt; and &lt;code&gt;requestId&lt;/code&gt; as output tokens climb. Counting every JSONL line naively wildly inflates costs. PromptBill deduplicates per &lt;code&gt;(message.id, requestId)&lt;/code&gt; pair and retains the highest token total for each request.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Computing Codex CLI Cumulative Deltas
&lt;/h3&gt;

&lt;p&gt;OpenAI Codex CLI logs (&lt;code&gt;~/.codex/sessions/**/*.jsonl&lt;/code&gt;) report &lt;code&gt;token_count&lt;/code&gt; events that may contain &lt;code&gt;last_token_usage&lt;/code&gt; or cumulative &lt;code&gt;total_token_usage&lt;/code&gt;, where &lt;code&gt;cached_input_tokens&lt;/code&gt; is a subset of &lt;code&gt;input_tokens&lt;/code&gt;. PromptBill computes exact non-cached deltas (&lt;code&gt;Math.max(0, rawInput - cachedInput)&lt;/code&gt;) across turns so cache-hit discounts are accurate and tokens are never double-counted.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Worktree-Aware Git Repo Attribution
&lt;/h3&gt;

&lt;p&gt;Each session's &lt;code&gt;cwd&lt;/code&gt; is walked upward to its enclosing &lt;code&gt;.git&lt;/code&gt; directory (or &lt;code&gt;.git&lt;/code&gt; file for worktrees) and matched to its &lt;code&gt;origin&lt;/code&gt; remote name in &lt;code&gt;.git/config&lt;/code&gt;, cleanly grouping nested subdirectories under the right client repository.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Zero-Dependency Native PDF 1.4 Generation
&lt;/h3&gt;

&lt;p&gt;Most invoice CLIs pull in a 300MB Puppeteer/Chromium binary just to print a 1-page PDF. PromptBill writes valid, self-contained &lt;code&gt;%PDF-1.4&lt;/code&gt; binaries directly in ~260 lines of TypeScript (complete with proper byte-offset &lt;code&gt;xref&lt;/code&gt; tables, multi-page support, and clean WinAnsi escaping), so the entire package has &lt;strong&gt;zero runtime dependencies&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Privacy Architecture
&lt;/h2&gt;

&lt;p&gt;Everything runs strictly on your laptop. Your prompts, source code, and session logs never leave your machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Open-Core Model
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Free (MIT Open Source):&lt;/strong&gt; Full CLI &amp;amp; local web UI, Claude Code / Codex CLI / Gemini CLI parsers, Anthropic/OpenAI/OpenRouter/Cursor CSV importer, Git repo attribution, repo CSV/JSON export, and watermarked PDF previews.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Optional Pro License ($19 one-time):&lt;/strong&gt; Removes the PDF watermark and unlocks a sanitized Page 2 Client Audit Appendix (dates, repos, models, token totals, and optional commit titles — never code or prompts), Xero &amp;amp; QuickBooks Online invoice CSV exports, and unlimited client profiles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;GitHub (MIT):&lt;/strong&gt; &lt;a href="https://github.com/danielneuron/promptbill" rel="noopener noreferrer"&gt;https://github.com/danielneuron/promptbill&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Interactive Pass-Through Calculator &amp;amp; Docs:&lt;/strong&gt; &lt;a href="https://danielneuron.github.io/promptbill/" rel="noopener noreferrer"&gt;https://danielneuron.github.io/promptbill/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What other coding agent log formats (Aider, OpenCode, Windsurf, Cline) would you want parsed natively next? Let me know in the comments or open an issue on GitHub!&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>typescript</category>
      <category>cli</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
