For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Health alerts

Monitor API traffic and notify your team when a metric crosses a threshold.

Health alerts notify your team when a metric crosses the threshold configured. Use email to notify your team or webhooks to connect alerts to your operational tools.

The Alerts page also includes default alerts for spend and API key expiration. Review these settings alongside your custom health rules to keep costs and credentials under control.

Before you begin

Open Alerts in your organization settings, or select a project and open its Alerts settings. Choose the organization or project that should own the rule before creating it.

Viewing custom rules requires organization.read or project.read for the selected scope. Creating and editing them requires the corresponding organization.write or project.write permission. Following investigation links into Usage also requires access to usage data. See Permissions to configure access. Default spend and key expiration settings have their own permissions.

Your organization’s alert allowance determines how many custom rules you can create and whether you can use webhooks. Start with email if webhook delivery isn’t available.

Choose a custom alert based on the problem you want to detect:

Alert type Use it to detect
Error rate An increase in requests returning selected HTTP error codes.
Prompt cache hit rate A decrease in the share of input tokens served from the cache.
Approaching rate limit Sustained utilization near an organization or project rate limit.
Service tier spillover An increase in eligible attempts that fall back from Fast to the standard tier because of capacity.

See Alert types for formulas, evaluation windows, and minimum traffic requirements.

Configure default alerts

The Default alerts section contains spend thresholds and API key expiration reminders for the selected scope. Review the saved settings and recipients. These settings are separate from custom health rules and do not show up in the alert history.

Spend alerts

Spend alerts notify recipients when monthly spend reaches a configured threshold. To configure them:

  1. Open the spend alert in Default alerts for the organization or project you want to monitor.
  2. Set the threshold as a percentage of the monthly spend limit. For example, an 80% threshold on a $1,000 limit corresponds to $800.
  3. Add any additional email recipients, then save.

Organization-owner notifications are enabled, and project alerts also notify project owners. You can’t change these owner settings in the spend alert editor.

If you need a different monthly limit or another threshold, use the scope’s Limits settings. Editing spend alerts requires permission to manage spend limits in that scope.

A spend alert sends a notification. It doesn’t stop API requests. See Spend alerts and Choose a spend control for the distinction between notifications and hard spend limits. To automate spend thresholds, use the existing Admin API or Terraform workflows.

API key expiration

Expiration reminders help you replace keys before their expiration dates. To configure them:

  1. Open the API key expiration alert in Default alerts.
  2. Choose when reminders should start, from 1 to 30 days before expiration.
  3. Select organization or project owners, key owners, and additional email recipients as appropriate. You can add up to 20 additional addresses.
  4. Save the settings for the selected scope.

You need permission to update the organization or project to change these settings. Reminders only apply to keys with expiration dates.

When a reminder arrives, create a replacement key, update the old key’s consumers, verify that they use the replacement, and revoke the old key. See API key expiration and rotation and API keys and service accounts for the full lifecycle.

Create a custom alert

The following example monitors HTTP 500 errors in a production project. Choose a threshold that reflects your application’s normal traffic and tolerance for errors.

  1. Open Alerts in the organization or project that should own the rule, then create an alert.
  2. Give the rule a descriptive name, such as “Production HTTP 500 errors.”
  3. Choose Error rate, select the production project, and select HTTP 500.
  4. Set the threshold to 5% and the evaluation window to 15 minutes.
  5. Configure email recipients, such as the responsible owners or an on-call address.
  6. Save the rule with evaluation enabled.

Review the saved scope, condition, and recipients. Once enough matching traffic is available, the rule evaluates the number of HTTP 500 responses divided by the total number of matching requests over the rolling window. It triggers after the error rate exceeds 5% in two consecutive evaluations.

Choose scope and filters

Alert type Supported traffic filters
Error rate Projects, models, service tiers, and the selected HTTP error codes.
Prompt cache hit rate Projects, models, service tiers, and observability tags.
Approaching rate limit Projects and models, with a choice of organization or project quota.
Service tier spillover Projects and models, with Fast as the source tier.

Select at least one project for error rate, prompt cache hit rate, and service tier spillover rules. Approaching rate limit rules require a model selection; organization-level rate limit quota monitoring doesn’t require a project selection.

Each combination of selected filter values is evaluated as a separate traffic group. For example, two selected projects and two selected models can produce four traffic groups if all four combinations receive traffic. Traffic is combined across optional dimensions you leave unfiltered. Error rate rules evaluate each selected status code separately. Rate limit rules evaluate the enforced quota associated with observed traffic.

Configure notifications

For email, choose the applicable organization or project owners and up to 20 additional email addresses.

For webhook delivery, follow Receive webhook notifications. The webhook contains event metadata and a notification ID in data.id. Retrieve the notification to get the measurement, threshold, evaluation window, and affected dimensions with an organization Admin API key, including for project-owned notifications.

Alert types

Custom health rules evaluate a metric for each matching traffic group. Choose the metric and window that match the problem you want to detect.

