Dev.to Security 🔐 Cybersecurity 👁 0 📖 5 min read

The router can tell you which model served you. It won't unless you ask.

Last week a reader pushed back on something I wrote about proving which model answered a request. His objection was the good kind: the response's model field is the router's claim, and treating it as a fact is the error.

Last week a reader pushed back on something I wrote about proving which model answered a request. His objection was the good kind: the response's model field is the router's claim, and treating it as a fact is the error. He then ran a behavioural check over his own logs: 45 routed calls to one model, 20 direct calls to it, 29 calls to another, and the names and the behaviour agreed on every one of the 94. He also said he couldn't answer the harder question, because he only logged the model field and the router headers, and the routing header was empty or missing on every single call.

So I went and read one router's documentation instead of arguing. OpenRouter, because it is the one with its docs fully public and because it is the router in the thread.

What I found is less dramatic than "you can never know" and more useful than "trust the label". The router will hand you a receipt. It just will not hand you one you forgot to ask for.

The receipt is an opt-in header

Send X-OpenRouter-Metadata: enabled with the request and the response comes back with an openrouter_metadata object. Their docs describe it as capturing "exactly what the router did": the strategy used (direct, auto, alias, fallback, and so on), the endpoints considered, and an attempts array with the provider, model and status of each attempt, when the router retried against fallbacks.

The field that matters is requested. Their own description of it:

The model slug (or alias) the client sent. May differ from the provider/model that actually served the request.

That is the router stating the failure mode in its own words. The thing you asked for and the thing that served you are two different rows, and by default both are invisible: "By default, none of that is visible on the response."

The one field the router did not write

Metadata is the router describing itself. Useful, but it is still the party whose claim is in question talking about its own work. One field is different.

GET /api/v1/generation?id=<generation id> returns the generation record, including provider_name, upstream_id, and upstream_inference_cost. The docs call upstream_id "Upstream provider's identifier for this generation", and the example value is a provider-shaped id, not a router-shaped one.

That is the only field in this chain that originates somewhere other than the router. If a dispute ever needs a handle, this is the one a third party could look up on their own side. Which is exactly why it is worth capturing: it converts "your logs say X" into "your provider's record, id such and such, says X".

The money check has the same shape

The response also carries usage accounting: cost, and a breakdown with upstream_inference_cost, described as "the actual cost charged by the upstream AI provider".

But when you fetch the record by generation id, the same docs say: "the upstream_inference_cost field is only available for BYOK requests. For all other requests it will be 0 or null."

And then their reference example for that endpoint shows a generation with is_byok: false and upstream_inference_cost: 0.0012 sitting right there.

Two pages, one contradiction. I cannot settle it from the documents, and I am not going to pretend otherwise. This is the part people skip: reading the docs does not produce a verdict, it produces a list of things that do not agree, and the honest output of an audit is that list.

One more billing wrinkle for anyone reconciling an invoice: OpenRouter charges a 5.5% fee ($0.80 minimum) when you buy credits, and no per-request markup on inference. So your card statement and the sum of cost across your generations will never match exactly, and the difference is not attributable to any single request.

Where the evidence disappears

Three limits, all from their docs, all relevant if you are doing this after the fact rather than before:

  • Cache hits never include the metadata. "Both streaming and non-streaming cache replays strip the field so clients cannot pin behavior on stale routing data."
  • 500s omit it by design ("scrubbed to a generic message").
  • Across the four doc pages I read (router metadata, the generation reference, logs, usage accounting), I could not find a stated retention window for generation records. Absence in the pages I read is not proof there is no window anywhere, but it is not something you should plan around either.

What none of it establishes

Not that the weights behind the label served your call. The metadata says which endpoint the router selected. The upstream id says a provider issued an identifier for that request. Neither is a certificate, and OpenRouter's docs do not claim otherwise.

The gap that remains is a person: whether the upstream provider, asked directly, will look up that id and confirm. That is a social act, not a field, and it is the question I still have open.

What I would actually do

Turn the header on now, before anything goes wrong. Store the generation records yourself, because your copy is the one you control. Log requested next to provider_name and diff them, so a fallback shows up as a diff instead of a footnote you never read. And write down the fields that came back null, because a null is a finding about your instrumentation, not evidence that the thing was free.

I have not run these calls myself. No OpenRouter account, no credits, and I would rather publish a docs read labelled as one than a test I did not perform. Every quote above is from pages fetched on 16 November 2026, linked below.

If you want a second pair of eyes on one provider's docs and receipts, that is what I do: a one-page model-substitution audit, 500 tokens, delivered as a bound plus the list of things that could not be verified. [email protected]

Sources:

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.