惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
B
Blog RSS Feed
阮一峰的网络日志
阮一峰的网络日志
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
MyScale Blog
MyScale Blog
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
GbyAI
GbyAI
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
Martin Fowler
Martin Fowler
Vercel News
Vercel News
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
Last Week in AI
Last Week in AI
Hugging Face - Blog
Hugging Face - Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
Google DeepMind News
Google DeepMind News
Engineering at Meta
Engineering at Meta
云风的 BLOG
云风的 BLOG

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Where Did My Claude Code Money Go? I Built a Tool to Find...
Ranajoy · 2026-05-03 · via DEV Community

I still remember the message. A developer on my team - sharp, careful - pinged me: "My Claude Code bill spiked $200 this week. Same workflow. Something's off."

I had no answer. The built-in usage view showed session totals. The web billing page showed monthly aggregates. But neither could answer the only question that mattered: which specific turn ate the money? How do I improve the way I use Claude Code?

That gap - between knowing you spent and seeing exactly why - is what this closes.


What It Is

Claude Code Cost Explorer is a local dashboard that reads Claude Code's own session files already stored locally on your machine and shows you cost down to the individual turn. No API keys. No databases. No instrumentation. Just pip install, run one command, and your browser opens.

  • Day view: Cost trends, session count, API calls - “Where did that $100 day come from?”
  • Session view: Per‑project cost, token totals, timestamps - “Did the auth-refactor session really cost $12?”
  • Turn view: Full prompt, thinking blocks, tool call inputs/outputs, per‑turn cost, model used - “Wait, that one turn cost $4.20?”

It doesn’t predict. It doesn’t optimize. It just surfaces exactly what happened - with cost attached to every breath the agent took.


Why Nothing Else Fit

I searched. Many tools give summaries, live burn‑rate counters, or heavy dashboards. But I couldn't find a single one that would show me why a session cost $12 - down to the turn that triggered 3 Read calls, a broad Glob, and a long thinking chain. So I built it.


What You Actually See

Claude Code already stores its session data locally. This tool reads those files — no uploads, no network calls - and renders:

  • User prompts - exactly what you asked
  • Agent workflow - thinking blocks, tool calls (Read, Write, Glob, Bash), inputs
  • Tool results - raw outputs Claude received
  • Per‑turn cost - calculated from local pricing tables
  • Model tags - which Claude model handled that turn, and what it cost

The real value kicks in when you start noticing patterns.

I once spotted that a simple “fix the build” prompt caused Claude to recursively Glob through node_modules - not because it needed to, but because the prompt wasn't precise enough. An immature request that cost a quiet $3.70 in a single turn. I refined the prompt; the next identical task cost under $0.40.

Another time, I noticed Claude repeatedly pulling AWS CloudWatch log groups and metrics across multiple debugging sessions. Same access pattern, same API calls, same tokens burned. That repetition was a clear signal: this is a reusable workflow. I ended up building a skill to package that exact diagnostic routine - subsequent sessions that would have cost $8-10 each now run in a fraction of the time and cost.

Without turn-level visibility, those patterns stay invisible. With it, you move from cost surprise to cost control - and from one‑shot prompts to smart, reusable tooling.


Install & Run

pip install claude-code-cost-explorer
ccx
# Automatically opens http://127.0.0.1:5000

Enter fullscreen mode Exit fullscreen mode

Requirements: Python 3.10+, Claude Code installed and used at least once.

The architecture is intentionally minimal - standard library, simple templates, tests. No frontend build step. No database migrations. The smarts are in the log parsing and cost attribution, not in the plumbing.


Honest Limitations

  • Not exact billing. Local cost estimates; typically within 1-2% of your actual Anthropic Claude Code bill.
  • Not a CLI utility. For lightning‑fast terminal checks, other lightweight tools shine. This is for when you need to look inside a session.
  • Not teamware. No multi‑user dashboards, no RBAC.

Why I Built This

I’m a AIops/MLOps engineer and solution architect. I spend my days obsessing over system design, architecture optimizations, and making complex pipelines observable and cost‑efficient. I instrument production APIs, ML models, and cloud infrastructure. But my daily coding agent - burning $200-400 a month, firing thousands of API calls - operated with less visibility than a $5 cloud function. That felt broken.

This started as a weekend project to answer a single question: “Where did that $100 day come from?” My colleagues started using it. It worked. So I decided to take the next step - I wanted to understand how open‑source software is actually built, packaged, and shared with the world. This is my first attempt, small in scale, but an attempt nonetheless.

Now it's out there. If it helps you move from cost anxiety to cost clarity - and maybe even inspires you to build a skill from a pattern you discover - that's the whole win.

File issues. Fork it. The code stays small so it's approachable.

github.com/ranajoy-dutta/claude-code-cost-explorer