Aggregate token usage & cost across all your AI coding agents (Hermes, Codex, Claude Code, Copilot, OpenCode, OpenClaw, Kimi)
Project description
AI Spend Tracker
Aggregate token usage & cost across all your AI coding agents in one CLI.
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
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 ai_spend_tracker-0.2.0.tar.gz.
File metadata
- Download URL: ai_spend_tracker-0.2.0.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fb9ec719c4ee826f2543022c3fa980a179e78bdf70d7ca5bb84e4396e01e2f0
|
|
| MD5 |
419ebe2adc5d954aea682c2c525495b9
|
|
| BLAKE2b-256 |
d27edfe5a43f31f39b17a30edec92a219ab8b13a228f106d5dc674d8670e0d66
|
File details
Details for the file ai_spend_tracker-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ai_spend_tracker-0.2.0-py3-none-any.whl
- Upload date:
- Size: 33.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4062f3bd8ece2e4af7cf19365ae2df6b7dbcb68a1bd00903599d1d602f492f7e
|
|
| MD5 |
298e655bb9b8e58d9ed725f378720c6b
|
|
| BLAKE2b-256 |
e9ed458a38a22be927c8de882e978a4e8e12ef3164bf52d2df72ef9e82462aa1
|