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

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.1.tar.gz (24.5 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.1-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ai_spend_tracker-0.2.1.tar.gz
  • Upload date:
  • Size: 24.5 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.1.tar.gz
Algorithm Hash digest
SHA256 02ad12f33b934fd4b58864a3a3bab95aac693bfd6382634297bd95c990e08eec
MD5 1019fe808e04d706811757d396ab66db
BLAKE2b-256 5ef3c9c4c9e9ccd6120616958ed4a771084de7c15bd84cc475d6fbaa8175afeb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ai_spend_tracker-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fbee9279d8b8a20fdf83255449fb88050c34a5f3c56d5819bdb3ca9deec6a10d
MD5 2b29cbaa0453592b4bf833575f6d085d
BLAKE2b-256 53343fe267d8d6729095f48cb36522149e6c67ca26631e09272b02d27a27a7fa

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