Skip to Content
Rius

How do I track token usage in Claude Code?

Rius records the input tokens, output tokens and cache reads of every Claude Code model call once you install the Rius plugin and turn tracing on for a folder. Each session becomes one trace, with tokens and cost on each model call and on each subagent. You find them in the trace list, and per developer on the Users page. Four commands set it up: two to install, one to sign in, one to pick a folder.

How it works

The Rius plugin for Claude Code turns each session into one trace. Tracing is off until you enable a folder, and installing sends nothing.

The trace is a tree:

  • The session is the root.
  • Each turn is one prompt and everything it caused.
  • Each model call carries the model, input and output tokens, cache reads and writes, and cost.
  • Each tool call (Bash, Read, Edit and so on) is nested under the model call, with errors marked on the span.
  • Each subagent is nested under the call that started it and has its own model calls, tokens and cost.

Subagent spans matter for token tracking. In long sessions, subagents can account for more than half of all tokens, and you can see that split because they have their own spans.

A folder enabled with /rius:enable-here sends structure only: the span tree, models, tokens, cost, timing, tool names and error types. Token counts are part of that, so you track usage without sending any prompts, replies, file contents or command output. If you also want the text, enable the folder with /rius:enable-content-here. Everyone with access to the workspace can read what is sent, so agree as a team which repos send content.

Rius works out cost from the model and token counts at API rates. You never send a cost value.

Set it up

  1. Install the plugin in a terminal:

    claude plugin marketplace add glassflow/rius-coding-agents && claude plugin install rius@rius-coding-agents

    The plugin needs Python 3.9 or later on your PATH. To install from inside Claude Code instead, run /plugin marketplace add glassflow/rius-coding-agents, then /plugin install rius@rius-coding-agents, then /reload-plugins, one at a time.

  2. Run /rius:login. In the browser, sign in or sign up, pick a workspace and click Connect. The plugin stores an ingest-only key for this machine and workspace.

  3. cd into the repo you want to measure and run /rius:enable-here. Start Claude Code from inside that repo, not from a parent folder, because a session started elsewhere can stop being traced partway through.

  4. Run /rius:status. The first line reads Rius tracing: on, and Spans exported this session counts what has been sent.

  5. Work as usual, then open the trace list at console.rius-glassflow.com and open the session. The waterfall shows tokens and cost on each model call.

  6. To ask in plain language, run /mcp, pick rius and sign in with your Rius account. Then ask, for example, “Which of my Claude Code sessions in the last 24 hours cost the most, and what did the tokens go on?”

To stop tracing a folder, run /rius:disable-here. For a whole team, see Track Claude Code usage and cost across a team. The full command list, troubleshooting and sign-out steps are in the Claude Code plugin guide.

What you get

  • Tokens per model call. Input, output and cache reads and writes, visible in the waterfall for the session and for every subagent.
  • Cost per call. Cost comes from the token counts at API rates and adds up per session.
  • Live sessions. A session appears in the trace list while it runs, and its spans fill in as Claude Code works.
  • Per developer totals. With plugin 0.6.2 or later, each session is recorded under the email the developer signed in with. The Users page lists each developer with Traces, Failed traces and Cost for the selected window, 7 days by default. Sort by Cost to see who drives spend.
  • A view of the agent. The Agents page shows Claude Code as an agent named claude-code, with its traces, errors and cost for the window.
  • Questions from the terminal. The plugin brings the Rius MCP server, so you can ask Claude about your sessions without leaving it.

What Claude Code tracing does not give you:

  • Cost measures usage, not what you pay. Rius prices tokens at API rates, so on a Claude Pro or Max subscription it is not your bill.
  • The model’s thinking is never sent, even when content is on.
  • Model-call durations are approximate, because Claude Code’s transcript records when a reply finished but not when the request went out. Tool durations are exact.
  • The Users and Agents figures count a session only once it has ended. A session that never ends cleanly, because Claude Code crashed or was killed, is never counted there, though the trace list still shows it.
  • Sessions from plugins older than 0.6.2, or sent with a key you stored yourself, land in the anonymous row on Users.

When something else fits

  • If you trace other coding agents too, the Coding agents page compares which ones report tokens and cost. Codex (beta) does, while Cursor (beta) shows no tokens or cost because its hooks do not report usage.
  • If you build your own agent on the Claude Agent SDK, use that SDK’s integration instead of the plugin.
  • If you only want to keep prompt text off Rius, enable folders with /rius:enable-here. That keeps token counts and cost.

Still stuck? Get help

Last updated on