Why We Built a Token Budget Dashboard Before Our Next Copilot Invoice — And What It Caught

GitHub Copilot's token-based billing turned predictable seats into unbounded variable costs. A 12-line cron job + Claude Code usage API gives us daily projections and Slack alerts at $150/mo. We caught a $2,300 projected spike in week one.

Published 2026-06-09

Why We Built a Token Budget Dashboard Before Our Next Copilot Invoice — And What It Caught

TL;DR: Token-based billing for AI coding tools (Copilot AI Credits, Claude Code API, Cursor Ultra) makes costs unpredictable. A daily cron pulling claude-code usage --json + fixed-cost tools gives us a $140/mo projected baseline with Slack alerts at $150. Week one caught a misrouted Opus task projecting $2,300/mo. Dashboard script →

The Context

Two-dev team, ~120 hrs/mo AI coding. June 1, 2026: GitHub migrated Copilot Business to token-based “AI Credits” — no grandfathering, no caps. Our first projected invoice: $1,200/mo (was $38/mo). Simultaneously, Claude Code API usage was untracked. We had zero visibility into which tasks burned tokens and no way to set budgets. One developer accidentally ran an Opus-heavy refactor over a weekend; projected monthly hit $2,300. We built a dashboard that weekend.

What We Tested

ApproachToolVerdictWhy
GitHub Copilot billing pageCopilot BusinessShows historical only; no projections; no per-task breakdown
Cursor usage dashboardCursor Pro/Ultra⚠️Shows token count; no dollar projection; no alerting
Custom cron + CLI APIsclaude-code usage, ccost, manual CursorDaily $ projection; Slack alerts; per-model breakdown; 5-min setup
Third-party SaaS (e.g., TokenTrack)External dashboardAnother vendor; data leaves infra; $50+/mo for basics

The Pivot Point

June 7, 2026 (Sunday): Noticed claude-code usage --since 7d --by-model showed 18 Opus hours. At $15/hr (Opus API), that’s $270/week → $1,170/mo just for Opus. Root cause: a refactor task used cc-opus alias without --reason flag, so it defaulted to Opus for 4 hours. Fixed: added --reason requirement to cc-opus alias, moved task to Sonnet with better prompt. Next Monday: Opus hours dropped to 2. Projected monthly dropped from $2,300 to $140.

What We Use Now

Daily Cost Dashboard (cron 6 PM):

#!/bin/bash
# ~/.toolcrucible/cost-dashboard.sh
set -euo pipefail

# Claude Code — primary variable cost
CC_USAGE=$(claude-code usage --json --since "$(date +%Y-%m)-01" 2>/dev/null || echo '{}')
CC_PROJECTED=$(echo "$CC_USAGE" | jq -r '.projected_monthly_usd // 0')

# Fixed costs (known monthly)
CURSOR=20
CHATGPT_PLUS=20
TOTAL=$((CC_PROJECTED + CURSOR + CHATGPT_PLUS))

# Log
echo "[$(date -Iseconds)] CC_Proj: \$${CC_PROJECTED} | Total_Proj: \$${TOTAL}" >> ~/.toolcrucible/cost-log.csv

# Alert threshold
if [ "$TOTAL" -gt 150 ]; then
  curl -X POST "$SLACK_WEBHOOK" -d "payload={\"text\":\"💰 AI coding projected: \$${TOTAL}/mo (CC: \$${CC_PROJECTED})\"}"
fi

Weekly Review (Mon 9am):

  1. claude-code usage --since 7d --by-model → Opus hours × $15
  2. If Opus > $30/wk: audit --reason flags in shell history
  3. Check Cursor Ultra vs Pro — downgrade if Composer not used
  4. Update routing protocol aliases if misroutes detected

Per-Task Cost Awareness (built into aliases):

# ~/.zshrc
alias cc='claude-code --model sonnet'
alias cc-opus='claude-code --model opus --reason'  # Forces reason flag
alias cx='codex'                                    # Free tier sufficient
alias cursor='cursor'                               # Fixed $20/mo

When You’d Choose Differently

  • Enterprise with negotiated pricing: If you have committed spend discounts, per-token tracking matters less; focus on usage optimization instead.
  • Single-tool teams: If you only use Cursor or only Copilot, their native dashboards may suffice (Cursor shows tokens; Copilot shows credits).
  • No CLI comfort: SaaS dashboards (TokenTrack, etc.) trade data sovereignty for UI. Acceptable if team won’t maintain cron.
  • Local-only / air-gapped: Ollama + Aider + local token counters (self-hosted Prometheus/Grafana).

Tool Crucible Rating

DimensionRating (1–5)Notes
Overall512-line script > $50/mo SaaS; caught $2,300 leak in week 1
Ease of Use4Requires CLI comfort + cron; 15-min setup
Value5Prevents unbounded variable cost; pays for itself hourly
SupportN/AInternal tool; evolves with pricing changes

This is part of our AI Coding Tool Evaluation series. See full comparison: Token-Based Billing Survival Guide for Developers 2026

Last reviewed 2026-06-09. See our methodology and affiliate policy.