Browse / Agent tools
shiki-yusuke/agent-cost
Measure AI coding agent token usage and estimate costs from local logs (Claude Code / Codex CLI) — zero dependencies, zero network
- ai-agents
- claude-code
- cli
- codex-cli
- cost-estimation
- developer-tools
- observability
- python
- token-usage
Works.Tested on 2026-11-26. From the README alone, on Linux with Luna.
For maintainers
Keep your README agent-ready
Paste this prompt into your coding agent to tighten onboarding time and keep the README reproducible.
Improve the README and setup experience of shiki-yusuke/agent-cost so a small coding agent can install and verify it from scratch on a fresh Linux machine (Python 3, Node 22, standard tools).
Latest Coldpass Linux status: Works in 1:49 (tested 2026-11-26).
Please review the README and setup scripts to keep agent onboarding fast and reliable:
1. Fix any documented command that required extra steps or workarounds.
2. Pin dependency versions in a lockfile and document a fast verification command.
3. Keep prerequisites, platform notes, and expected output concise and exact.
Also review the recorded check notes (possible secrets, known vulnerabilities) and address any unintended dependency advisories or committed sample tokens.Shareable status badge
Add a live Coldpass Linux verification badge to your README.
[](https://coldpass.dev/repo/shiki-yusuke--agent-cost/)Static status badge · SVG · read-only JSON
What we checked
Is it safe?Review first. Found: possible secrets, known vulnerabilities.Each check
- Malware: none found in its 1 pinned dependency version or the 3 Python and npm packages installed during our run (OSV malware advisories).
- Secrets in its files: 4 possible hardcoded secrets found by gitleaks (values and locations withheld).
- Known vulnerabilities in its dependencies: 12 OSV advisories: pip 24.0 (GHSA-4xh5-x5gv-qwph); pip 24.0 (GHSA-58qw-9mgm-455v); pip 24.0 (GHSA-6vgw-5pg2-w6jp); pip 24.0 (GHSA-jp4c-xjxw-mgf9); pip 24.0 (GHSA-qwm4-qh6w-59xr); pip 24.0 (GHSA-wf93-45jw-7689); pip 24.0 (PYSEC-2026-1795); pip 24.0 (PYSEC-2026-1796); pip 24.0 (PYSEC-2026-196); pip 24.0 (PYSEC-2026-2875); pip 24.0 (PYSEC-2026-2876); pip 24.0 (PYSEC-2026-3721).
- Lines that download and run a program: none found in its source.
- Planted fake secret files: repo code opened none.
- Planted fake credential: not seen in unencrypted outgoing traffic. Encrypted traffic can't be read.
- Hosts the repo's own code contacted: none.
From our newest run of each setup (Nov 26, 2026). A quiet run is not a safety guarantee.
Can a small agent set it up?Yes (Luna, 1:49)The run
0:23 Install finished
0:33 First use worked
Test history
- Nov 26, 2026 · 1201014fe297 · linux / Luna · passed · run JSON
Does it do what the README says?3 of 3 claims held up. A claim is one README promise we ran and checked.Evidence
“See Claude Code and Codex CLI token usage and estimated costs from the logs already on your machine.”
“Claude Code: every logical assistant message is one billing event, attributed to the exact model on that event (a session that switches models mid-conversation is not folded into one "primary model"). Claude Code's transcript writes one JSONL line per content block of the same message, and those lines are deduplicated first -- but only when a row carries a full `message.id` + `requestId` pair; a row missing either half is emitted on its own (never merged) and flagged `source_quality: "identity_missing"` rather than assumed billing-accurate. `identity_missing` facts are still priced and included in rows/totals; the flag is a warning, not an exclusion or an unpriced status. A message's lines don't necessarily repeat an identical `usage` block: `model` and the input-side fields (input tokens, cache read, cache-write TTL breakdown) stay the same across a message's lines, but `output_tokens` typically grows line by line as the response streams in, and intermediate lines usually lack `usage.speed` entirely (reported as mode `"unknown"`), with only the final line carrying a concrete mode. Within a deduplicated group, `model` or an input-side field that actually differs across the group's rows, two rows disagreeing on a *concrete* mode (`"normal"` vs `"fast"`), or an `output_tokens` value that decreases or is non-monotonic across them, is counted in `data_quality.conflicting_duplicate_groups` as a real billing disagreement -- `output_tokens` growing row by row, and mode `"unknown"` mixed with a single concrete mode elsewhere in the group, are both the ordinary streaming pattern just described and are not flagged, since the reader's own cross-check of real transcripts found exactly that pattern in every observed duplicated group. See `CHANGELOG.md`'s 0.2.0 entry. If the row a group adopts has no `stop_reason` (common in subagent transcripts, where a message ending in `tool_use` may never get its final line), its `output_tokens` is only the streaming head's value: the group's `output` fact is flagged `source_quality: "output_lower_bound"` -- the observed lower bound of that message's output tokens, not guaranteed to be >= the true count. The group's input-side facts stay `"ok"`, and the token amount itself is unchanged (still priced and included in rows/totals); the flag is a warning only. When Anthropic's prompt-cache TTL breakdown (5-minute vs 1-hour writes) is present in the log, it's used; otherwise the cache-write tokens are priced at the 5-minute rate as an explicit lower bound and flagged `lower_bound` rather than guessed at the (more expensive) 1-hour rate. Each Claude fact also carries its request's prompt length (`prompt_tokens` = `input_tokens` + `cache_read_input_tokens` + `cache_creation_input_tokens`), used only to pick the tier of a model whose price depends on prompt length (`claude-haiku-5-5`).”
“Prompt-length tiers need a known prompt length. A fact whose prompt length is unknown -- every Codex fact (a delta of cumulative totals, not one request), a Claude fact from a conflicting dedup group, or a Claude row whose cache-write TTL breakdown exceeds its `cache_creation_input_tokens` -- is priced at the model's base (cheapest) tier and flagged `lower_bound`. Models without tiers are unaffected.”
Does the repo’s own CI pass?Success.GitHub checks
GitHub’s check status for the default branch at the commit we tested. We did not run their CI.
Needs keys, a login or a browser?No.Details
None seen
What does it depend on?Python 3.9+, IANA timezone dataDependencies
Software the test agent reported the README needed.
Local or hosted?Local: runs on your machineHow we tell
From the README and the endpoint we tested.
Is the README accurate?Yes.Deviations
No step differed.
What did it do when we ran it?Nothing unexpected seen during our run.What we saw
Linux / Luna
- Nothing unexpected in the trace for this setup.
- While installing, git-remote-https looked up github.com.
- While installing, python3 looked up files.pythonhosted.org, pypi.org.
- We found no known-malicious packages among the 3 Python and npm packages we observed (checked against OSV malicious-package advisories).
We found no compiled programs in its files.
What we checked: OSV vulnerability and malware advisories for pinned dependencies, OSV malicious-package advisories for observed Python and npm packages, secret-pattern scanning (gitleaks), compiled files shipped in the repo, and the connection attempts, host name lookups, file writes and credential-file reads we traced from repo processes while we installed and ran it. Expected package-manager and cache activity is left out. Where a setup's record is missing, capped or cut short, it says so above, and these checks may not have run for it.
What we didn't check: host names looked up by programs with their own resolver, such as Go programs; whether a connection got through; other UDP traffic; environment variables it read; minified JavaScript; programs packed inside archives or Git LFS; packages beyond the Python and npm inventory; or what the code is meant to do.
A quiet run is not a safety guarantee.
Is it maintained?MaintainedActivity
actively maintained: last commit 0 days ago; 83 commits and 28 merged PRs in 90 days; 0 open issues, 0 open PRs; latest release 2026-11-25
AboutStars: 1 · Forks: 0 · Contributors: 1 · Owner account since Jul 2, 2018Source
Recorded GitHub repository and owner account metadata.
LicenseSPDX: MIT · commercial use: yesSource
From GitHub’s license detection. The repository’s license text gives the terms.
Cost to runFree in this testDetails
Peak guest RAM: 442 MiB
Guest disk change: 21 MiB
GPU need: not captured
Paid service: not captured