AI Spend Tracker
Aggregate token usage & cost across all your AI coding agents in one CLI.
📝 Give feedback (1 min) · 🐛 Report a bug · 💬 Start a discussion
If you run multiple AI coding tools (Claude Code, Codex, Hermes, OpenClaw, OpenCode, GitHub Copilot, Kimi), you're probably flying blind on how much you're actually spending. AI Spend Tracker reads session data from every agent's local storage and shows you the big picture.
Features
- 7 built-in collectors — Hermes Agent, Codex CLI, GitHub Copilot CLI, OpenCode, Claude Code, OpenClaw, Kimi Code CLI
- Cross-platform — Windows (native + WSL), Linux, macOS
- Multi-agent aggregation — all agents in one report
- Extensible — drop a custom collector in
~/.ai-spend/collectors/ - Path override — manual data source path via
~/.ai-spend/config.json - Rich terminal output — agent summary, model breakdown, daily trends
- JSON output — pipe data into your own dashboards
Supported Agents
| Collector | Agent | Data Source |
|---|---|---|
hermes |
Hermes Agent (Nous Research) | ~/.hermes/state.db |
codex |
OpenAI Codex CLI | ~/.codex/state_*.sqlite |
copilot |
GitHub Copilot CLI | ~/.copilot/session-store.db |
opencode |
OpenCode CLI | ~/.local/share/opencode/opencode.db |
claude-code |
Claude Code (Anthropic) | ~/.claude/projects/*.jsonl |
openclaw |
OpenClaw | ~/.openclaw/agents/*/sessions/*.jsonl |
kimi |
Kimi Code CLI (Moonshot AI) | ~/.kimi/sessions/*/*/wire.jsonl |
Note: Claude Code v2.1.140+ may not persist session logs to disk. See anthropics/claude-code#25941.
Quick Start
# Install
pip install ai-spend-tracker
# See your usage for the last 7 days
ai-spend
# List available data sources
ai-spend --list-agents
# See only Hermes data
ai-spend --agent hermes
# All historical data (no time limit)
ai-spend --days 0
# JSON output
ai-spend --format json
Usage
ai-spend [options]
Options:
--list-agents List all available data collectors
--init [name] Initialize ~/.ai-spend/ directory
--agent AGENT Filter by agent name (comma-separated)
--days DAYS Days to look back (default: 7, 0 = all time)
--since YYYY-MM-DD Start date
--until YYYY-MM-DD End date
--format {table,json} Output format (default: table)
--demo Show sample data (no real agents needed)
Path Override
If auto-detection fails, manually specify data source paths:
// ~/.ai-spend/config.json
{"paths": {
"hermes": "D:/custom/hermes/state.db",
"codex": "C:/Users/me/.codex/state_1.sqlite",
"copilot": "D:/copilot/session-store.db",
"opencode": "D:/opencode/opencode.db",
"claude-code": "D:/claude/projects",
"openclaw": "D:/.openclaw",
"kimi": "D:/.kimi"
}}
Custom Collectors
Create your own collector in ~/.ai-spend/collectors/:
ai-spend init my-agent
# Edit ~/.ai-spend/collectors/my-agent.py
# Implement BaseCollector.name(), display_name(), collect()
Platform Support
| Platform | Status |
|---|---|
| Linux | ✅ Full |
| macOS | ✅ Full |
| Windows (native) | ✅ Full |
| Windows (WSL) | ✅ Full |
License
MIT
Release files for ai-spend-tracker 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ai_spend_tracker-0.2.2.tar.gz | 24.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ai_spend_tracker-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 58.5 kB
Release files / ai_spend_tracker-0.2.2.tar.gz
| Download URL | ai_spend_tracker-0.2.2.tar.gz |
|---|---|
| Size | 24.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b9bf91916648160b8c009cd4ce83c569372af9da812905fff649047823822f97
|
|
BLAKE2b-256 checksum How to use checksums |
4e31d0a798318869fa188e91980285afd4938aac261f172ca2d2f7d2ac1b2f37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|
Release files / ai_spend_tracker-0.2.2-py3-none-any.whl
| Download URL | ai_spend_tracker-0.2.2-py3-none-any.whl |
|---|---|
| Size | 33.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
745af8cb6bc7b4beae8fb9243255f9f6b10ede7d8e7dbeb689ebac152e61d555
|
|
BLAKE2b-256 checksum How to use checksums |
ccfbbb864a65c02328565650e7328133f9cf959890c5297a92ebd925fe5e7d03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|