Search

↑↓ to move↵ to openesc to closetop 6 documentation results

Book a demoTry TokenTriage

In development · Explore the product preview. Join the launch list or book a walkthrough.

Claude Code

Connect Claude Code.
See the requests it sends.

Bring a coding session through the TokenTriage gateway. Inspect its model usage, tool loops, and request records — the connection and visibility layer of the release control plane.

Start it the way you always do

tokentriage wrap --agent claude -- claude

Read it back, in another terminal

tokentriage top --by model --since 24h

Start with a configured gateway using the quickstart. This page covers the client connection and request inspection; supported changes are managed in the product’s release workflow.

A lab run of Claude Code traffic, priced per modelA rollup from a lab run of the TokenTriage proxy. Twenty-seven requests tagged with the agent name claude cost 0.179280 US dollars in total: eighteen on claude-sonnet-4-5 at 0.116640, five on claude-opus-4-8 at 0.054000, and four on claude-haiku-4-5 at 0.008640. Five of the twenty-seven turns were tool loops, costing 0.032400. Every figure was priced against the pricing snapshot litellm at 2026-07-14, revision 179affb. The upstream was a mock with fixed token counts.tokentriage top --by modelagent=claude27 requests tagged claude · bars are dollarsclaude-sonnet-4-518$0.1166claude-opus-4-85$0.0540claude-haiku-4-54$0.0086what those requests cost5 of those 27 turns were tool loops — $0.0324$0.1793litellm@2026-07-14#179affbLAB RUN · MOCK UPSTREAM
Redrawn from the run below, figure for figure. A real proxy and the real pricing pipeline, against a mock upstream with fixed token counts. So these are arithmetic, not a bill.
1 row per request
written as it goes out, not read back from a transcript afterwards
5 ways to group it
model, agent (one name per wrapped client), step class, trace and MCP tool
0 prompt bytes by default
every row stores a SHA-256 and nothing else, until you turn capture on
1 gateway endpoint
connect the client through the gateway you configured

The client and the gateway

Keep your coding workflow. Add a request record.

Claude Code stays your coding client. TokenTriage observes the requests that pass through the gateway, with a clear boundary around what those requests can tell you.

In your client

The coding session you already use

  1. Keep the coding workflow

    The wrapper starts Claude Code with its base URL and request headers set, then hands the terminal to the client. Your editing and tool workflow stays in Claude Code.

  2. Route new requests through the gateway

    Start the TokenTriage gateway first. The wrapper points the session at that endpoint, where requests can be recorded. It does not import sessions that already happened.

  3. Read the client and gateway together

    The client knows its own internal activity. The gateway records the requests that cross it. Use each record for the part of the workflow it can actually observe.

At the gateway

The proxy the request crosses on its way out

  1. It is the request itself

    The proxy carried it. So the row exists. One HTTP request, one line, priced at the moment it went out, with the model, five kinds of token and the turn it belonged to already on it.

  2. Inspect other connected clients alongside it

    Other supported clients can send requests through the same gateway. Label their traffic to inspect model usage and request behavior alongside the Claude Code session.

  3. And it cannot see a sub-agent

    Sub-agent identity is not on the wire, so it is not on the row. Nothing here guesses at one. What is on the wire is the session, the model, five kinds of token, the tool result and the turn — and that is what you get.

The gateway records requests that cross it. It does not reconstruct client internals or traffic sent around it. The setup below keeps that boundary explicit.

What the wrapper sets, and what it cannot

The read-back

One agent name, one trace id, and a week of work comes apart.

A wrapped session carries one agent name and one trace id. That is enough to split your week by model, by turn and by tool. No database.

$ tokentriage top --by agent --since 1h
AGENT   REQS  INPUT  OUTPUT  CACHE-R  CACHE-W  REASON  CACHE-SAV  COST       P50        P90        P99
(none)  6     5664   2100    1536     0        0       21.3%      $0.001632  $0.000272  $0.000272  $0.000272
claude  27    24300  5940    0        3456     0       0.0%       $0.179280  $0.006480  $0.010800  $0.010800
TOTAL   33    29964  8040    1536     3456     0       4.9%       $0.180912

A real run. The proxy, the pricing pipeline, and a mock upstream with fixed token counts. The (none) row is the other traffic crossing the same proxy while the session ran.

Five kinds of token, five columns

Input, output, cache read, cache write and reasoning are separate figures, never one total. On live traffic the cache-read column is usually the largest: Claude Code re-reads your whole conversation every turn at the cached rate. The mock above returns none. That is why it reads zero.

The dollar names the table it came from

litellm@2026-07-14#179affb is the catalogue, the date it was cut and the revision. It rides on the row, into the export and onto the receipt. Six months on, the figure re-derives.

