Skip to main content

UsageSniffer

Scan your local Claude Code, Codex, Opencode, Gemini CLI, Copilot CLI, Cursor, Aider, and Continue sessions and see visually what eats your tokens — skills, thinking, tools, context cache, plus dollar costs, anomalies, and cross-agent comparisons.

Zero-dependency Python. Your session logs never leave the machine.

Install

Requires Python 3.10+.

# run straight from the repo (no install needed)
python3 -m usagesniffer scan --top 10

# or install it so the `usagesniffer` command is on your PATH
pip install git+https://github.com/Sleepy-Studio/UsageSniffer.git
# or: pipx install git+https://github.com/Sleepy-Studio/UsageSniffer.git
usagesniffer scan --top 10

Quick start

cd UsageSniffer
python3 -m usagesniffer scan --top 10        # everything
python3 -m usagesniffer scan --agents claude --top 5
python3 -m usagesniffer session 05062c81     # drill into one session (prefix match)
python3 -m usagesniffer cost --top 10        # dollar rollup + cache savings
python3 -m usagesniffer cost --budget 50     # exit 2 + alert when over $50
python3 -m usagesniffer report -o report.html
python3 -m usagesniffer watch --interval 30  # live burn (Ctrl-C to stop)
python3 -m usagesniffer anomalies            # outlier sessions vs agent baseline
python3 -m usagesniffer skills-roi           # per-skill cost table
python3 -m usagesniffer compare              # cross-agent efficiency
# filters work on most commands:
python3 -m usagesniffer scan --since 2026-09-01 --project Sunrise --model sonnet

What it reads

Agent Source Ground-truth token signal
Claude ~/.claude/projects/*/*.jsonl message.usage: input / output / cache_creation / cache_read per assistant message
Codex ~/.codex/sessions/**/*.jsonl event_msg → token_count: last_token_usage per step (input / cached / output / reasoning)
Opencode ~/.local/share/opencode/opencode.db message.data.tokens + part rows (text / reasoning / tool)
Gemini ~/.gemini/tmp/*/chats/*.json per-message tokens {input, output, cached, thoughts, tool}
Copilot ~/.copilot/session-store.db assistant_usage_events per turn (input / output / cache / reasoning). Subscription billing → $ unknown
Cursor ~/.config/Cursor/User/**/state.vscdb ⚠️ per-bubble tokens read as zero on current builds; char-estimated, cost from usageData.costInCents when present
Aider .aider.chat.history.md / --analytics-log JSONL real tokens only via analytics log (prompt_tokens, completion_tokens, cost); transcripts are char-estimated
Continue ~/.continue/sessions/*.json session usage {promptTokens, completionTokens, cachedTokens} when the model reports it

Attribution buckets

Real totals always come straight from the logs. The buckets are token-weighted estimates (labelled as such in output):

  • thinking — Claude thinking blocks / Codex reasoning_output_tokens / Opencode reasoning parts
  • skills — SKILL.md loads, skill-instruction blocks, Skill-tool calls
  • tools — tool_use + tool_result / exec payload share
  • context_cache / context_write — cache read / creation tokens
  • assistant_text, system, user, other

The second chart ("action share EXCLUDING context cache") is the useful one: cache reads dominate raw totals but are cheap; the action chart shows where your real budget goes.

Layout

usagesniffer/
  models.py            # SessionRecord / ScanResult
  analyze.py           # aggregation
  render.py            # terminal ASCII charts (stdlib only)
  cli.py               # scan | top | session
  parsers/
    claude.py          # ~/.claude/projects JSONL
    codex.py           # ~/.codex/sessions rollout JSONL
    opencode.py        # opencode.db SQLite

Roadmap

  • per-model pricing + $ cost rollup (cost, --budget)
  • --watch live mode
  • static HTML report export (report)
  • prompt-caching savings estimate (cache_read vs full-price replay)
  • 8-agent coverage (Claude, Codex, Opencode, Gemini, Copilot, Cursor, Aider, Continue)
  • anomalies, skill ROI, cross-agent compare
  • PyPI publish (pipx install usagesniffer) — see packaging.md
  • Homebrew / AUR packages — templates in packaging.md

Metadata

Release files for usagesniffer 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for usagesniffer 1.1.1
File Size Uploaded Provenance Actions
usagesniffer-1.1.1.tar.gz 25.3 kB With provenance Details for usagesniffer-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for usagesniffer 1.1.1
File Interpreter ABI Platform Actions
usagesniffer-1.1.1-py3-none-any.whl Python 3 none any Details for usagesniffer-1.1.1-py3-none-any.whl

Total release size: 57.3 kB

Release files / usagesniffer-1.1.1.tar.gz

Download URL usagesniffer-1.1.1.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8ed558f3a6e5321292638af1ebdae948fa4b7a5e8c936f10ad8810c8cfe94189
BLAKE2b-256 checksum
How to use checksums
e1e1701b923297929aa42dd0d0378fce5bbc90e4104c3c669d832bb7dfa52b21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / usagesniffer-1.1.1-py3-none-any.whl

Download URL usagesniffer-1.1.1-py3-none-any.whl
Size 32.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3fa3be75a4ab314264a2e8b43b199b9e9bcfb626a4b599f2016add0d61bb56a
BLAKE2b-256 checksum
How to use checksums
eed0ea87f5ae030034235948ad1379021541d251d67934ff64caddec3283c098
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Security for usagesniffer 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for usagesniffer-1.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page