The Token-Spend Toolkit is financial control for LLM usage across Claude and ChatGPT: one normalised data layer, seven focused tools over it, and a Monday-morning briefing that already contains the numbers and the recommended move, before the invoice arrives.

Teams buying Anthropic and OpenAI capacity share the same blind spot: the bill arrives after the fact, aggregated into consoles nobody watches. Usage sits in two shapes with no unified view, no forecast, no alerting, and no link from a number to an action.
The toolkit’s premise: financial control of LLM usage. Ingest normalises both providers into one canonical store; forecast flags over-pace clients mid-month; the anomaly detector separates genuine spikes from noise; the actions layer ranks what to do next with dollar impact attached. Catch a runaway loop in hours, not at invoice time.
Built under a governed delivery plan: seven milestones independently signed off, then an adversarial audit whose eight findings were fixed, re-gated and covered by new tests before v1 was signed.
Instrument Serif headlines, warm paper, a money-green-and-amber palette: the Command Centre looks like a beautifully typeset audit report, because that is what it is. A tour of what an operator actually sees.

Month-to-date spend, projection, budget consumption and anomalies lead the page. Every figure carries its period and its unit so a chart can never be read out of context, and money renders as $1,202.50 (£949.98): USD with a GBP reference sourced from the rate card, never a hardcoded constant.

Daily cost across providers and model families on one timeline. The palette is Okabe-Ito colour-blind safe and every series is also labelled in the legend, so meaning never rides on colour alone. Chart.js is pinned and integrity-locked with a Subresource Integrity hash.

Per-client budgets against month-to-date reality, with the projection extrapolated over each client's active days rather than the calendar, so a client that started on the 20th is judged fairly. Projected overage flows verbatim into the actions layer: one chain of custody, no recomputed drift.

The entire Command Centre is a single HTML file: no server, no build step, data embedded as JSON, opens in any browser. Secrets appear only as presence indicators; key values are structurally incapable of reaching the rendered page.
The discipline a finance team never notices but always benefits from: correctness, honesty and resilience enforced in code rather than promised in documentation.
The day under test is excluded from its own mean and deviation, so a huge spike cannot inflate the statistics and mask itself.
Billed and computed costs sit side by side in every row, so a price change overnight or a parsing bug exposes itself as measurable drift.
Unknown models raise instead of costing $0. Collisions raise instead of dropping rows. Bad data fails loud rather than quietly lying.
No analysis reads the wall clock: identical data renders byte-identical reports, which is what lets tests pin exact figures to the cent.
Allow-listed SQL scopes, sanitised logs that defeat log forging, SRI-pinned scripts and presence-only secret reporting.
Colour-blind-safe palette with labels too, AA contrast recorded per role, keyboard focus rings and reduced-motion support.
A seven-stage pipeline turns raw provider usage into dollar-costed recommendations. Every stage is isolated, nothing is silently dropped, and money flows one way: raw tokens in, verbatim impact figures out.
# src/anomaly.py - leave-one-out baseline: a spike cannot inflate its own statistics
for i, (d, v) in enumerate(points):
others = vals[:i] + vals[i + 1:] # exclude the day under test (A1)
mean = statistics.fmean(others)
std = statistics.pstdev(others)
z = dev / std if std > 0 else 0.0
# an alert fires ONLY when BOTH conditions hold (spec D3)
if z >= z_threshold and dev >= min_abs_usd:
alerts.append({"date": d, "z": round(z, 2)})
# small relative blips never spam; large deviations always surface.An embedded analytics stack with no server component anywhere in the analysis path: everything runs from files a fresh checkout can regenerate.
The full tech review is live as a standalone showcase site: every tool reviewed, the architecture drawn, and the proof figures reproducible from a fresh checkout with one command.
The Token-Spend Toolkit went from spec to a board-signed, audited production system. If you have AI spend, pipelines or pilots that need the same treatment, let's talk it through.