Source note
Show HN: Lupen – an itemized, verified receipt for Claude Code and Codex spend
Summary
Lupen is a macOS app and CLI that itemizes Claude Code and Codex spending from local JSONL logs. It recomputes costs from token counts and public price tables so users can trace spend to sessions, turns, steps, and sub-agents.
Problem
- Daily AI coding spend totals hide which provider, session, turn, tool loop, or sub-agent caused the cost; this matters when one runaway session costs more than the rest of the day.
- Claude Code and Codex write detailed local logs, but raw JSONL files are hard to inspect by hand.
- Prompts, file paths, images, and URLs are sensitive, so cost analysis needs to work without uploading logs.
Approach
- Reads local session files from
~/.claude/projects/**/*.jsonlfor Claude Code and~/.codex/sessions/**/rollout-*.jsonlor$CODEX_HOME/sessions/**/rollout-*.jsonlfor Codex. - Builds a local index that groups activity as Session → Turn → Step → SkillGroup → SubAgent, with provider-specific modes for Claude Code and Codex.
- Uses Anthropic
stop_reasonfields to set turn boundaries, keeping tool-use loops inside the same turn. - Recomputes each cost from raw token counts and public pricing, then diffs the result against reported totals.
- Adds a CLI over the same local index for reports, search, resume commands, budget checks, and verification.
Results
- The excerpt gives no benchmark, accuracy study, or user study results.
- Claimed cost granularity: per Session, Turn, Step, SkillGroup, and SubAgent, with a 4-way token breakdown in the first public release.
- Example provider total shown:
$50 today · Claude Code · 12 sessions · 84 turns. - Verification checks Claude Code per-request totals and Codex
token_countrollout events;lupen verifyexits with code4on cost drift. - Budget automation supports gates such as
lupen budget --over 20 --last 7d, also exiting with code4when the budget is exceeded. - Limit tracking estimates
$ per 1%of 5-hour limit usage over the last 7 days, with menu-bar thresholds at 70%, 90%, and 100%.