This is the bug that turned a $400 month into a $400,000 alert.
The rate is quoted as "$15 per 1,000,000 tokens." Someone wrote the formula dividing by 1000 instead of 1,000,000 — inflating the bill by 1000×. In a feature that runs at scale, this gets caught when the credit card alert fires at 3am, not when the test suite passes.
Fix the divisors so the math works in per-million units.
Expected output:
cost: $0.036
The break is on line 9 — but read the whole snippet first.