Skip to main content

AI coding tool token analytics powered by DuckDB

Project description

clanker-analytics

Token usage analytics for AI coding tools. Reads local session logs and shows per-project breakdowns using DuckDB.

Supports Claude Code and Codex.

Install

uv tool install clanker-analytics

Or run directly from the repo:

uv run clanker-analytics

Usage

clanker-analytics                        # ranked by project (default)
clanker-analytics --by date              # daily totals
clanker-analytics --by model             # per-model breakdown
clanker-analytics --by session           # per-session breakdown
clanker-analytics --tool claude          # Claude Code only
clanker-analytics --tool codex           # Codex only
clanker-analytics --refresh              # force cache rebuild
clanker-analytics --sql "SELECT ..."     # custom SQL against 'tokens' table

Example output

┌──────────────────┬─────────────┬───────┬─────────┬─────────┬─────────┬─────────┬────────────┬────────────┐
│     project      │    tool     │ turns │  total  │  input  │ output  │  cache  │ first_seen │ last_seen  │
├──────────────────┼─────────────┼───────┼─────────┼─────────┼─────────┼─────────┼────────────┼────────────┤
│ tao              │ Codex       │  7729 │    1.4B │    1.3B │    3.0M │  96%    │ 2026-03-07 │ 2026-03-12 │
│ gitrep           │ Claude Code │ 11949 │    1.1B │    1.1B │    1.0M │  98%    │ 2026-02-17 │ 2026-03-13 │
│ tao-auto         │ Codex       │  6253 │  903.2M │  901.5M │    1.7M │  97%    │ 2026-03-10 │ 2026-03-13 │
│ frame-modernized │ Claude Code │  9218 │  883.4M │  882.1M │    1.3M │  97%    │ 2026-02-24 │ 2026-03-06 │
│ tao-sprites      │ Claude Code │  7924 │  800.4M │  798.4M │    1.9M │  98%    │ 2026-03-09 │ 2026-03-13 │
└──────────────────┴─────────────┴───────┴─────────┴─────────┴─────────┴─────────┴────────────┴────────────┘

Codex: 5.7B across 43 projects
Claude Code: 7.7B across 94 projects

How it works

DuckDB reads JSONL session logs directly from ~/.claude/projects/ and ~/.codex/sessions/ — no Python JSON parsing. Results are cached to ~/.cache/clanker-analytics/tokens.parquet (ZSTD compressed) and auto-invalidated when source files change.

Columns

  • total — input + output + cache write + cache read tokens
  • input — total minus output (includes cache tokens)
  • output — output tokens only
  • cache — cache read hits as % of input tokens

Requirements

Python 3.13+, DuckDB 1.5+.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clanker_analytics-0.1.0.tar.gz (2.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clanker_analytics-0.1.0-py3-none-any.whl (2.6 MB view details)

Uploaded Python 3

File details

Details for the file clanker_analytics-0.1.0.tar.gz.

File metadata

  • Download URL: clanker_analytics-0.1.0.tar.gz
  • Upload date:
  • Size: 2.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for clanker_analytics-0.1.0.tar.gz
Algorithm Hash digest
SHA256 998bf1b962fd70f19e51bacac0cbd1f9a0682eb2698c01a30e5b0abb69d42fb6
MD5 fe68110dda06ffd6710bc733fe110347
BLAKE2b-256 4eab4efbe91f26fbb54a551ae8e879bc0c52804c3739570e6191657fe1f79ad0

See more details on using hashes here.

Provenance

The following attestation bundles were made for clanker_analytics-0.1.0.tar.gz:

Publisher: publish.yml on wakamex/clanker-analytics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file clanker_analytics-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for clanker_analytics-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2b87a368d698ee23dd4e59cd1c1436ee18e9e4f6e0e1b52ff32ae4622b4d89a
MD5 52bdbaa29fd37be9de09316885471cf4
BLAKE2b-256 c526818401224bb9dfa4f24d9287168b1178f7c0c05ddc1a9f66a9e64221e8ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for clanker_analytics-0.1.0-py3-none-any.whl:

Publisher: publish.yml on wakamex/clanker-analytics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page