Skip to Content
Rius

How do I query LLM cost per agent over MCP?

Rius answers per-agent cost questions over MCP with the agent_traces_summary tool. Connect the Rius MCP server to your AI client and ask for the cost of one agent in plain language. Your client calls the tool for that agent or service, optionally split per time bucket, and returns its cost with the other traffic figures. Costs are list-price estimates in US dollars.

How it works

The Rius MCP server exposes read tools over your workspace’s traces and metrics. For cost per agent, the tool is agent_traces_summary. It summarizes one agent or service, and it can break the summary down per time bucket, so you can see how an agent’s spend moves across a period.

Your client picks the tool for you. You ask a question such as:

What did my agents cost this week, and which service is spending the most?

The summary covers agent traffic figures: traces, LLM calls, error rate, cost, tokens and latency percentiles. Cost comes from the price Rius puts on each LLM call at ingest, rolled up per agent. You never send a cost value, because Rius computes it from the model name and token counts your instrumentation already records. See Track LLM and agent cost for how a call is priced.

Two neighbouring tools help when the question changes:

  • workspace_metrics_overview gives the workspace total, cost by model and a ranking of top agents.
  • list_agent_traces and list_spans show the individual runs and calls behind an agent’s number.

Set it up

  1. Connect the server to your client. In Claude Code, run:
claude mcp add --transport http rius https://mcp.eu.console.rius-glassflow.com/mcp

The OAuth sign-in with your Rius account opens the first time a session uses the server. If you use the Rius plugin for Claude Code, Codex (beta) or Cursor (beta), it already registers the server as rius. Other clients are covered on the MCP page.

  1. For an agent that runs without a browser, such as a CI job, use a read-scoped API key sent as an Authorization Bearer header. Ingest keys cannot query through the MCP server, so mint a key with the read capability.

  2. Confirm the connection by asking “Who am I in Rius, and which workspaces can I access?” The client should call get_me and answer with your workspaces.

  3. Ask for cost per agent. Name the agent, or ask for a ranking:

    • “What did the planner agent cost over the last 7 days?”
    • “Show cost per day for checkout-agent this week.”
    • “Which agent is spending the most?”

    For a ranking across agents, the client uses workspace_metrics_overview, which lists top agents.

  4. Make sure the agent name matches what Rius shows. Rius groups traces under the agent name from agent_name or RIUS_AGENT_NAME, which defaults to the service name. The Agents page lists the names it found.

What you get

  • Cost for the agent you name. The summary carries the agent’s total cost for the window you ask about, next to its trace count, LLM calls, error rate, tokens and latency percentiles.
  • A trend, if you ask for one. With time buckets, you see whether spend is rising, for example after a release.
  • The same numbers as the console. The Agents page shows total cost and average cost per trace for each agent, so you can check an answer there.
  • Estimates, not invoices. Rius applies each model’s standard list price, not batch, long-context or negotiated rates, so expect your provider invoice to differ.
  • Gaps shown honestly. A call whose model is not in the price catalog, or that reported no token usage, has an empty cost, not zero. Totals add up only the priced calls, and averages per trace divide by every trace. When nothing in the window was priced, agent_traces_summary reports $0.00, so read a zero together with your model coverage.

When something else fits

  • To see cost by model for the whole workspace, ask for the workspace overview, which uses workspace_metrics_overview.
  • To browse cost per agent visually, with drift charts and version comparison, open the Agents page in the console.
  • To be told when cost per trace crosses a threshold, set up a cost alert instead of asking repeatedly.

Still stuck? Get help

Last updated on