How Much Are Claude Code, Codex & OpenCode Actually Costing You? (Zero-Dependency Local Spend Auditor) A developer released audit_ai_spend.py, a zero-dependency, read-only Python standard-library script that aggregates local token telemetry from Claude Code, OpenAI Codex CLI, Google Antigravity, OpenCode, xAI Grok CLI, Cline and Roo Code to compute real 30-day AI coding spend without uploading prompts or file paths. The author reports that scanning only uncompressed ~/.codex/sessions missed over 60% of 30-day Codex calls rotated into .jsonl.zst archives, that naive token calculators overestimate agent bills by 4x–6x by ignoring 90%+ prompt-cache hit rates, and that a dedicated 24GB GPU pod only beats pay-as-you-go APIs once post-cache spend crosses about $125/month. The companion web tool at ai-cost-radar-nlu.pages.dev lets users drag-and-drop .jsonl/.csv logs locally and export a LiteLLM config.yaml, with code under an MIT license on GitHub. How Much Are Claude Code, Codex & OpenCode Actually Costing You? Zero-Dependency Local Spend Auditor If you bounce between Claude Code, OpenAI Codex CLI, Google Antigravity, OpenCode, xAI Grok CLI, and Cline / Roo Code, 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. Anthropic / Antigravity / OpenCode log uncached input, cache read, and cache write as separate additive buckets total input = input + cache read + cache write . OpenAI / Codex CLI / Grok CLI log cached tokens as an inclusive subset already inside input tokens plus Codex silently compresses older sessions into ~/.codex/archived sessions/ .jsonl.zst, while OpenCode v2 migrated from JSON files to a local SQLite opencode.db . To see my real 30-day token burn without uploading a single prompt or file path anywhere, I built a zero-dependency, 100% read-only Python stdlib auditor audit ai spend.py + an open-source API vs. GPU Break-Even Calculator. pip install, 100% Local Read-Only curl -fsSL https://ai-cost-radar-nlu.pages.dev/audit ai spend.py | python3 - --days 30 --lang en --region global Security tip: you can inspect the script first with curl -fsSL https://ai-cost-radar-nlu.pages.dev/audit ai spend.py | less — it uses only Python's standard library json, sqlite3 in ?mode=ro read-only URI mode, and in-memory zstd decoding. Client Local Telemetry Source Accounting Nuance Handled Claude Code ~/.claude/projects/ / .jsonl Streaming message.id dedupe + additive cache math OpenAI Codex ~/.codex/sessions/ / .jsonl + archived sessions/ .jsonl.zst In-memory .zst decode + response id retry dedupe skips duplicate event msg:token count Google Antigravity ~/.gemini/antigravity/brain/ /.system generated/logs/transcript.jsonl Reads PLANNER RESPONSE steps & skips transcript full.jsonl to prevent 2x double-counting OpenCode ~/.local/share/opencode/opencode.db + legacy JSON Read-only SQLite ?mode=ro with per-row timestamp cutoff + legacy JSON ID dedupe xAI Grok CLI ~/.grok/sessions/ / /updates.jsonl + summary.json Filters turn completed events with inclusive inputTokens + cacheCreationTokens Cline / Roo Code globalStorage/.../tasks/ /ui messages.json Extracts api req started cost & additive cache reads/writes WorkBuddy / Qwen ~/.workbuddy, ~/.codebuddy, ~/.qwen, ~/.qoder Multi-turn JSONL & read-only SQLite session aggregation Codex .jsonl.zst archives hide most of your 30-day history: Scanning only uncompressed ~/.codex/sessions missed over 60% of my 30-day Codex calls that had been rotated into .jsonl.zst. 90%+ prompt-cache hit rates completely change the API vs. Self-Hosted GPU math: Naive token calculators multiply total context tokens by full uncached input rates, overestimating agent bills by 4x–6x. 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 post-cache spend crosses ~$125/month — below that, Pay-As-You-Go or a lightweight ~$5/month LiteLLM semantic-cache proxy wins. A single runaway debug loop can eat 25% of your monthly budget: In the companion web tool, you can drag-and-drop multiple .jsonl / .csv logs locally in your browser zero server upload and toggle "Exclude 1 Spike Session" to compare your steady-state daily burn and export a zero-code LiteLLM config.yaml. Live Calculator & Spend Auditor English / USD : https://ai-cost-radar-nlu.pages.dev/ai-coding-spend-auditor/ GitHub Repository MIT, Python 3.12+ stdlib + Vanilla ES2024 : https://github.com/huangbuqubunao-alt/ai-cost-radar 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. 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 Key Takeaways - •OpenAI / Codex CLI / Grok CLI log cached tokens as an inclusive subset already inside input tokens plus Codex silently compresses older sessions into ~/.codex/archived sessions/ .jsonl.zst, while OpenCode v2 migrated from JSON files to a local SQLite opencode.db . - •This story was reported by Dev.to , covering developments in the dev space. - •AI advancements continue to reshape industries — read the full article on Dev.to for complete coverage. 📖 Continue reading the full article: Read Full Article on Dev.to → https://dev.to/huang 6e29ac19ab0836a7c/how-much-are-claude-code-codex-opencode-actually-costing-you-zero-dependency-local-spend-1n1h