Skip to main content

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.

AI Spend Tracker demo

📝 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

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

ai_spend_tracker-0.2.2.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

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

ai_spend_tracker-0.2.2-py3-none-any.whl (33.8 kB view details)

Uploaded Python 3

File details

Details for the file ai_spend_tracker-0.2.2.tar.gz.

File metadata

  • Download URL: ai_spend_tracker-0.2.2.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for ai_spend_tracker-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b9bf91916648160b8c009cd4ce83c569372af9da812905fff649047823822f97
MD5 56f2413b8f7b6cba6f453bf1ae2798f2
BLAKE2b-256 4e31d0a798318869fa188e91980285afd4938aac261f172ca2d2f7d2ac1b2f37

See more details on using hashes here.

File details

Details for the file ai_spend_tracker-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_spend_tracker-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 745af8cb6bc7b4beae8fb9243255f9f6b10ede7d8e7dbeb689ebac152e61d555
MD5 04ce91d1d5ab1e853c8eef2f40da03d3
BLAKE2b-256 ccfbbb864a65c02328565650e7328133f9cf959890c5297a92ebd925fe5e7d03

See more details on using hashes here.

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