TokenBooks Cross-Provider AI Spend Dashboard
by @theshadowrose
See where your AI money goes. Track spending across OpenAI, Anthropic, Google, and more. Per-provider breakdowns, per-model costs, budget tracking, waste det...
clawhub install token-booksπ About This Skill
name: "TokenBooks Cross-Provider AI Spend Dashboard" description: "See where your AI money goes. Track spending across OpenAI, Anthropic, Google, and more. Per-provider breakdowns, per-model costs, budget tracking, waste detection." author: "@TheShadowRose" version: "1.0.0" tags: ["spending", "dashboard", "analytics", "budget", "multi-provider", "cost-tracking"] license: "MIT"
TokenBooks Cross-Provider AI Spend Dashboard
See where your AI money goes. Track spending across OpenAI, Anthropic, Google, and more. Per-provider breakdowns, per-model costs, budget tracking, waste detection.
See where your AI money goes. Track spending across OpenAI, Anthropic, Google, and more. Find waste. Stay under budget.
TokenBooks imports billing data from multiple AI providers, aggregates everything into one view, and shows you exactly where every dollar went. Per-provider breakdowns, per-model costs, time series trends, budget tracking, and waste detection β all in one tool, all local, zero cloud dependencies.
The Problem
You use OpenAI for coding, Anthropic for research, Google for experiments. Each has its own billing dashboard. You have no idea:
Manually exporting CSVs and combining them in Excel is tedious and error-prone.
What TokenBooks Does
Unified Dashboard
Budget Tracking
Waste Detection
Time Series Analysis
Task-Level Tracking
Quick Start
# 1. Import billing data
python3 token_import.py openai_billing.csv --provider openai --output data.json2. Analyze spending
python3 token_books.py data.json --budget 1003. Generate HTML dashboard
python3 token_report.py data.json --output dashboard.html --budget 100
Open dashboard.html in a browser to see:
Usage Guide
Import Data
From OpenAI:
# Download CSV from OpenAI usage dashboard
python3 token_import.py openai_usage.csv --provider openai --output data.json
From Anthropic:
# Download JSON from Anthropic console
python3 token_import.py anthropic_usage.json --provider anthropic --output data.json
From Custom CSV:
# Provide column mapping
python3 token_import.py my_billing.csv --provider custom --column-map mapping.json --output data.json
Column mapping format (mapping.json):
{
"timestamp": "Date",
"provider": "API_Provider",
"model": "Model_Name",
"input_tokens": "Prompt_Tokens",
"output_tokens": "Response_Tokens",
"cost": "Cost_USD"
}
Analyze Spending
# Basic analysis
python3 token_books.py data.jsonWith budget tracking
python3 token_books.py data.json --budget 100JSON output for scripting
python3 token_books.py data.json --output json > analysis.json
Generate Dashboard
# Generate HTML dashboard
python3 token_report.py data.json --output dashboard.htmlWith budget status
python3 token_report.py data.json --output dashboard.html --budget 100
Use Cases
1. Multi-Provider Cost Tracking
You use OpenAI, Anthropic, and Google. Import all billing data into TokenBooks, see total spend in one place.2. Budget Enforcement
Set a $100/month budget. TokenBooks tells you when you've spent $80 (warning) or $95 (critical). Avoid surprise bills.3. Model Optimization
See which models cost the most. If GPT-4 is 80% of your spend but only used for simple tasks, switch to GPT-3.5 Turbo.4. Task Cost Allocation
Tag API calls with task names. See that "code_review" costs $30/month while "documentation" costs $5. Optimize accordingly.5. Team Reporting
Generate monthly HTML dashboards for your team. Share spending trends and optimization opportunities.6. Vendor Comparison
Compare costs across providers for similar workloads. Maybe Anthropic is cheaper for your use case than OpenAI.What Gets Tracked
Per-Provider
Per-Model
Per-Task
Time Series
Waste Detection
Configuration
See config_example.json for reference constants and example values
# Set monthly budget
MONTHLY_BUDGET = 100.0Update pricing for accurate cost calculation
MODEL_PRICING = {
'gpt-4': {'input': 30.0, 'output': 60.0},
'claude-3-opus': {'input': 15.0, 'output': 75.0},
}Budget alert thresholds
ALERT_THRESHOLDS = {
'warning': 80, # 80% utilization
'critical': 95 # 95% utilization
}Waste detection threshold
WASTE_THRESHOLD = 0.10 # $0.10 per 1k tokensNumber of top models to show
TOP_MODELS_LIMIT = 10
See config_example.json for full options.
Examples
Example 1: Monthly Budget Tracking
# Import January data
python3 token_import.py openai_jan.csv --provider openai --output jan.jsonCheck budget status
python3 token_books.py jan.json --budget 100Output:
Total cost: $87.42
π Budget Analysis:
Monthly budget: $100.00
Spent this month: $87.42
Remaining: $12.58
Utilization: 87.4%
Example 2: Waste Detection
python3 token_books.py data.jsonOutput:
π‘ Potential Waste Detected:
gpt-4: $45.23 (127 requests)
β Consider using a cheaper model for simple tasks
Example 3: Multi-Provider Dashboard
# Import from multiple providers
python3 token_import.py openai.csv --provider openai --output combined.json
python3 token_import.py anthropic.json --provider anthropic --output temp.jsonMerge manually or import again (appends)
... (or use custom tooling to merge JSON files)
Generate unified dashboard
python3 token_report.py combined.json --output dashboard.html
What's Included
| File | Purpose |
|------|---------|
| token_books.py | Main aggregation engine (CLI + library) |
| token_import.py | Import parsers for OpenAI, Anthropic, custom CSV |
| token_report.py | HTML dashboard generator |
| config_example.json | Configuration template |
| README.md | This file |
| LIMITATIONS.md | What it doesn't do |
| LICENSE | MIT License |
Requirements
Python API
Use TokenBooks in your own scripts:
from token_import import ImportManager, UsageRecord
from token_books import CostAggregator
from token_report import DashboardGeneratorImport data
manager = ImportManager()
manager.import_openai('openai.csv')
records = manager.get_all_records()Analyze
aggregator = CostAggregator(records)print(f"Total cost: ${aggregator.get_total_cost():.2f}")
print(f"Total tokens: {aggregator.get_total_tokens():,}")
By provider
by_provider = aggregator.by_provider()
for provider, breakdown in by_provider.items():
print(f"{provider}: ${breakdown.total_cost:.2f}")Generate dashboard
html = DashboardGenerator.generate(records, monthly_budget=100.0)
with open('dashboard.html', 'w') as f:
f.write(html)
quality-verified
FAQ
Q: Does it work with Google Cloud billing? A: Not directly. Google Cloud billing CSVs can be imported via custom CSV parser with column mapping. See config_example.json for mapping format.
Q: Can it track API calls in real-time? A: No. TokenBooks analyzes exported billing data, not live API usage. Export from your provider, then import.
Q: Does it send data anywhere? A: No. Everything runs locally. Zero network calls.
Q: How do I tag API calls with task names? A: Add a "task" field to your billing exports. If your provider doesn't support this, manually add it to the CSV before importing.
Q: Can I combine multiple months of data? A: Yes. Import each month's data into the same JSON file, or merge JSON files manually.
Q: Does it support non-USD currencies? A: Not directly. Convert to USD before importing, or manually adjust cost values.
License
MIT β See LICENSE file.
Author
Shadow Rose
Built for people who want to understand and control their AI spending without enterprise-grade analytics platforms.
β οΈ Disclaimer
This software is provided "AS IS", without warranty of any kind, express or implied.
USE AT YOUR OWN RISK.
By downloading, installing, or using this software, you acknowledge that you have read this disclaimer and agree to use the software entirely at your own risk.
TRADING DISCLAIMER: This software is a tool, not a trading system. It does not make trading decisions for you and does not guarantee profits. Trading cryptocurrency, stocks, or any financial instrument carries significant risk of loss. You can lose some or all of your investment. Past performance of any system or methodology is not indicative of future results. Never trade with money you cannot afford to lose. Consult a qualified financial advisor before making investment decisions.
Support & Links
| | | |---|---| | π Bug Reports | TheShadowyRose@proton.me | | β Ko-fi | ko-fi.com/theshadowrose | | π Gumroad | shadowyrose.gumroad.com | | π¦ Twitter | @TheShadowyRose | | π GitHub | github.com/TheShadowRose | | π§ PromptBase | promptbase.com/profile/shadowrose |
*Built with OpenClaw β thank you for making this possible.*
π οΈ Need something custom? Custom OpenClaw agents & skills starting at $500. If you can describe it, I can build it. β Hire me on Fiverr
β‘ When to Use
π‘ Examples
Example 1: Monthly Budget Tracking
# Import January data
python3 token_import.py openai_jan.csv --provider openai --output jan.jsonCheck budget status
python3 token_books.py jan.json --budget 100Output:
Total cost: $87.42
π Budget Analysis:
Monthly budget: $100.00
Spent this month: $87.42
Remaining: $12.58
Utilization: 87.4%
Example 2: Waste Detection
python3 token_books.py data.jsonOutput:
π‘ Potential Waste Detected:
gpt-4: $45.23 (127 requests)
β Consider using a cheaper model for simple tasks
Example 3: Multi-Provider Dashboard
# Import from multiple providers
python3 token_import.py openai.csv --provider openai --output combined.json
python3 token_import.py anthropic.json --provider anthropic --output temp.jsonMerge manually or import again (appends)
... (or use custom tooling to merge JSON files)
Generate unified dashboard
python3 token_report.py combined.json --output dashboard.html
βοΈ Configuration
See config_example.json for reference constants and example values
# Set monthly budget
MONTHLY_BUDGET = 100.0Update pricing for accurate cost calculation
MODEL_PRICING = {
'gpt-4': {'input': 30.0, 'output': 60.0},
'claude-3-opus': {'input': 15.0, 'output': 75.0},
}Budget alert thresholds
ALERT_THRESHOLDS = {
'warning': 80, # 80% utilization
'critical': 95 # 95% utilization
}Waste detection threshold
WASTE_THRESHOLD = 0.10 # $0.10 per 1k tokensNumber of top models to show
TOP_MODELS_LIMIT = 10
See config_example.json for full options.
π Tips & Best Practices
Q: Does it work with Google Cloud billing? A: Not directly. Google Cloud billing CSVs can be imported via custom CSV parser with column mapping. See config_example.json for mapping format.
Q: Can it track API calls in real-time? A: No. TokenBooks analyzes exported billing data, not live API usage. Export from your provider, then import.
Q: Does it send data anywhere? A: No. Everything runs locally. Zero network calls.
Q: How do I tag API calls with task names? A: Add a "task" field to your billing exports. If your provider doesn't support this, manually add it to the CSV before importing.
Q: Can I combine multiple months of data? A: Yes. Import each month's data into the same JSON file, or merge JSON files manually.
Q: Does it support non-USD currencies? A: Not directly. Convert to USD before importing, or manually adjust cost values.