Financial Anomaly Detection

Monitor and control AI spending in real time. The Financial Anomaly Detector tracks per-session and per-project cost trajectories, detecting deviations from established baselines.

Python SDK

from prysmai import GovernanceSession
from prysmai.detectors import FinancialAnomalyDetector

detector = FinancialAnomalyDetector(
    budget_limit=5.00,           # Hard budget cap per session ($)
    cost_per_1k_input=0.003,     # Input token cost
    cost_per_1k_output=0.015,    # Output token cost
    spike_threshold=3.0,         # Alert if cost exceeds 3x the rolling average
    window_size=10,              # Rolling window of 10 calls
)

session = GovernanceSession(client, project_id=1)
session.attach_detector(detector)

Detection Types

TypeDescription
budget_exceededSession cost exceeded the configured budget limit
cost_spikeSingle call cost exceeded spike_threshold × rolling average
rate_anomalyCost accumulation rate significantly above baseline
projection_breachProjected session cost will exceed budget at current rate

Dashboard

Navigate to Dashboard → Cost Anomalies to view:

  • Total spend, anomaly count, and budget breach metrics
  • Anomaly log with severity, cost data, and resolution actions
  • Filter by type, severity, and status