Dashboard type Measurement Trigger condition Window
Error rate Requests with one selected HTTP status code divided by all matching requests. Above the threshold. 5, 15, or 30 minutes.
Prompt cache hit rate Cached input tokens divided by total input tokens. Below the threshold. 15 minutes.
Approaching rate limit Peak usage of the enforced rate limit bucket divided by its limit. At or above the threshold for the configured number of consecutive minutes. One-minute evaluations for 1–60 consecutive minutes.
Service tier spillover Capacity fallback attempts divided by eligible routing attempts for the source tier. Above the threshold. 5 minutes.

Thresholds appear as percentages in the dashboard. The API represents them as fractions: 0.05 means 5%.

Error rate

Choose the HTTP error codes to monitor. Each selected code is evaluated separately and can trigger its own incident. The denominator includes all matching requests, including successful requests and requests with other status codes.

For example, among 1,000 matching requests, 60 HTTP 500 responses produce a 6% HTTP 500 rate. Another 40 HTTP 503 responses produce a separate 4% HTTP 503 rate. With a 5% threshold, the HTTP 500 group breaches the threshold and the HTTP 503 group doesn’t.

The selected rolling window must contain at least 100 matching requests. Use Error codes and the affected requests to investigate the failure.

Prompt cache hit rate

This metric measures the share of input tokens served from the cache. It isn’t the percentage of requests with a cache hit. Larger prompts therefore contribute more to the rate than smaller prompts.

The 15-minute window requires at least 100 matching requests and 1,000 input tokens with usable cache measurements. Review Prompt caching for cache behavior, and use Prompt cache diagnostics to investigate individual requests on supported models and APIs.

Approaching rate limit

Choose requests per minute (RPM) or tokens per minute (TPM), a utilization threshold, and the number of consecutive breaching minutes. For example, 90% TPM utilization for 10 consecutive minutes detects sustained pressure on a token limit.

The measurement uses the peak utilization of the enforced bucket during each minute. A bucket can be shared by multiple models, so its utilization can include traffic from models other than the selected model. Select organization-level monitoring for an organization quota or project monitoring for project quotas. See Rate limits for shared limits and mitigation options.

This alert uses observed rate limit data rather than a minimum request count. Missing observations break the consecutive-minute sequence. Approaching rate limit alerts are not supported for dedicated models.

Service tier spillover

This alert measures eligible Fast routing attempts that fall back to the standard tier because of capacity. The denominator combines attempts retained on the source tier with eligible capacity fallback attempts.

The five-minute window requires at least 100 eligible attempts. The API names this condition service_tier_fallback_rate and uses fast as the source tier. When investigating, compare the requested and served service tiers for the affected traffic.

Evaluation and recovery

Error rate, prompt cache hit rate, and service tier spillover rules evaluate rolling windows once per minute. They require two consecutive breaching evaluations to trigger and two consecutive healthy evaluations to resolve. Approaching rate limit rules use the configured number of breaching minutes to trigger and two healthy evaluations to resolve.

A new rule needs enough data to evaluate its window. Missing, stale, or insufficient data doesn’t establish recovery and can interrupt the consecutive evaluation sequence. Notifications typically arrive a few minutes after an alert changes state because data collection, evaluation, and delivery happen asynchronously. Delivery times aren’t guaranteed.

Investigate an alert

Open the alert’s history to review the affected traffic, measured value, threshold, and evaluation period. Use the date and status filters to find an incident, then follow the available links to Usage to inspect that traffic.

Status Meaning
Active The condition met the rule’s trigger requirements.
Resolved Subsequent evaluations met the recovery requirements.
Deactivated The incident stopped being evaluated, for example, after a rule change.

Match the project, model, service tier, status code, and time window when comparing an alert with Usage. A daily chart or a combined metric may not reflect the group and rolling window that triggered an alert.

For prompt cache alerts, start with aggregate cache usage for the affected traffic. Then use Prompt cache diagnostics to compare individual requests and Fix a cache miss to investigate prompt prefixes, traffic changes, and cache usage. Follow that guide’s API and model requirements. An aggregate alert doesn’t include the response IDs needed for a request comparison.

Manage custom rules

Edit a rule to adjust its threshold, filters, or notification settings. Disable a rule to stop evaluation while retaining its configuration, and enable it when you want evaluation to resume. Rule changes can deactivate an existing incident, including when disabling an alert.

Delete a rule when you no longer need it. Disabled rules still count toward the organization’s custom rule allowance; deleting a rule releases its slot. Default alerts don’t use this allowance.

Use the Admin API

Use the Admin API to manage the same custom rules shown in the dashboard. Use an organization Admin API key for either scope.

Rule ownership API path API reference
Organization /v1/organization/health/alert_rules Create · Retrieve · Update · Delete · List
Project /v1/organization/projects/{project_id}/health/alert_rules Create · Retrieve · Update · Delete · List

