Skip to main content

codex-stats

Local analytics for coding agents. codex-stats reads the session data already on your machine from Codex, OpenCode, Claude Code, Hermes, and DeepSeek Harness, then writes a standalone browser dashboard.

What you get

  • An Overview tab plus one tab per tool, each with day, week, month, and all-time windows
  • A Graphs / Stats toggle: charts first, or numbers and tables first
  • Token, cost, model, project, branch, and provider breakdowns
  • Session outcomes, context hygiene, tool behavior, and MCP/skill/subagent attribution
  • Efficiency (cost per 1k lines), waste ledger with the Context Tax flow diagram to show where spend goes, leaks, runway/burn, and regression detection
  • Animated donuts, columns, treemaps, gauges, scatter plots, calendars, stacked areas, and heatmaps
  • An all-time Token Wrapped pop-up that counts up your tokens, surfaces concise highlights, and copies or shares a generated card with a PyPI QR code
  • Shareable JPG cards and browser PDF export
  • A cited telemetry/privacy panel: what each harness sends, where, and how to turn it off

Install

pipx install codex-stats

Or with pip:

python3 -m pip install codex-stats

Desktop app

Tagged releases also publish standalone bundles that do not need Python installed:

  • macOS: .dmg and .zip for Apple Silicon and Intel
  • Windows: .zip with CodexStats.exe
  • Linux: .tar.gz with the CodexStats executable

Download the bundle for your platform from the GitHub release, extract it, and open the app. The builds are unsigned, so macOS may require right-clicking the app and choosing Open, and Windows may show a SmartScreen warning.

Run

codex-stats

It writes ~/.cache/codex-stats/dashboard.html and opens it in your browser. Set XDG_CACHE_HOME to move it. Inside the dashboard, the all-time Token Wrapped pop-up counts up your tokens and offers a copy-image button, share buttons for X and LinkedIn, and a save-image control; reopen it any time with the toolbar button. Use the tab row to switch tools and windows, the Graphs / Stats toggle to switch views, the search box to filter rows, Data sources to inspect ingest health, Telemetry and privacy to see what each harness sends off the machine, and the export menu for PDF and JPG cards. Press G or S anywhere outside a text field to switch between Graphs and Stats.

Data sources

Tool Location Notes
Codex ~/.codex state_5.sqlite + rollout JSONL, including git branch
OpenCode ~/.local/share/opencode/opencode.db recorded cost + tokens per session
Claude Code ~/.claude/projects/**/*.jsonl per-project transcripts, including git branch
Hermes ~/.hermes/state.db recorded cost + tokens per session
DeepSeek Harness ~/.dsh/sessions zstd JSONL event logs: tokens, tool calls, file edits

Override locations with CODEX_HOME, CODEX_STATS_OPENCODE_HOME, CODEX_STATS_CLAUDE_PROJECTS_DIR, CODEX_STATS_HERMES_HOME, and CODEX_STATS_DSH_HOME.

Each source reads its 2,000 most recent sessions by default. Set CODEX_STATS_MAX_SESSIONS=N to change the cap, or 0 to read everything. Parsed sessions are cached under the dashboard cache directory and re-read when a source changes.

Telemetry disclosure

The dashboard's Telemetry and privacy panel is collapsed by default. It shows, for each harness, its default behavior, destinations, data categories, whether prompts or code are included, the exact opt-out, and caveats. Curated claims link to vendor docs, vendor source, or independent source review and carry a review date; the local settings underneath are read from this machine only and take precedence. Use the panel's buttons to download the report as JSON or Markdown.

You can also write both files from the terminal:

codex-stats --telemetry-report

They land in ~/.cache/codex-stats/telemetry-report.json and telemetry-report.md, and the command prints a short summary. codex-stats never uploads this report anywhere. For Claude Code, the panel reports event and field names from locally queued failed-send telemetry files; IDs, hashes, device IDs, and session IDs are excluded.

Cost

Cost is estimated per token component (fresh input, cache reads, cache writes, output) from a dated rate snapshot. OpenCode and Hermes recorded costs win when present. Update rates or set a monthly budget in ~/.config/codex-stats/config.toml:

[pricing.model_usd_per_1k_tokens.gpt-5.4]
input = 0.0025
cached_read = 0.00025
cache_write = 0.0
output = 0.015

[budget]
monthly_limit_usd = 120.0
warn_at_ratio = 0.9

Unidentified models use a labeled mid-tier fallback rather than a flat rate.

Leaderboard

The Submit to Leaderboard button is available by default. It submits your all-time totals (tokens, requests, sessions, estimated cost, and per-CLI token share) under a username you choose, only after you confirm. Prompts, file names, project names, models, and timestamps are never sent. Use CODEX_STATS_DISABLE_LEADERBOARD=1 to hard-disable it, or CODEX_STATS_LEADERBOARD_URL to point at your own server.

Notes

  • Projects are identified by working directory, not folder name alone.
  • Branches are grouped per repository; a branch idle for 14 days is flagged as quiet.
  • Outcomes are conservative: "verified" requires a successful test, lint, typecheck, or build after the final edit. Unsupported signals stay unclassified.
  • Waste and per-line costs are labeled estimates, not invoices.
  • When history is truncated, the dashboard says so rather than reporting a partial history as complete.

Development

python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e .

PYTHONPATH=src python3 -m codex_stats
PYTHONPATH=src python3 -m unittest discover -s tests -v
ruff check src tests
mypy src/codex_stats

Build a desktop bundle for the current platform with:

python -m pip install -e ".[packaging]"
python packaging/build_app.py

Artifacts land in dist/desktop/artifacts. The desktop workflow builds macOS (Apple Silicon and Intel), Windows, and Linux bundles on tags and attaches them to the GitHub release.

The roadmap lives in docs/roadmap.md.

Metadata

Release files for codex-stats 1.23.2

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

Source distribution (sdist)

Source distribution for codex-stats 1.23.2
File Size Uploaded Provenance Actions
codex_stats-1.23.2.tar.gz 198.9 kB With provenance Details for codex_stats-1.23.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for codex-stats 1.23.2
File Interpreter ABI Platform Actions
codex_stats-1.23.2-py3-none-any.whl Python 3 none any Details for codex_stats-1.23.2-py3-none-any.whl

Total release size: 348.4 kB

Release files / codex_stats-1.23.2.tar.gz

Download URL codex_stats-1.23.2.tar.gz
Size 198.9 kB
Tags Source
SHA-256 checksum
How to use checksums
625c55dbd7f19e65e209da8ac48f6e47dcfaed8f71852195cd32ff408584f4a6
BLAKE2b-256 checksum
How to use checksums
d78328754bbabdd14e4e449056e7018dcecd5a6ff39b1d572c833d2af0c83b4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Dec 3, 2026.

Transparency log

Release files / codex_stats-1.23.2-py3-none-any.whl

Download URL codex_stats-1.23.2-py3-none-any.whl
Size 149.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4c2719a1ceb8d54ed9d74f557b209dcced66e55b8d105e1b19d77f51b55516e
BLAKE2b-256 checksum
How to use checksums
834dcd5b8e3b7bd59df2fc0b1c7b65155ec81deb081a1ab3084ba71a6753844e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Dec 3, 2026.

Transparency log

Security for codex-stats 1.23.2

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for codex_stats-1.23.2.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 Dec 3, 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.

Release history Release notifications | RSS feed

This release

1.23.2 This release

2 release files Full provenance

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