Last updated: 2026-04-11

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

TypeTriggerUse Case
COST_THRESHOLDDaily or monthly spend exceeds a configured limitBudget control — know before you overspend
VOLUME_SPIKERequest volume exceeds a configurable multiplier of your averageDetect runaway loops or unexpected usage surges
NEW_KEY_DETECTEDA provider API key SpendLil hasn't seen before is usedShadow AI visibility — know when new keys appear
BUDGET_EXCEEDEDMonthly budget limit breachedHard budget enforcement awareness
BYPASS_ACTIVESpendLil 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.

json Example: daily spend threshold rule
{
  "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.