Build your workflow around the rule’s returned ID and version:

  1. Create a rule with its name, condition, traffic filters, and notification settings. Select projects for error rate, prompt cache hit rate, or service tier spillover rules; select models for approaching rate limit rules. API thresholds are fractions, and the service tier spillover condition is named service_tier_fallback_rate.
  2. Retrieve the rule before editing and retain its version.
  3. Send that value as expected_version when updating the rule. If another writer has changed it, retrieve the latest version and reconcile your changes before retrying. The condition type can’t be changed after creation.
  4. Set enabled to false to pause evaluation while keeping the rule, or delete the rule with its current expected_version to release its slot.

When listing rules, pass the returned next cursor as page to continue. A page can contain no rules and still have a continuation cursor. Continue until there is no next page.

These operations manage custom health rules. Use the separate spend alert APIs for spend thresholds, and configure key expiration reminders in Alerts settings.

Receive webhook notifications

Use health alert webhooks to route incidents to your team’s operational tools. Each webhook identifies a notification. Your server then retrieves the notification to get the measurement and affected traffic with an organization Admin API key.

Configure an endpoint

First, check your organization’s webhook eligibility. Enable webhook notifications on the rule and configure an endpoint in the rule’s owning scope:

  • For an organization-owned rule, use organization webhook settings, even if the rule monitors only one project.
  • For a project-owned rule, use that project’s webhook settings.

Subscribe the endpoint to both events:

Event Meaning
health.alert.triggered A traffic group met the rule’s trigger requirements.
health.alert.resolved A triggered group met the recovery requirements.

Webhook subscriptions apply to events in that scope. They don’t create an exclusive destination for one rule. Route notifications within your receiver using the retrieved rule ID and dimensions.

Verify and accept the webhook

Follow the Webhooks guide to verify the signature against the raw request body. Store the signing secret on your server. Persist the event before returning an HTTP 2xx response, then process it in a background worker. Use the webhook-id header to deduplicate retried deliveries. See webhook delivery behavior for retries and response requirements.

A triggered event has this structure:

{
  "id": "evt_example",
  "object": "event",
  "created_at": 1795996820,
  "type": "health.alert.triggered",
  "data": {
    "id": "alertnotif_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
  }
}

The payload contains event metadata and only the notification ID in data. It doesn’t include measurements, thresholds, evaluation windows, or traffic dimensions.

Use data.id to retrieve the notification. The top-level id identifies the webhook event, not the alert notification or rule.

Retrieve the notification

Create an organization Admin API key for the notification’s organization. Both organization-owned and project-owned notifications require an organization Admin API key. An ordinary project API key or the webhook signing secret can’t authorize this request. Keep the Admin API key and signing secret in separate server-side secret settings.

Retrieve the notification identified by data.id using the path that matches the rule’s ownership:

Pass the Admin API key as the bearer credential. For a project-owned notification, use the owning project’s ID in the path.

The response is an immutable snapshot of the transition. An error rate notification contains fields such as:

{
  "id": "alertnotif_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "object": "health.alert",
  "created_at": 1795996810,
  "type": "triggered",
  "alert_rule_id": "alertrule_example",
  "occurred_at": 1795996800,
  "dimensions": {
    "project_id": "proj_example",
    "model": null,
    "service_tier": null,
    "http_status": 500
  },
  "window": {
    "started_at": 1795995900,
    "ended_at": 1795996800
  },
  "measurement": {
    "type": "error_rate",
    "value": 0.06,
    "threshold": 0.05,
    "request_count": 1000,
    "error_count": 60
  }
}

This example reports 60 HTTP 500 responses among 1,000 requests in a 15-minute window. The value is 6%, above the 5% threshold. Null values for the model and service tier dimensions indicate that those dimensions are combined in this group. Window timestamps use Unix seconds, with an inclusive start and exclusive end.

Use alert_rule_id to identify the rule and dimensions to identify the affected traffic. A health.alert.resolved event has its own notification ID. Retrieve that notification to get a snapshot with type set to resolved and a measurement describing recovery. The resolution applies only to that traffic group.

Notifications remain retrievable for 30 days. Store the details your workflow needs within that period. This retrieval window is separate from dashboard history and webhook retry timing.

Test the integration

Use a dashboard test webhook to verify receipt and signature handling. Test events contain sample notification IDs that don’t refer to stored notifications, so they can’t demonstrate successful retrieval.

For a local receiver test, use a mocked retrieval response to check routing and duplicate handling. For an end-to-end check, use a real retained notification from a controlled test rule. Verify both triggered and resolved handling, and remove the test rule when finished.

Availability and limits

Custom rule allowances apply across an organization and all its projects. Enabled and disabled rules both count; deleted rules don’t. Default spend alerts and API key expiration reminders are separate from this allowance.

Organization eligibility Custom rules Webhook notifications
Default allowance 3 Not included.
At least $100 in qualifying prepaid credit purchases 10 Not included.
At least $500 in qualifying prepaid credit purchases 100 Included.

Purchase thresholds refer to cumulative qualifying credit purchases. Sales-managed organizations and organizations with qualifying postpaid or custom billing arrangements receive the 100-rule allowance. Please contact sales if you need a limit higher than what’s allowed today.

Email notifications are available for custom rules at every allowance level. A rule can notify owners and up to 20 additional email addresses.