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
| Type | Description |
|---|---|
| budget_exceeded | Session cost exceeded the configured budget limit |
| cost_spike | Single call cost exceeded spike_threshold × rolling average |
| rate_anomaly | Cost accumulation rate significantly above baseline |
| projection_breach | Projected 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