How do I query LLM cost per customer over MCP?
Rius gives you cost per customer over MCP with workspace_metrics_overview for a customer’s workspace, or list_users sorted by cost for end users in one workspace. Connect the Rius MCP server to your AI client and ask in plain language, and the client picks the tool. Which tool answers depends on how you model a customer: as a workspace, or as an end user identified by user.id. Costs that come back are list-price estimates in US dollars.
How it works
A customer maps to cost in one of two ways, and each has its own tool.
- Customer as a workspace. Token and cost rollups are per workspace, so a customer’s cost is that workspace’s total. The client calls
workspace_metrics_overview, which returns the workspace KPIs (traces, LLM calls, error rate, cost, tokens, latency percentiles) and cost by model. Pass the tool’sworkspaceargument as a name or an ID. If the same workspace name exists in more than one of your organizations, passorg/workspace, because an ambiguous name returns an error. - Customer as an end user. Inside one workspace, spans that carry
user.idroll up per end user. The client callslist_userssorted by cost, which surfaces your most expensive customers first.
For one agent or service, agent_traces_summary gives the cost for that agent, optionally per time bucket. list_agent_traces and list_spans then show the individual runs and calls behind a number.
A customer_id span attribute on its own does not drive cost rollups, so MCP cannot total cost by it. Use a workspace per customer or user.id. The multi-tenant guide explains the difference.
Set it up
-
Connect the server. In Claude Code, run the line below. The OAuth sign-in opens the first time a session uses the server. Other clients and headless keys are covered on the MCP page.
claude mcp add --transport http rius https://mcp.eu.console.rius-glassflow.com/mcp -
Check the connection. Ask “Who am I in Rius, and which workspaces can I access?” The client calls
get_meand lists your workspaces. Each customer workspace you expect should appear. -
Ask for one customer’s cost. Name the workspace:
What did the acme workspace cost this week, and which model is spending the most?
The client calls
workspace_metrics_overviewfor that workspace. -
Ask for your costliest end users. For customers tracked by
user.idinside one workspace:Who were my ten most expensive end users this week?
The client calls
list_userssorted by cost. -
Drill into one run. Ask for the failed or most expensive traces of a customer. The client calls
list_agent_traces, thenlist_spansto see which calls cost the most. -
Build an all-customers summary. Ask the client to list your workspaces and fetch each one’s metrics. The console shows one customer at a time, but
list_workspacesplusworkspace_metrics_overviewper workspace is enough to script a weekly summary across customers. Do this in an interactive OAuth session. A read-scoped API key reaches only the single workspace it was created in, and other workspaces report as not found. For a headless job that watches one customer, mint a key withscopes: ["read"]. Ingest keys cannot query.
For how prices are calculated, see Track LLM and agent cost.
What you get
- Per-customer totals. Cost, tokens, traces, LLM calls, error rate and latency percentiles for one customer’s workspace, plus cost by model.
- A ranked list of end users. Your most expensive customers inside a workspace, from
list_userssorted by cost. - Drill-down. From a total to the traces and individual model calls behind it.
- Plain-language answers. Your client turns the results into a sentence or a table, so you do not build a query.
- Honest numbers. Cost is the model’s standard list price from LiteLLM’s public catalog, in US dollars. Negotiated, batch and long-context pricing are not applied, so an invoice can differ. A call whose model has no price has an empty cost, not zero, so totals count only priced calls. Summary figures from tools such as
agent_traces_summaryreport a total with nothing priced as $0.00.
When something else fits
- If you only want to look at one customer’s spend, the workspace’s usage and cost view in the console shows the same totals without a client. See the multi-tenant guide.
- If you need a total-spend alert for a customer, MCP can create cost alert rules on a per-trace cost metric, but a whole-workspace budget threshold is not an alert metric today.