Alerts & Thresholds
Configure spend alerts, volume spike detection, and new key notifications.
SpendLil fires alerts when your AI spend crosses thresholds you define. Alerts are asynchronous — they never slow down or block your AI requests.
Alert Types
| Type | Trigger | Use Case |
|---|---|---|
| COST_THRESHOLD | Daily or monthly spend exceeds a configured limit | Budget control — know before you overspend |
| VOLUME_SPIKE | Request volume exceeds a configurable multiplier of your average | Detect runaway loops or unexpected usage surges |
| NEW_KEY_DETECTED | A provider API key SpendLil hasn't seen before is used | Shadow AI visibility — know when new keys appear |
| BUDGET_EXCEEDED | Monthly budget limit breached | Hard budget enforcement awareness |
| BYPASS_ACTIVE | SpendLil proxy entered bypass mode (service degraded) | Operational awareness — you may have a tracking gap |
How Alerts Fire
When the proxy Lambda processes a request and atomically increments your daily spend counter, it checks whether any threshold has been crossed. If so, it fires an event to AWS EventBridge asynchronously. EventBridge routes the event to SNS, which delivers notifications via your configured channels.
This is entirely non-blocking. The alert event is fired after the provider response has already been returned to your application.
Notification Channels
- Email — via AWS SES
- SMS — via AWS SNS (Growth plan and above)
- In-app — alert badge and history in the dashboard
Configuring Alert Rules
Alert rules are configured in the dashboard or via the API. Each rule specifies a type, threshold configuration, and notification channels.
{
"type": "cost_threshold",
"name": "Daily spend warning",
"config": {
"threshold": 50,
"period": "daily",
"currency": "GBP"
},
"channels": ["email", "sms"],
"isActive": true
} Deduplication
Each daily spend record has a thresholdAlerted flag. Once an alert fires for a given day, it won't fire again for the same threshold. This prevents alert fatigue from repeated notifications as spend accumulates through the day.