Aggregate AI API costs across providers into a single CLI dashboard
Project description
ai-spend
Your AI bills, in your terminal. No proxies. No dashboards. No SDK changes.
ai-spend pulls usage data directly from Anthropic and OpenAI's official billing APIs and displays it in your terminal. Your API keys stay on your machine. Your prompts are never seen.
$ ai-spend summary
Provider This Month vs Last Month
─────────────────────────────────────────
Anthropic $47.23 +12%
OpenAI $31.88 -4%
─────────────────────────────────────────
Total $79.11
Top models:
claude-opus-4-6 $31.44 (67% of Anthropic)
gpt-4.1 $18.22 (57% of OpenAI)
$ ai-spend daily --last 7
Date Anthropic OpenAI Total
──────────────────────────────────────────
2026-02-28 $8.12 $4.33 $12.45
2026-02-27 $6.88 $5.11 $11.99
...
How It's Different
Unlike gateway-based trackers, ai-spend never sees your prompts. It reads token counts and costs from your provider's billing API — the same data that appears on your invoice. Nothing more.
| Reads billing API directly | No proxy/SDK | Prompts stay local | CLI-native | |
|---|---|---|---|---|
| ai-spend | Yes | Yes | Yes | Yes |
| Langfuse | No (intercepts calls) | No | No | No |
| Helicone | No (proxy) | No | No | No |
| OpenAI dashboard | Yes | Yes | Yes | No (web only) |
Install
pip install ai-spend
Quick Start
# Add your providers (keys stored locally with 0600 perms)
ai-spend config add anthropic
ai-spend config add openai
# Pull latest usage data
ai-spend sync
# See your spend
ai-spend summary
ai-spend daily --last 30
Usage
# Provider management
ai-spend config add <provider> # Add a provider (anthropic, openai)
ai-spend config remove <provider> # Remove a provider
ai-spend config list # List configured providers
# Sync usage data from provider APIs
ai-spend sync
# View spend
ai-spend summary # Aggregated totals
ai-spend summary --json # JSON output
ai-spend daily # Daily breakdown
ai-spend daily --last 7 # Last 7 days
# Budgets
ai-spend budget set 100 # Set monthly budget ($100)
ai-spend budget check # Check against budget
# Manual entries (for providers without billing APIs)
ai-spend manual add 12.50 --provider ollama --note "local GPU costs"
# Export (Pro)
ai-spend export --format csv
ai-spend export --format json
# Status
ai-spend status # License tier + system info
How It Works
Provider APIs ──→ ai-spend sync ──→ Local SQLite
(Anthropic) (~/.ai-spend/spend.db)
(OpenAI) │
▼
ai-spend summary/daily/budget
- Configure — Add provider API keys (stored locally in
~/.ai-spend/config.yamlwith0600permissions) - Sync — Pulls usage records from official billing APIs into a local SQLite database
- Query — All read commands (
summary,daily,budget,export) hit the local database only
No background processes. No network calls except during sync. Run it in a cron job, pipe it into monitoring, or check it before standups.
Free vs Pro
| Feature | Free | Pro |
|---|---|---|
| Sync + summary + daily | Yes | Yes |
| Budget tracking | Yes | Yes |
| Manual entries | Yes | Yes |
| JSON output | Yes | Yes |
| CSV/JSON export | -- | Yes |
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-0.2.0.tar.gz.
File metadata
- Download URL: ai_spend-0.2.0.tar.gz
- Upload date:
- Size: 36.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26055292ee485ffea231291656bcb4fbc095e601a0e3a45ad00b735ef4280f82
|
|
| MD5 |
68ebad9f198c417426bd3a0f0633fd01
|
|
| BLAKE2b-256 |
aefb3c4f3eff92440ef87f9ccb403664636de1c7cd90edb6f9cc9d37525be611
|
Provenance
The following attestation bundles were made for ai_spend-0.2.0.tar.gz:
Publisher:
release.yml on AreteDriver/ai-spend
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_spend-0.2.0.tar.gz -
Subject digest:
26055292ee485ffea231291656bcb4fbc095e601a0e3a45ad00b735ef4280f82 - Sigstore transparency entry: 1061553868
- Sigstore integration time:
-
Permalink:
AreteDriver/ai-spend@adee9dd32cdadf8723dee1c0bd924b87de141a04 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/AreteDriver
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@adee9dd32cdadf8723dee1c0bd924b87de141a04 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ai_spend-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ai_spend-0.2.0-py3-none-any.whl
- Upload date:
- Size: 25.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ab1c3636acab72eda2576162a9a51d28d1667367e6f0e637de7ba51542e977b
|
|
| MD5 |
9aec6f0f77167274496d5cc2191b0c56
|
|
| BLAKE2b-256 |
a5eae4b26fd7e0b7b07da91092233e9c0988a7f711144aada934eae724168678
|
Provenance
The following attestation bundles were made for ai_spend-0.2.0-py3-none-any.whl:
Publisher:
release.yml on AreteDriver/ai-spend
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_spend-0.2.0-py3-none-any.whl -
Subject digest:
0ab1c3636acab72eda2576162a9a51d28d1667367e6f0e637de7ba51542e977b - Sigstore transparency entry: 1061553869
- Sigstore integration time:
-
Permalink:
AreteDriver/ai-spend@adee9dd32cdadf8723dee1c0bd924b87de141a04 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/AreteDriver
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@adee9dd32cdadf8723dee1c0bd924b87de141a04 -
Trigger Event:
push
-
Statement type: