Skip to Content
Rius

How do I alert on LLM cost per end user?

Rius custom alerts cannot filter cost by end user, because their filters are service, agent, step, model, span kind, operation, session and instance. You can still see each end user’s cost on the Users page, sorted by Cost, and ask for the most expensive users over MCP. For alerts, you write a per-trace cost rule scoped by service, agent or model. This follows the guidance in Track LLM and agent cost.

How it works

A custom alert puts a threshold on workspace metrics. Its filters choose which spans feed the rules before any aggregation, and user is not one of them.

Cost is a numeric metric measured per trace. You pick an aggregation (avg, min, max, p50, p95 or p99) and a rolling window between 5 minutes and 24 hours. So p95(Cost) > $2.00 means the most expensive 5% of traces in the window cost more than two dollars. It is not a per-user or workspace total.

End-user cost lives elsewhere. Rius reads the end user from user.id on a span and rolls cost up per user. The Users page shows total cost and average cost per trace for each one.

  • Alerts: cost per trace, narrowed by service, agent, step, model, span kind, operation, session or instance.
  • Per-user cost: the Users page and the MCP tools, not an alert rule.

Set it up

  1. Tag each request with its end user so cost can be attributed. Use rius.user in Python or withUser in TypeScript. Traces with no end user land in the anonymous row on the Users page.

  2. Open Users, choose a window (15m, 1h, 1d, 7d or 30d) and sort by Cost. The top rows are your most expensive end users. The list shows the top 50 for the chosen sort, so search by exact user ID to reach anyone else. Open a user to compare their cost per trace with the agent’s average on Agents.

  3. To check on demand, connect the Rius MCP server and ask who your most expensive end users were this week. The client calls list_users sorted by cost. user_activity_summary is also available.

  4. Create the custom alert that does work: a per-trace cost rule scoped to the part of your system you care about.

FILTERS Service = checkout-agent RULES p95(Cost) > $2.00 WINDOW 1 hour
  1. Attach a channel (webhook, email or Slack) so the alert reaches you. A heavy user then shows up as a rise in the tail of cost per trace for that service. You find who it was on the Users page for the same window.

If you run one workspace per customer, a cost rule in that workspace only sees that customer’s traces. Within one workspace, use user.id and the Users page.

What you get

  • A clear answer on what a custom alert can narrow cost by, so you do not hunt for a user filter that is not there.
  • A cost alert that catches expensive runs, such as a prompt that grew or an agent stuck retrying, scoped by service, agent or model.
  • A per-user cost ranking on the Users page, with total cost, average cost per trace, failed traces and the agents that served each user.
  • A path from a suspicious user to their recent traces and failed traces in a few clicks.
  • Costs in US dollars as list-price estimates from LiteLLM’s public model-price catalog. A call whose model has no price has an empty cost, not zero, and a cost rule over mostly unpriced models can stay quiet. Firings show the share of the window that was priced, and cost by model on Usage and cost is where you check coverage.

When something else fits

  • If you need a threshold on total spend or a budget for the whole workspace, Rius does not offer it as an alert metric today. Watch it on the Usage and cost page.
  • If you need a firing for one named user, the Users page and MCP queries are the way to review them. A custom alert cannot do it.

Still stuck? Get help

Last updated on