cost-tracker
Installation
SKILL.md
API Cost & Expense Tracking
Critical
- MANDATORY per CLAUDE.md — Every API generation MUST log its cost. No exceptions, every session, forever.
trackExpense()is the canonical function — call after each Kling/Suno/Nano/Gemini/Resend API call.- Worker-side tracker implemented at
apps/worker/src/services/expense-tracker.ts(raw SQL, non-blocking). - Wired into video-pipeline.worker.ts — tracks Gemini (floorplan, prompts, vision), Nano Banana (opening/closing), Kling (per-clip), Suno (music), R2 (final uploads).
- Session cost tables must be added to Aitable Tasks table before closing any session.
- Anomaly detection flags days where spend >2x the rolling 7-day average.