Skip to Content

How do I query LLM cost per model over MCP?

Rius answers LLM cost per model over MCP through the workspace_metrics_overview tool, which returns the workspace total and cost by model. Connect the Rius MCP server to your client and ask in plain language, for example which models cost the most this week. For one agent or service, the client uses agent_traces_summary instead.

How it works

You ask a question and your MCP client picks the tool. Two tools matter for cost per model:

  • workspace_metrics_overview gives the workspace total and cost by model.
  • agent_traces_summary gives the summary for one agent or service, optionally per time bucket.

The numbers come from how Rius prices each call. When a span arrives, Rius looks up its requested model (gen_ai.request.model) in LiteLLM’s public model-price catalog and multiplies each token count by that model’s rate, with cache reads and writes at their own rates. A span that carries only gen_ai.response.model is not priced. Cost is fixed on the span when it is written, so a later price change does not rewrite past calls.

What comes back is a list-price estimate in US dollars. It uses each model’s standard rates, so it will differ from your invoice if you have batch pricing, long-context tiers or negotiated discounts.

A model that is not in the catalog, or a span with no token usage, gets an empty cost, not zero. Totals add up only the calls that were priced, so a model Rius cannot price does not inflate or zero out the breakdown. If nothing in a window was priced, the summary tools report $0.00, while the console shows a dash.

Set it up

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

The OAuth sign-in opens the first time a session uses the server. If you already use the Rius plugin for Claude Code, it registers this server as rius, so you do not add it again. Other clients and the headless setup are on the MCP page.

  1. For an agent that runs without a browser, such as a CI job, use a read-scoped API key instead of OAuth. Ingest keys, the ones the SDK uses, cannot query through MCP, so mint a key with the read capability.

  2. Check the connection by asking: “Who am I in Rius, and which workspaces can I access?” Your client should call get_me and list your workspaces.

  3. Ask for cost per model. Questions that work well:

    • “What did my agents cost this week, and which service is spending the most?”
    • “What do planner’s gpt-4o runs cost?”
    • “Break down this month’s LLM cost by model.”

    Name the period you care about in the question, such as this week or the last 24 hours. If you belong to several workspaces, say which one. When the same workspace name exists in more than one of your organizations, give it as org/workspace, because an ambiguous name returns an error.

  4. To compare the answer with the console, open Usage and cost. Its cost-by-model chart and models table show calls, latency, tokens and cost for each model over the window you pick.

What you get

  • Cost per model, and the workspace total, from your real telemetry, without opening the console.
  • A per-agent or per-service view through agent_traces_summary, optionally split by time bucket.
  • Figures in US dollars, list-price estimates fixed on each span when it was written.
  • Honest gaps: an unpriced model shows an empty cost rather than a misleading zero. Track LLM and agent cost explains how each call is priced and what an unpriced model looks like.
  • Read-only access. Querying cost never changes anything in your workspace.

When something else fits

  • If you want to scan the models table visually, with calls, latency percentiles and tokens next to each model’s cost, use Usage and cost in the console.
  • If you want a notification when cost per trace goes over a threshold, set up a cost alert instead of asking each time. The cost guide covers it.

Still stuck? Get help

Last updated on