Use casesMoney

Billing and usage anomaly detection

cost and tokens are builtins, so the analyser can account for its own spend.

The problem

Usage anomaly jobs scan millions of billing events and occasionally call a model to classify weird patterns. The job itself consumes tokens. FinOps teams discover, too late, that the detector cost more than the anomalies it found.

Why Ecko

Built-in metering
cost() and tokens() after each ai call let the detector accumulate its own inference spend alongside the customer usage it is inspecting.
Hard budgets
ECKO_AI_MAX_CALLS stops a runaway loop before it becomes a runaway invoice. Combine with pmap concurrency limits for queue workers.
JSONL audit
Every classification appends to a trace file for post-mortems: which account looked weird, which model agreed, what it cost.

In practice

detect.ecko
fn classify(row: str) -> str {
  let label = ai "Anomaly class" from row
  log.info("row classified", cost=cost(), tokens=tokens())
  label
}

Further reading

Try it on your workload.