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

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
爱范儿
爱范儿
H
Help Net Security
V
Visual Studio Blog
J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
Microsoft Security Blog
Microsoft Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
MyScale Blog
MyScale Blog
The Cloudflare Blog
Martin Fowler
Martin Fowler
D
Docker
腾讯CDC
F
Fortinet All Blogs
雷峰网
雷峰网
GbyAI
GbyAI
G
Google Developers Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Recent Announcements
Recent Announcements
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Blog — PlanetScale
Blog — PlanetScale
Engineering at Meta
Engineering at Meta
博客园 - 聂微东
博客园 - 叶小钗

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
coral-ai/claude-code-token-xray at main · Coral-Bricks-AI...
Hiteshjain11 · 2026-05-28 · via Hacker News: Show HN

Stars License: Apache 2.0 Python

Reverse-engineer a month of your own local Claude Code logs (~/.claude/projects/*/*.jsonl) into where the tokens, time, and cost actually go — and run it on yours. Reads only local logs; nothing is sent anywhere.

Token consumption per task, before vs. after the Opus 4.7 upgrade — ~4× on the same work

What it found (one month of my own logs — 181 sessions, 25,564 model calls):

  • You don't pay to generate, you pay to re-read. ~29M unique tokens → 4.35B billed (~150×), because every turn re-sends the whole ~173K-token context.
  • The bill is 84% input / 16% output — and re-reading the same context is 64% of it.
  • The biggest line is the one you never see: hidden reasoning is 84% of output and ~60% of everything re-read.
  • ~$3,371 for the month at Opus 4.7 list rates. Caching already serves 98% of input — and re-reading is still 64% of the bill.

Full write-up (all the tables, the why, the main-thread-vs-subagent split) → coralbricks.ai/blog/claude-code-token-xray

Quickstart

pip install -r requirements.txt   # just tiktoken
python3 token_time_breakdown.py
python3 cost.py
python3 main_vs_sidecar.py
python3 reread_breakdown.py

tiktoken is OpenAI's tokenizer, not Claude's, so token proportions are reliable to ~±15%, not Claude-exact. The billed-token counts in cost.py come straight from the API usage blocks and are exact.

What a month cost

From cost.py on my logs, priced at Opus 4.7 list rates:

Line item Cost Share
Input — re-reading context (cache reads) $2,176 64%
Input — cache writes $682 20%
Input — fresh (uncached) $2 0%
Output — reasoning $429 13%
Output — tool calls + summaries $82 2%
Total $3,371 100%

Caching is the only thing keeping it sane — without it the same work lists at ~$22,630 (~7×). Your numbers will differ; that's the point. Run it on yours.

Scripts

  • token_time_breakdown.py — the headline table: tokens (marked input/output) and wall-clock time per activity (reasoning, running commands, writing tool calls, subagents, summaries, reading/searching, editing) plus the passive-context rows (system prompt + tools, attachments, the typed prompt, injected reminders). One pass, so tokens and time stay consistent. Reasoning isn't stored in plaintext (only an encrypted signature), so it's recovered by subtraction: output − tool_calls − summaries. Time is reconstructed from event timestamps.
  • cost.py — billed token totals (cache reads / cache writes by TTL / fresh input / output) priced at Opus 4.7 list rates, plus the no-caching counterfactual.
  • main_vs_sidecar.py — splits the human-driven main thread from spawned subagents (logged under nested */subagents/*.jsonl); reports billed tokens, per-model mix, cache-hit rate, turns per agent (per session for the main thread, per subagent for the sidecar), and cost for each, plus the combined total.
  • reread_breakdown.py — per-activity cumulative input: replays each session's context growth to show what each kind of context costs once it's re-read every turn. Reports unique vs re-read tokens per activity (reasoning is the biggest re-read line). The replay is scaled to the measured billed input (exact); the per-activity split is a model.

Caveats

  • One person's month on one machine — directional, not a benchmark. Claude Code is dynamic, so your split will differ. That's the point: run it on yours.
  • A generation-time gap also includes the model reading its context before it writes; Bash time is real execution (commands auto-approved), but code run in the background or a separate terminal isn't counted.
  • The system-prompt row is estimated from each session's first cache write.

Found this useful?

If this helped you see where your Claude Code tokens, time, and cost actually go, please ⭐ the repo — it helps others find it. Curious what your re-read share comes out to.

License

Apache 2.0 — see the repository LICENSE.