Cost intelligence
Cost turns the raw token usage on every session into real dollars, then lets you cap and alert on it.
How spend is computed
Section titled “How spend is computed”Each session’s token counts (input, output, and cached reads/writes) are priced against a per-model rate table. Cost is:
cost = Σ (tokens ÷ 1,000,000) × price_per_million for input, output, cache-read, cache-writeIf an agent reports a dated model id (e.g. claude-opus-4-8-20260101) the pricer falls back to the
matching alias (claude-opus-4-8), so new snapshots are still priced correctly. A model with no
rate row is logged and costs 0 — add it in the pricing table rather than guessing.
Budgets
Section titled “Budgets”In Cost → Budget you can set, per workspace:
- a daily budget and a monthly budget (either, or both)
- an alert threshold — the percent of budget at which alerts start (e.g. 80%)
- Slack and Discord webhook URLs
Alerts
Section titled “Alerts”When spend crosses the threshold, Mnema sends an alert to your Slack/Discord webhooks. Alerts are throttled to at most once every six hours so a busy day cannot spam you. Both daily and monthly budgets are checked; the daily budget is evaluated first.
Alerts are informational and run out-of-band from the agent pipeline — a webhook failure never affects a running agent.