Skip to main content

Get alerted to cost spikes as they happen

Enterprise Tier

The in-Console surfaces are sufficient for periodic review and for active investigation. They are not the right place for always-on visibility into spend across a large fleet of keys, because a dashboard nobody is watching catches nothing. The always-on answer is telemetry export: Agent Router's per-request cost dimensions flow into the observability stack the organisation already runs, where alert rules page someone the moment spend moves outside expectations.


Persona: Platform operator, in partnership with the team that owns the observability stack.

Estimated time: Depends on the observability stack; the export itself is covered in the developer-side telemetry guide.

Outcomes

By the end of this guide:

  • Agent Router's per-request cost metrics flow into an external observability stack over OpenTelemetry.
  • At least one alert rule fires on a spend anomaly rather than relying on someone watching a dashboard.
  • The division of labour is understood: enforcement stays inline at the gateway, oversight lives in the observability stack.

Prerequisites

  • An OpenTelemetry-compatible observability stack (Grafana, Datadog, Honeycomb, or equivalent) and access to configure alert rules in it.
  • The telemetry export configured; the plumbing is covered in Export telemetry to an observability stack.

Step 1: Export the cost dimensions

Agent Router emits per-request metrics with the dimensions that cost oversight cares about: API key identifier, resolved model, provider, status, and token counts. Pulled into the observability stack over OpenTelemetry, these dimensions support cost-per-key, cost-per-team, and cost-per-model views on whatever cadence the platform refreshes.

Step 2: Wire the alert rules

The rules that earn their keep in practice:

  • A key's hourly cost exceeds a threshold derived from its baseline.
  • A key's traffic shape changes unexpectedly (request rate, token volume, or error rate moving sharply against its history).
  • Aggregate Agent Router spend crosses a contractual ceiling agreed with the provider or with finance.

Each alert should route to someone who will act on it; an alert channel nobody reads is the dashboard problem in a different costume. The follow-up paths are the same as for a manual review: legitimate growth feeds a ceiling adjustment (Raise a spend ceiling without interrupting delivery), and an illegitimate spike is an incident (Contain a leaked key before it drains the budget).

Step 3: Correlate across systems

The export's third win is correlation: joining Agent Router spend to the rest of the application stack, so that a sudden cost spike can be tied to a specific application deployment, a specific feature release, or a specific incident. This is what the in-Console surfaces cannot do, and it is usually the difference between "spend went up" and "spend went up because Tuesday's release doubled the context size".

The split is intentional. Spending limits are enforced inline by Agent Router, where the cost of action is low. Spending oversight lives in the observability platform, where the cost of integrating with the rest of the organisation's tooling has already been paid.