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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
998bf1b962fd70f19e51bacac0cbd1f9a0682eb2698c01a30e5b0abb69d42fb6
|
|
| MD5 |
fe68110dda06ffd6710bc733fe110347
|
|
| BLAKE2b-256 |
4eab4efbe91f26fbb54a551ae8e879bc0c52804c3739570e6191657fe1f79ad0
|
Provenance
The following attestation bundles were made for clanker_analytics-0.1.0.tar.gz:
Publisher:
publish.yml on wakamex/clanker-analytics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
clanker_analytics-0.1.0.tar.gz -
Subject digest:
998bf1b962fd70f19e51bacac0cbd1f9a0682eb2698c01a30e5b0abb69d42fb6 - Sigstore transparency entry: 1111987939
- Sigstore integration time:
-
Permalink:
wakamex/clanker-analytics@6bdec0c610327494e7b153983685230f85f3993e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/wakamex
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6bdec0c610327494e7b153983685230f85f3993e -
Trigger Event:
push
-
Statement type:
File details
Details for the file clanker_analytics-0.1.0-py3-none-any.whl.
File metadata
- Download URL: clanker_analytics-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2b87a368d698ee23dd4e59cd1c1436ee18e9e4f6e0e1b52ff32ae4622b4d89a
|
|
| MD5 |
52bdbaa29fd37be9de09316885471cf4
|
|
| BLAKE2b-256 |
c526818401224bb9dfa4f24d9287168b1178f7c0c05ddc1a9f66a9e64221e8ff
|
Provenance
The following attestation bundles were made for clanker_analytics-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on wakamex/clanker-analytics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
clanker_analytics-0.1.0-py3-none-any.whl -
Subject digest:
a2b87a368d698ee23dd4e59cd1c1436ee18e9e4f6e0e1b52ff32ae4622b4d89a - Sigstore transparency entry: 1111987983
- Sigstore integration time:
-
Permalink:
wakamex/clanker-analytics@6bdec0c610327494e7b153983685230f85f3993e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/wakamex
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6bdec0c610327494e7b153983685230f85f3993e -
Trigger Event:
push
-
Statement type: