A local-first terminal dashboard for AI coding tool spend
Project description
spendtop
A local-first terminal dashboard that shows what your AI coding tools actually cost — and ties that spend to the code your team ships.
uvx spendtop
Local-first. Your keys. Nothing leaves your machine.
spendtop reads directly from Anthropic and OpenAI's admin APIs using credentials you provide, stores everything in a local SQLite cache (~/.local/share/spendtop/cache.db), and never phones home. No account, no SaaS, no telemetry.
Quick start
# 1. Install and run (no pip install needed if you have uv)
uvx spendtop
# 2. Connect your Anthropic admin key (stored in OS keyring, never on disk)
spendtop connect anthropic
# 3. Connect your OpenAI admin key
spendtop connect openai
# 4. Launch the dashboard (auto-pulls if cache is stale)
spendtop
Prefer environment variables? Set ANTHROPIC_ADMIN_KEY and OPENAI_ADMIN_KEY — spendtop will pick them up automatically, no keyring needed.
Note: These must be Admin keys, not regular API keys.
- Anthropic: Console → Settings → Admin Keys → Create (
sk-ant-admin01-…)- OpenAI: platform.openai.com → Organization → Admin API Keys (
sk-admin-…)
What you see
Three panels, always readable in a standard terminal:
| Panel | What it shows |
|---|---|
| Spend by tool | Horizontal bar chart — total cost per provider |
| Daily spend | Today's number + Unicode sparkline + 30-day projection |
| Model mix | Spend share by model, top 10 |
Keybinds: [r] refresh from API · [t] cycle timeframe (7 / 14 / 30 / 90 days) · [e] export to CSV · [q] quit
Pull without launching the TUI:
spendtop pull # last 30 days
spendtop pull --days 7 # last 7 days
Connectors
| Connector | Status | Env var |
|---|---|---|
| Anthropic | ✅ v0.1 | ANTHROPIC_ADMIN_KEY |
| OpenAI | ✅ v0.1 | OPENAI_ADMIN_KEY |
| Cursor | 🔜 v0.3 | — |
| GitHub Copilot | 🔜 v0.3 | — |
A broken or unconfigured connector shows ○ in the header and never crashes the dashboard — the other connectors keep running.
Adding a connector
Adding one is ~80 lines. Implement the SpendConnector ABC from src/spendtop/connectors/base.py:
class SpendConnector(ABC):
name: str
@abstractmethod
async def pull(self, since: datetime) -> list[SpendEvent]: ...
def status(self) -> Literal["ok", "disconnected", "unconfigured"]: ...
See src/spendtop/connectors/spend/anthropic.py for a complete reference implementation — it handles pagination, 401/429 errors, and merges two API endpoints into normalized SpendEvent objects.
PRs for new connectors are very welcome.
Coming in v0.2 — cost per merged PR
The number engineering managers actually want: $/merged PR per team, flagged against the org median. spendtop will join AI spend to your GitHub PR history and show which teams are getting the most (and least) out of their AI budget — without sending any code or PR data anywhere.
Requirements
- Python 3.12+
- macOS or Linux (Windows: OS keyring may need additional configuration)
- Admin API keys for the providers you want to track
License
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 spendtop-0.1.0.tar.gz.
File metadata
- Download URL: spendtop-0.1.0.tar.gz
- Upload date:
- Size: 64.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a537b78d40471f81c7989dd4529a90b25174ef101d066824a21c764b098b9c1
|
|
| MD5 |
5df981a9226ec61847aa9826e25d89c4
|
|
| BLAKE2b-256 |
d14f49b94b899045ec887ce3da3a9ac78743e08cd1c3a3030f11b330ed58deef
|
File details
Details for the file spendtop-0.1.0-py3-none-any.whl.
File metadata
- Download URL: spendtop-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
345b6ec7633c73980cad4eb83e82b0e2dcb71d2495b1a35f41bfea99d3b721f5
|
|
| MD5 |
4c097e9e86b4b478725bfd71448c7c49
|
|
| BLAKE2b-256 |
a407ed2c275191d32a5d4cd995a57bf77fa02310c5bee4f60e798fd986291678
|