Local-first AI cost tracker. A reverse proxy that sits between your AI agents and their API provider, intercepts every call, and logs model/token/cost to a local SQLite DB. Comes with a live TUI dashboard and archetype-based routing suggestions.
Token economy > lines of code. TAP lets you see where your AI spend actually goes.
If you use terminal agents (Hermes, Claude Code, Codex) daily, you've felt it: the creeping uncertainty of "how much is this costing me?"
TAP is your AI accountant. It:
- Ingests real usage from where each agent already writes it — Claude Code's per-session JSONL transcripts, Codex's rollout logs, and a local proxy (
localhost:9999) for Hermes/OpenRouter traffic - Logs model, tokens, cost, and prompt archetype to SQLite
- Analyzes your usage patterns — which models burn cash, which tasks use which models
- Suggests cheaper routing before you run your next prompt
It's local-first. Your data never leaves your machine.
Claude Code and Codex run on subscription plans, not per-token billing — their proxy path only sees traffic if you explicitly reroute it. TAP instead tails the session logs those tools already write, using their authoritative token counts. Cost shown for them is notional (what it'd cost at API list price), not your actual subscription bill.
pip install tap-ai
# Backfill existing agent logs
tap backfill
# See where your money went
tap report
# Get routing advice for a task
tap suggest "refactor dead code and add tests"
# → sweeper + grower → flash + pro
# Launch the live TUI dashboard
tap dashboard
# Start the intercept proxy (for real-time tracking)
tap start &
ANTHROPIC_BASE_URL=http://localhost:9999/v1 claude| Command | Description |
|---|---|
tap backfill |
Import agent logs (Hermes, Claude Code, Codex) |
tap report |
Cost report — tables + insights |
tap suggest "<task>" |
Classify task, recommend cheapest adequate model |
tap dashboard |
Live TUI dashboard (Ctrl+C to exit) |
tap start |
Start intercept proxy on localhost:9999 |
tap help |
Show all commands |
Every prompt is classified into one of six archetypes. Each gets a model recommendation, so you're never burning Opus money on a brainstorming session:
| Archetype | Recommended | Signal |
|---|---|---|
| prototyper | flash ($0.09/M) | idea, brainstorm, mvp, sketch |
| sweeper | flash | clean, refactor, delete, remove |
| orchestrator | flash | kanban, status, "nerede kaldık" |
| builder | pro ($0.44/M) | implement, api, component, function |
| grower | pro | improve, test, analyze, research |
| maintainer | pro | upgrade, migrate, bug fix |
The cost difference is real: one Kimi session ($0.74 avg) buys four flash sessions ($0.17 avg). TAP shows you exactly where the waste is.
Point any agent's base URL to TAP:
tap start &
HERMES_OPENAI_BASE_URL=http://localhost:9999/v1 # for OpenAI-compatible
ANTHROPIC_BASE_URL=http://localhost:9999/v1 # for AnthropicTAP logs every request and forwards it upstream. No latency overhead, no data leakage.
╭──────────────────── 🎯 TAP Report ─────────────────────╮
│ Sessions 822 Tokens 80.2M Est. Cost $44.90 │
╰────────────────────────────────────────────────────────╯
Per-Model:
deepseek/deepseek-v4-flash 119 sess 68.6M tok $19.17
gpt-5.5 146 sess 200K tok $7.88
kimi-k2.7-code 11 sess 2.6M tok $6.50
claude-sonnet-4 509 sess 314K tok $4.63
💡 Insights:
⚠️ Overkill: kimi on simple task → use flash, save ~$0.53
📁 Top project: letterboxd_wrapped = $12.83 (29% of total)
ℹ️ Unclassified: 595 sessions (72%) — expand keyword maps
┌──────────┐ ┌──────────┐ ┌───────────┐
│ Agent │────▶│ TAP │────▶│ Provider │
│(Hermes, │ │ Proxy │ │(OpenRouter│
│ Claude, │ │:9999 │ │ Anthropic)│
│ Codex) │ └────┬─────┘ └───────────┘
└──────────┘ │
▼
┌──────────┐
│ SQLite │
│ state.db │
└──────────┘
Terminalde AI asistan kullanıyor musun? Workflow'un nasıl?
🖥️ Evet, CLI asistan benim ana aracım — memory/RAG sistemim de var ⚡ Evet ama basit kullanıyorum 🧩 IDE içinde (VS Code, Cursor vb.) ❌ Hayır, kullanmıyorum
Emoji bırakarak oy ver 👆
MIT
Built because the only thing worse than not knowing your AI spend is finding out at the end of the month.