Unknown is never zero

A model the price table cannot resolve is marked, excluded from the total, and counted on the line underneath it. Zero is not the answer. A total that quietly summed those rows would look complete and understate what you spent.

Every column, and the three that mislead

The expensive part

A tool result is an input cost. It just belongs to the next turn.

Agentic clients resend the whole conversation every turn. Counted naively, one tool loop bills itself over and over. This one is counted once. Here is where.

{
  "req_id": "tt_fdvnwttde4te7wpavfjry2g7oq",
  "trace": {
    "agent": "claude", "step_class": "tool_loop",
    "step_class_source": "derived"
  },
  "usage": {
    "input_tokens": 900, "output_tokens": 220,
    "cache_write_tokens": 128, "source": "provider"
  },
  "cost": {
    "usd": 0.00648,
    "pricing_key": "anthropic/claude-sonnet-4-5",
    "pricing_snapshot": "litellm@2026-07-14#179affb"
  },
  "mcp": [
    {
      "tool": "Read", "calls": 1, "result_bytes": 9000,
      "input_tokens_attributed": 900, "estimated": true
    }
  ]
}

One real row, trimmed to four blocks. Read returned nine kilobytes, and input_tokens_attributed is what those bytes cost the request after it.

Counted once, not N²/2

Tool accounting is per turn. Each invocation is counted at the turn that first feeds its result back, so a loop of N turns reports N calls rather than roughly N²/2. The naive count grows like the square of your patience.

The turn classes itself

step_class_source: "derived". Nothing was configured to make this a tool loop. The proxy read the request, saw a tool result going back up, and said so on the row.

The estimate admits it is one

Attributed input tokens are characters over four, and estimated: true travels with them. The table prints the warning above itself. A number that had to guess should say so where you read it.

$ tokentriage top --by step-class --since 1h
STEP-CLASS  REQS  INPUT  OUTPUT  CACHE-R  CACHE-W  REASON  CACHE-SAV  COST       P50        P90        P99
tool_loop   5     4500   1100    0        640      0       0.0%       $0.032400  $0.006480  $0.006480  $0.006480
user_turn   28    25464  6940    1536     2816     0       5.7%       $0.148512  $0.006480  $0.010800  $0.010800
TOTAL       33    29964  8040    1536     3456     0       4.9%       $0.180912

The same hour, split by turn. tool_loop against user_turn is the fastest answer to “is the tool loop eating my budget”. Same run, same disclosure.

How a tool result gets attributed

Before you type it

Four things people ask, and what else ends up in the file.

Answered with the mechanism, not a reassurance. In the order they arrive. Then three things that land in the same file without being Claude Code.

“Do I have to change how I work?”

No. The wrap command starts Claude Code with the base URL already set and a trace header attached, then hands the terminal straight back to it. Your flags, your MCP servers, your keybindings, your settings file. Nothing inside Claude Code is configured, and if you would rather not wrap it, export the variable yourself.

“Does it slow Claude Code down?”

It is on the path, so the honest answer is a measurement and not a promise. Two histograms report what the proxy added on the way in and when the first token arrived, and the same figure is on every row as latency.overhead_us. Take your own reading, on your own box. We do not publish somebody else’s.

“Does my prompt leave my machine?”

In the local setup shown here, the gateway forwards requests to the provider you configure. By default, the request record keeps a prompt hash rather than the prompt text. Full content capture is a separate setting; review your configuration and deployment before sending sensitive traffic.

“Is this going to cost me money?”

TokenTriage is a paid product with a trial. Product fees and model-provider usage are separate. Review the pricing page for current plans, limits, and deployment options.

Measure the overhead on your own box
  • Other connected clients

    Connect another supported client through its base URL and use request labels to distinguish its traffic. Keep the gateway record useful across the clients you operate.

    Point something else at it
  • Your application, beside your editor

    Label the traffic from your application and coding sessions. Request records can then be grouped by the tenant, feature, or workload labels you supply.

    Split a month by something you recognise
  • Controls at the gateway

    Configured virtual-key budgets can refuse requests at the gateway. Inspect the recorded refusal alongside the traffic that led to the limit.

    Explore gateway governance

Connect a session. Start with evidence.

Follow the quickstart, connect Claude Code, and inspect the requests that reach the gateway. Then explore how TokenTriage connects supported production changes to evaluation, release review, and runtime evidence.

The rest of the platform: Release evidence · Release governance · Guardrails · Routing & trials.

Claude Code and Claude are trademarks of Anthropic. TokenTriage is an independent project and is not affiliated with, sponsored by, or endorsed by Anthropic.