Skip to content
Rapid Router
← API reference

Spend alerts

Part of the Rapid Router API reference. One OpenAI-compatible endpoint, https://rapidrouter.ai/api/v1, in front of every model in the catalog.

37Spend alerts

Set a daily or monthly dollar threshold and get told when your spend crosses it, by email, WhatsApp, or a webhook. Settings live at GET /v1/alerts and PUT /v1/alerts, session-authenticated.

curl -X PUT https://rapidrouter.ai/api/v1/alerts \
  -H "Authorization: Bearer <session JWT>" \
  -H "Content-Type: application/json" \
  -d '{
    "daily_usd_threshold": 25,
    "monthly_usd_threshold": 400,
    "alert_phone": "+14155550123",
    "email_enabled": true,
    "wa_enabled": true
  }'

# Thresholds are positive dollars, or null to turn one off.
# alert_phone must be international format (E.164); it is only
# needed when wa_enabled is true. email_enabled defaults to true,
# wa_enabled to false.

A sweep checks spend every 5 minutes and fires each alert at most once per period: once per UTC day for the daily threshold, once per calendar month for the monthly one. The dedupe is stored in the database, so a redeploy never re-sends the same breach.

Anomaly detection needs no configuration. When your spend in the last hour reaches $1 or more and runs at least 5 times your average hourly spend over the prior 7 days, you are alerted, at most once per day, with the model and key the money went to. An account with no prior traffic has a zero baseline, so any burst of $1 or more counts, which is exactly the stolen-key case the alert exists for. Both events are also delivered to your webhook, configured in the dashboard, as signed POSTs of { event, data, created_at }.