Skip to main content
kRouter
All posts
How kRouter works

Usage said Kiro made one request in 18 hours. It was making all of them

A captured request is rewritten on the way through, so by the time usage recorded it the only thing left to attribute by was whoever served it. The page was not incomplete — it was wrong in a way that read as an answer.

Kodelyth · The team behind kRouter
7 min read

On a live install with two IDEs being captured and answered on every turn, the usage page said this:

kiro: 1 request, 18h ago

Kiro was being captured continuously. So was Antigravity. Every turn from both was going through kRouter and being answered. None of it was lost — all of it was booked under claude, the provider that actually served the requests.

The page was not missing data. It was reporting confidently, and reporting something false. Anyone opening usage to answer "is my Kiro traffic actually being captured?" would have concluded it was not, and gone off to debug a capture pipeline that was working perfectly.

That is a worse failure than an empty table. An empty table makes you ask a question. A populated one answers it.

Why the information was gone

Capture rewrites the model. That is the entire point of it: an Antigravity turn asking for gemini-3.8-flash-medium leaves kRouter as whatever model you mapped that alias to, and is served by whatever provider owns it.

Follow what survives that rewrite. By the time the router records usage it holds the model that was actually called and the provider that actually served it. The fact that this request arrived from Antigravity, over a MITM transport, is not in the request any more — it was consumed at interception and never travelled further.

So usage attributed by the only thing left: who served it. Which is correct, and also not the question anyone was asking.

The tool was known, at interception time, with certainty. It was simply thrown away one layer before the layer that needed it.

Carrying it one hop

The interceptor now sends the tool to the router in a header, x-krouter-mitm-tool.

The value is derived from the host that already selected the handler. That matters more than it sounds: the hostname is what decides which tool's logic runs, so deriving the label from the same place means there is no second source of truth that can drift. A request handled by the Antigravity path cannot be labelled Kiro, because both come from the same decision.

It arrives on an ordinary request, so it is not trusted

This is where a header like this usually goes wrong. It arrives on a normal client request to /v1/*, which means anything that can reach the API can set it. Treating it as authoritative would let any caller write arbitrary strings into your accounting.

So the router validates it against the known tool list. The worst a forged value can do is mislabel its own request as one of five real tools — it cannot invent a tool, inject a field, or affect any other request's attribution. The blast radius is one row, and the row is the attacker's own.

That is the right amount of trust for this. The header is a hint about provenance that improves a report; it is not an authorisation decision, and it should not be defended as though it were one, nor accepted as though it could not be forged.

No migration

It lands in meta, a column that had been written as a literal {} on every row since it was added.

So nothing needs migrating. An old row reads back with no tool — which is not a gap to backfill, it is the truth about that row. kRouter genuinely did not know which tool made that request at the time it was written, and inventing a value now would be fabricating history to make a chart look complete.

How it breaks down

byTool is keyed tool|model|provider, matching how byEndpoint already works. So a tool breaks down by the model that actually served it, which is the interesting part precisely because the model is the thing that got rewritten. You can see that your Antigravity Gemini turns were served by Claude, which is the whole reason you set up capture.

It is deliberately not a partition of the day. Only captured requests have a tool, so the numbers in byTool do not add up to the numbers in byModel, and they are not supposed to.

That makes the empty state meaningful. An empty byTool beside a busy byModel now means something specific and useful: requests are flowing, and none of them are being captured. That is a real diagnosis, available at a glance, and it is the diagnosis that the old "kiro: 1 request" display actively prevented you from reaching.

The pattern

Two bugs shipped in this release and both were silent, and both had the same shape as the retirement notice and the status that lied: a system reporting something plausible instead of reporting that it did not know.

Attribution by serving provider was a reasonable default that produced a number. The number looked like an answer. Nobody questions a number that looks like an answer, which is exactly why a wrong one survives longer than a missing one.

If a value is unknown, the honest display is empty. Usage now has a column that is empty when capture is off, and that emptiness is the most informative thing on the page.

Kodelyth · The team behind kRouter

Published by Kodelyth, the team that builds kRouter. Posts are drafted with AI assistance and reviewed by a person before they go out. kRouter is free and MIT licensed.

Install kRouter