Skip to content
Mnema docs

Cost intelligence

Cost turns the raw token usage on every session into real dollars, then lets you cap and alert on it.

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-write

If 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.

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

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.