How do I query LLM cost per conversation over MCP?
Rius gives a conversation’s total cost over MCP when your client calls agent_traces_summary with a session_id filter, and list_spans lists the cost of each model call in it. Each turn of a conversation is its own trace, so the total is the sum of that session’s traces. You connect the Rius MCP server to your AI client and ask in plain language, and the client picks the tool. Each figure is a list-price estimate in US dollars.
How it works
In Rius, a conversation is a session: your application assigns a session.id, and each turn of the chat is its own trace. Rius prices every model call at ingest from the model and its token counts, then rolls that cost up per trace, per agent, per end user and per workspace. See Concepts for the data model and Track LLM and agent cost for how pricing works.
Over MCP, your client calls these tools behind your question:
list_agent_tracesreturns the individual runs, so each turn of a conversation appears as one run.list_spansreturns the individual model calls, and withsession_idit lists every call in one conversation.get_agent_tracereturns the full span waterfall of one run.agent_traces_summaryreturns totals for one agent or service, optionally per time bucket. With asession_idfilter it returns the total for one conversation.list_usersreturns end users, which you can sort by cost.workspace_metrics_overviewreturns the workspace total and cost by model.
For a conversation’s total, the client calls agent_traces_summary with this filter, which returns total and average cost for that session’s traces. It reads the session id off the session column of list_agent_traces rather than guessing it.
[{ "field": "session_id", "op": "eq", "values": ["chat-881"] }]If you tag end users with user.id, the per-user view gives you cost for the person a conversation served.
Set it up
- Connect the server. In Claude Code, run this in your terminal. The OAuth sign-in opens the first time a session uses the server. If you use the Rius plugin, it already registers the server as
rius, so skip this step. Other clients are covered on the MCP page.
claude mcp add --transport http rius https://mcp.eu.console.rius-glassflow.com/mcp- Check the connection by asking: “Who am I in Rius, and which workspaces can I access?” Your client calls
get_meand answers with your workspaces. - Ask for cost at the grain you need. For example:
- “What did conversation chat-881 cost in total?”
- “What did my agents cost this week, and which service is spending the most?”
- “What do planner’s gpt-4o runs cost?”
- “Who were my ten most expensive end users this week?”
- To look inside one expensive run, ask your client to open that trace. It calls
get_agent_traceand returns the span waterfall. - For agents that run without a browser, such as CI jobs, mint a read-scoped API key and send it as an
Authorizationbearer header. Ingest keys cannot query. - Send
session.idon your spans so turns stay grouped as conversations in Rius. Rius computes cost, so you send only the model name and token usage.
What you get
- A cost for each run and each model call, in US dollars, built from the model and its token counts. Prompt-cache reads and writes are priced at their own rates.
- Totals per agent or service, per end user and per workspace, plus cost by model.
- List-price estimates. Rius applies each model’s standard rates, so your provider invoice can differ.
- An empty cost, not zero, for a call whose model has no price or that reported no token usage. Totals add up the priced calls, and averages per trace divide by every trace, so partial coverage lowers both.
agent_traces_summaryreports a total with nothing priced as $0.00. - A cost that stays as written on the span. A later price change does not rewrite past calls.
- An optional cost alert. Ask your client to set one up with
create_alert_rule, for example when p95 cost per trace goes over two dollars.
When something else fits
- For a workspace-wide view of spend, tokens and cost by model, the Usage and cost page in the console shows the same numbers without a client.
- If you run one workspace per customer, the workspace total is that customer’s cost.
- To be told when runs get expensive rather than asking, use a cost rule in custom alerts.