create_alert
Create alert rules to monitor cost, error rate, latency, or anomaly thresholds and send notifications via email, Slack, Discord, Teams, or webhook.
Instructions
Create a new alert rule. Watches for cost / error rate / latency / anomaly threshold breaches and notifies the specified channels. Example: "notify me by email when daily cost exceeds $10". channelKinds is an array of channel kinds to enable; channelTargets is an object keyed by those kinds holding the destinations (e.g. channelKinds:["email"], channelTargets:{"email":"dev@example.com"}). Every kind listed in channelKinds must have a destination in channelTargets. anomaly_* types interpret thresholdValue as a standard-deviation multiplier (0.5-10, e.g. 3 = 3 sigma). The Free plan allows the email channel only and up to 3 alerts (the backend returns 403 beyond that).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Display name of the alert (1-100 chars, no line breaks) | |
| enabled | No | Whether to enable immediately after creation. Default true. | |
| alertType | Yes | Metric to watch. cost_threshold = one-shot cost threshold (USD) / monthly_budget = monthly budget (USD) / error_rate = error rate (%) / latency_degradation = latency degradation (ms) / anomaly_cost / anomaly_latency / anomaly_error_rate = anomaly detection (windowMinutes is fixed at 60) / eval_score = quality SLO (evalCriterionId required; fires when the mean score in the recent window drops below thresholdValue) / guardian_findings = external notification of findings (notifies new inbox findings; thresholdValue / windowMinutes are unused — pass 0 and 60) | |
| conditions | No | v1.5 multi-condition alert (composite conditions). When specified, single-metric evaluation via alertType + thresholdValue + windowMinutes is ignored and the conditions JSON switches to AND/OR aggregation. Example: {"operator":"AND","conditions":[{"metric":"cost_threshold","threshold":100,"windowMinutes":60,"comparator":">"},{"metric":"error_rate","threshold":0.05,"windowMinutes":60,"comparator":">"}]}. The backend validates the shape via parseConditionsJson (operator AND/OR, 1-8 conditions, each requiring metric/threshold/windowMinutes/comparator). Omit (null) to stay on the single-metric path. | |
| filterModel | No | Restrict to this model name only (substring match). Omit for all models | |
| channelKinds | Yes | Array of notification channel kinds to enable (each kind needs a destination under the same key in channelTargets). The Free plan can use email only. | |
| sleepMinutes | No | Suppression window for repeated notifications (minutes, 5-10080). After firing once, no re-notification during this window. Default 60. | |
| windowMinutes | No | Aggregation window (minutes, 5-43200). Default 60. Ignored for anomaly types (fixed at 60). | |
| channelTargets | Yes | Object keyed by channel kind with the destination as the value (must include a destination for every kind listed in channelKinds). Example: {"email": "dev@example.com"}. email takes an email address; slack/discord/teams/webhook take the service's webhook URL. | |
| filterProvider | No | Restrict to this provider only (openai / anthropic / gemini / mistral). Omit for all providers | |
| thresholdValue | Yes | Threshold (>= 0). USD for cost types, % for error_rate, ms for latency_degradation. For anomaly types, a standard-deviation multiplier (e.g. 3 = 3 sigma) | |
| evalCriterionId | No | Required when alertType=eval_score. The id of the eval criterion to watch (list_eval_criteria.criteria[].id). Fires when the mean score in the recent window drops below thresholdValue. |