Why We Built a Daily Spend Dashboard After Token-Based Billing Broke Our Budget — And the Hard Cap We Now Enforce

Copilot's token credits and Claude Code's credit pool both meter usage differently. We built a unified CLI tracker (`ccost`) that alerts at 80% of any budget — Copilot credits, Claude pool, or direct API — so the next invoice never surprises us.

Published 2026-06-15

Why We Built a Daily Spend Dashboard After Token-Based Billing Broke Our Budget — And the Hard Cap We Now Enforce

TL;DR: Three tools, three billing models (Copilot AI Credits, Claude Code credit pool, Anthropic API direct). We built ccost — a unified CLI that normalizes all three into daily USD burn rate and fires Slack alerts at 80% of budget. May 2026: $287 actual. June projection without tracker: $600+. With tracker: $139 controlled. Tracker source →

The Context

Two-dev team. May 2026 stack: Copilot Business ($19/seat) + Anthropic API direct for Opus ($249). June 1: Copilot switches to token-based “AI Credits” (agentic workflows = 10–50x credit burn). June 15: Claude Code credit pool launches ($100/mo for ~100 credits/day Sonnet-equivalent). Three different token economies, zero unified visibility.

What We Tested

ApproachCoverageVerdictWhy
Copilot dashboard onlyCopilot onlyNo API or Claude Code visibility
Anthropic Console onlyAPI onlyNo Copilot or Claude Code pool visibility
Custom ccost CLIAll threeNormalizes credits → USD; daily alert at 80% budget
token-tracker (community)Copilot + API⚠️No Claude Code pool support; unmaintained

The Pivot Point

June 3, 2026: Copilot invoice projection $412 (vs $38 prior month). Same week: Claude Code credit pool announced. Realized we had no way to answer “what’s our total AI spend today?” Built ccost that weekend. First alert fired June 10: “⚠️ Copilot credits: 3,840/5,000 (77%). Review agentic usage.” Caught a runaway Composer session before it hit budget.

What We Use Now

ccost CLI (~/.local/bin/ccost, in shared dotfiles):

#!/bin/bash
# ccost — unified AI coding spend tracker
# Usage: ccost --budget=500 --alert=80

BUDGET=${1:-500}  # monthly USD cap
ALERT_PCT=${2:-80}

# Copilot: gh api /orgs/{org}/copilot/usage -> credits_used * $0.02/credit (approx)
COPILOT_CREDITS=$(gh api /orgs/basso-digital/copilot/usage --jq '.total_credits_used // 0')
COPILOT_USD=$(echo "$COPILOT_CREDITS * 0.02" | bc -l)

# Claude Code: claude-code usage --json -> credits_used * $0.05/credit (pool rate)
CLAUDE_USAGE=$(claude-code usage --json --since "1 month ago")
CLAUDE_CREDITS=$(echo "$CLAUDE_USAGE" | jq '.credits_used // 0')
CLAUDE_USD=$(echo "$CLAUDE_CREDITS * 0.05" | bc -l)

# Anthropic API: direct from console (manual entry or API if available)
API_USD=${ANTHROPIC_API_USD:-0}

TOTAL=$(echo "$COPILOT_USD + $CLAUDE_USD + $API_USD" | bc -l)
ALERT_THRESHOLD=$(echo "$BUDGET * $ALERT_PCT / 100" | bc -l)

echo "📊 AI Coding Spend (MTD)"
echo "  Copilot:  $COPILOT_CREDITS credits  ~\$${COPILOT_USD}"
echo "  Claude:   $CLAUDE_CREDITS credits   ~\$${CLAUDE_USD}"
echo "  API:      ~\$${API_USD}"
echo "  TOTAL:    ~\$${TOTAL} / \$$BUDGET"

# Daily cron also checks:
DAILY_CLAUDE=$(claude-code usage --json --since yesterday | jq '.credits_used // 0')
if [ "$DAILY_CLAUDE" -gt 85 ]; then  # 85% of 100 pool
  slack-post "#dev-alerts" "⚠️ Claude Code daily pool: $DAILY_CLAUDE/100 credits. Opus flag review needed."
fi

# Alert logic
if (( $(echo "$TOTAL > $ALERT_THRESHOLD" | bc -l) )); then
  slack-post "#dev-alerts" "🚨 AI spend at \$$TOTAL (${ALERT_PCT}% of \$$BUDGET budget). Audit needed."
fi

Cron (runs 5pm daily + 10am daily pool check):

0 17 * * * ccost --budget=500 --alert=80 >> ~/.ccost.log 2>&1
0 10 * * * claude-code usage --json --since yesterday | jq '.credits_used' | xargs -I{} bash -c 'if [ {} -gt 85 ]; then slack-post "#dev-alerts" "⚠️ Claude pool: {}/100"; fi'

Team Protocol:

  • Monthly budget: $500 (covers all three)
  • Alert at 80% ($400) → mandatory usage audit
  • Opus usage requires --reason "auth|infra|payments" flag (logged)
  • Copilot agentic workflows → migrate to Cursor/Claude Code

When You’d Choose Differently

  • Single-tool shops: Native dashboards suffice (Copilot org view, Anthropic Console).
  • Enterprise with FinOps team: Vendor APIs (Copilot, Anthropic) feed into centralized cost management.
  • Light users (<$50/mo): Manual monthly check fine; tracker overhead not worth it.

Tool Crucible Rating

DimensionRating (1–5)Notes
Overall4Solved a real multi-vendor blind spot
Ease of Use3CLI + cron setup; not plug-and-play
Value5Prevented 2+ budget overruns in month 1
Support2Internal tool; community token-tracker abandoned

This is part of our AI Coding Tool Evaluation series. See tracker source: ccost: Unified AI Coding Spend CLI

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