{"skill":{"slug":"token-books","displayName":"TokenBooks Cross-Provider AI Spend Dashboard","summary":"See where your AI money goes. Track spending across OpenAI, Anthropic, Google, and more. Per-provider breakdowns, per-model costs, budget tracking, waste det...","description":"---\nname: \"TokenBooks Cross-Provider AI Spend Dashboard\"\ndescription: \"See where your AI money goes. Track spending across OpenAI, Anthropic, Google, and more. Per-provider breakdowns, per-model costs, budget tracking, waste detection.\"\nauthor: \"@TheShadowRose\"\nversion: \"1.0.0\"\ntags: [\"spending\", \"dashboard\", \"analytics\", \"budget\", \"multi-provider\", \"cost-tracking\"]\nlicense: \"MIT\"\n---\n\n# TokenBooks Cross-Provider AI Spend Dashboard\n\nSee where your AI money goes. Track spending across OpenAI, Anthropic, Google, and more. Per-provider breakdowns, per-model costs, budget tracking, waste detection.\n\n---\n\n**See where your AI money goes. Track spending across OpenAI, Anthropic, Google, and more. Find waste. Stay under budget.**\n\nTokenBooks 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.\n\n---\n\n## The Problem\n\nYou use OpenAI for coding, Anthropic for research, Google for experiments. Each has its own billing dashboard. You have no idea:\n- How much you're spending **total** across all providers\n- Which models are eating your budget\n- Whether you're on track for your monthly limit\n- If you're using expensive models for simple tasks\n\nManually exporting CSVs and combining them in Excel is tedious and error-prone.\n\n## What TokenBooks Does\n\n### Unified Dashboard\n- Import from OpenAI (CSV), Anthropic (JSON), Google Cloud, or custom formats\n- See total spending across all providers in one place\n- Per-provider, per-model, per-task breakdowns\n- Visual HTML reports with CSS-based charts (zero JavaScript)\n\n### Budget Tracking\n- Set monthly budgets\n- See remaining balance and utilization percentage\n- Alerts when you hit 80% or 95%\n\n### Waste Detection\n- Identify expensive models used for simple tasks\n- Calculate cost-per-1k-tokens for each model\n- Suggest cheaper alternatives\n\n### Time Series Analysis\n- Daily, weekly, or monthly spending trends\n- See when costs spiked\n- Compare this month vs. last month\n\n### Task-Level Tracking\n- Tag API calls with task names (\"code_review\", \"documentation\", etc.)\n- See which tasks cost the most\n- Optimize task-to-model assignments\n\n---\n\n## Quick Start\n\n```bash\n# 1. Import billing data\npython3 token_import.py openai_billing.csv --provider openai --output data.json\n\n# 2. Analyze spending\npython3 token_books.py data.json --budget 100\n\n# 3. Generate HTML dashboard\npython3 token_report.py data.json --output dashboard.html --budget 100\n```\n\nOpen `dashboard.html` in a browser to see:\n- Total spend and token usage\n- Provider and model breakdowns\n- Daily spending trend (last 30 days)\n- Budget status\n- Waste detection alerts\n\n---\n\n## Usage Guide\n\n### Import Data\n\n**From OpenAI:**\n```bash\n# Download CSV from OpenAI usage dashboard\npython3 token_import.py openai_usage.csv --provider openai --output data.json\n```\n\n**From Anthropic:**\n```bash\n# Download JSON from Anthropic console\npython3 token_import.py anthropic_usage.json --provider anthropic --output data.json\n```\n\n**From Custom CSV:**\n```bash\n# Provide column mapping\npython3 token_import.py my_billing.csv --provider custom --column-map mapping.json --output data.json\n```\n\n**Column mapping format (mapping.json):**\n```json\n{\n  \"timestamp\": \"Date\",\n  \"provider\": \"API_Provider\",\n  \"model\": \"Model_Name\",\n  \"input_tokens\": \"Prompt_Tokens\",\n  \"output_tokens\": \"Response_Tokens\",\n  \"cost\": \"Cost_USD\"\n}\n```\n\n### Analyze Spending\n\n```bash\n# Basic analysis\npython3 token_books.py data.json\n\n# With budget tracking\npython3 token_books.py data.json --budget 100\n\n# JSON output for scripting\npython3 token_books.py data.json --output json > analysis.json\n```\n\n### Generate Dashboard\n\n```bash\n# Generate HTML dashboard\npython3 token_report.py data.json --output dashboard.html\n\n# With budget status\npython3 token_report.py data.json --output dashboard.html --budget 100\n```\n\n---\n\n## Use Cases\n\n### 1. **Multi-Provider Cost Tracking**\nYou use OpenAI, Anthropic, and Google. Import all billing data into TokenBooks, see total spend in one place.\n\n### 2. **Budget Enforcement**\nSet a $100/month budget. TokenBooks tells you when you've spent $80 (warning) or $95 (critical). Avoid surprise bills.\n\n### 3. **Model Optimization**\nSee 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.\n\n### 4. **Task Cost Allocation**\nTag API calls with task names. See that \"code_review\" costs $30/month while \"documentation\" costs $5. Optimize accordingly.\n\n### 5. **Team Reporting**\nGenerate monthly HTML dashboards for your team. Share spending trends and optimization opportunities.\n\n### 6. **Vendor Comparison**\nCompare costs across providers for similar workloads. Maybe Anthropic is cheaper for your use case than OpenAI.\n\n---\n\n## What Gets Tracked\n\n### Per-Provider\n- Total cost\n- Total tokens (input + output)\n- Request count\n\n### Per-Model\n- Total cost\n- Token usage\n- Request count\n- Cost per 1k tokens\n\n### Per-Task\n- Total cost (if you tag API calls)\n- Token usage\n- Request count\n\n### Time Series\n- Daily, weekly, or monthly trends\n- Spot spending spikes\n- Compare periods\n\n### Waste Detection\n- Models with high cost-per-token ratios\n- Suggestions for cheaper alternatives\n- Identify over-provisioned tasks\n\n---\n\n## Configuration\n\nSee `config_example.json` for reference constants and example values\n\n```python\n# Set monthly budget\nMONTHLY_BUDGET = 100.0\n\n# Update pricing for accurate cost calculation\nMODEL_PRICING = {\n    'gpt-4': {'input': 30.0, 'output': 60.0},\n    'claude-3-opus': {'input': 15.0, 'output': 75.0},\n}\n\n# Budget alert thresholds\nALERT_THRESHOLDS = {\n    'warning': 80,  # 80% utilization\n    'critical': 95  # 95% utilization\n}\n\n# Waste detection threshold\nWASTE_THRESHOLD = 0.10  # $0.10 per 1k tokens\n\n# Number of top models to show\nTOP_MODELS_LIMIT = 10\n```\n\nSee `config_example.json` for full options.\n\n---\n\n## Examples\n\n### Example 1: Monthly Budget Tracking\n\n```bash\n# Import January data\npython3 token_import.py openai_jan.csv --provider openai --output jan.json\n\n# Check budget status\npython3 token_books.py jan.json --budget 100\n\n# Output:\n# Total cost: $87.42\n# 📊 Budget Analysis:\n#   Monthly budget: $100.00\n#   Spent this month: $87.42\n#   Remaining: $12.58\n#   Utilization: 87.4%\n```\n\n### Example 2: Waste Detection\n\n```bash\npython3 token_books.py data.json\n\n# Output:\n# 💡 Potential Waste Detected:\n#   gpt-4: $45.23 (127 requests)\n#     → Consider using a cheaper model for simple tasks\n```\n\n### Example 3: Multi-Provider Dashboard\n\n```bash\n# Import from multiple providers\npython3 token_import.py openai.csv --provider openai --output combined.json\npython3 token_import.py anthropic.json --provider anthropic --output temp.json\n\n# Merge manually or import again (appends)\n# ... (or use custom tooling to merge JSON files)\n\n# Generate unified dashboard\npython3 token_report.py combined.json --output dashboard.html\n```\n\n---\n\n## What's Included\n\n| File | Purpose |\n|------|---------|\n| `token_books.py` | Main aggregation engine (CLI + library) |\n| `token_import.py` | Import parsers for OpenAI, Anthropic, custom CSV |\n| `token_report.py` | HTML dashboard generator |\n| `config_example.json` | Configuration template |\n| `README.md` | This file |\n| `LIMITATIONS.md` | What it doesn't do |\n| `LICENSE` | MIT License |\n\n---\n\n## Requirements\n\n- Python 3.7+\n- **Zero external dependencies** (stdlib only)\n- Works on Linux, macOS, Windows\n\n---\n\n## Python API\n\nUse TokenBooks in your own scripts:\n\n```python\nfrom token_import import ImportManager, UsageRecord\nfrom token_books import CostAggregator\nfrom token_report import DashboardGenerator\n\n# Import data\nmanager = ImportManager()\nmanager.import_openai('openai.csv')\nrecords = manager.get_all_records()\n\n# Analyze\naggregator = CostAggregator(records)\n\nprint(f\"Total cost: ${aggregator.get_total_cost():.2f}\")\nprint(f\"Total tokens: {aggregator.get_total_tokens():,}\")\n\n# By provider\nby_provider = aggregator.by_provider()\nfor provider, breakdown in by_provider.items():\n    print(f\"{provider}: ${breakdown.total_cost:.2f}\")\n\n# Generate dashboard\nhtml = DashboardGenerator.generate(records, monthly_budget=100.0)\nwith open('dashboard.html', 'w') as f:\n    f.write(html)\n```\n\n---\n\n## quality-verified\n\n\n---\n\n## FAQ\n\n**Q: Does it work with Google Cloud billing?**  \nA: Not directly. Google Cloud billing CSVs can be imported via custom CSV parser with column mapping. See config_example.json for mapping format.\n\n**Q: Can it track API calls in real-time?**  \nA: No. TokenBooks analyzes exported billing data, not live API usage. Export from your provider, then import.\n\n**Q: Does it send data anywhere?**  \nA: **No.** Everything runs locally. Zero network calls.\n\n**Q: How do I tag API calls with task names?**  \nA: Add a \"task\" field to your billing exports. If your provider doesn't support this, manually add it to the CSV before importing.\n\n**Q: Can I combine multiple months of data?**  \nA: Yes. Import each month's data into the same JSON file, or merge JSON files manually.\n\n**Q: Does it support non-USD currencies?**  \nA: Not directly. Convert to USD before importing, or manually adjust cost values.\n\n---\n\n## License\n\nMIT — See `LICENSE` file.\n\n---\n\n## Author\n\n**Shadow Rose**\n\nBuilt for people who want to understand and control their AI spending without enterprise-grade analytics platforms.\n\n\n---\n\n## ⚠️ Disclaimer\n\nThis software is provided \"AS IS\", without warranty of any kind, express or implied.\n\n**USE AT YOUR OWN RISK.**\n\n- The author(s) are NOT liable for any damages, losses, or consequences arising from \n  the use or misuse of this software — including but not limited to financial loss, \n  data loss, security breaches, business interruption, or any indirect/consequential damages.\n- This software does NOT constitute financial, legal, trading, or professional advice.\n- Users are solely responsible for evaluating whether this software is suitable for \n  their use case, environment, and risk tolerance.\n- No guarantee is made regarding accuracy, reliability, completeness, or fitness \n  for any particular purpose.\n- The author(s) are not responsible for how third parties use, modify, or distribute \n  this software after purchase.\n\nBy downloading, installing, or using this software, you acknowledge that you have read \nthis disclaimer and agree to use the software entirely at your own risk.\n\n\n**TRADING DISCLAIMER:** This software is a tool, not a trading system. It does not \nmake trading decisions for you and does not guarantee profits. Trading cryptocurrency, \nstocks, or any financial instrument carries significant risk of loss. You can lose \nsome or all of your investment. Past performance of any system or methodology is not \nindicative of future results. Never trade with money you cannot afford to lose. \nConsult a qualified financial advisor before making investment decisions.\n---\n\n## Support & Links\n\n| | |\n|---|---|\n| 🐛 **Bug Reports** | TheShadowyRose@proton.me |\n| ☕ **Ko-fi** | [ko-fi.com/theshadowrose](https://ko-fi.com/theshadowrose) |\n| 🛒 **Gumroad** | [shadowyrose.gumroad.com](https://shadowyrose.gumroad.com) |\n| 🐦 **Twitter** | [@TheShadowyRose](https://twitter.com/TheShadowyRose) |\n| 🐙 **GitHub** | [github.com/TheShadowRose](https://github.com/TheShadowRose) |\n| 🧠 **PromptBase** | [promptbase.com/profile/shadowrose](https://promptbase.com/profile/shadowrose) |\n\n*Built with [OpenClaw](https://github.com/openclaw/openclaw) — thank you for making this possible.*\n\n---\n\n🛠️ **Need something custom?** Custom OpenClaw agents & skills starting at $500. If you can describe it, I can build it. → [Hire me on Fiverr](https://www.fiverr.com/s/jjmlZ0v)","topics":["Budget","Dashboard","Spending","Analytics","Cost Tracking"],"tags":{"analytics":"1.0.0","budget":"1.0.0","cost-tracking":"1.0.0","dashboard":"1.0.0","latest":"1.0.0","multi-provider":"1.0.0","spending":"1.0.0"},"stats":{"comments":0,"downloads":610,"installsAllTime":23,"installsCurrent":1,"stars":1,"versions":1},"createdAt":1773279010724,"updatedAt":1778491843876},"latestVersion":{"version":"1.0.0","createdAt":1773279010724,"changelog":"Initial upload","license":"MIT-0"},"metadata":{"setup":[],"os":null,"systems":null},"owner":{"handle":"theshadowrose","userId":"s1736mx5m1zt9qzh6fvzvffnhh83hgf8","displayName":"Shadow Rose","image":"https://avatars.githubusercontent.com/u/262919821?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1780089845257}}