Why attribution is usually a reconstruction

The invoice’s problem

One number per provider. One key per team at best, one shared key at worst. Who spent what is written down, if anywhere, in each team’s own logs.

A provider’s invoice is one number. Behind it, each team holds its own key, or several teams share one, and the question of who spent what is answered by collecting each team’s logs, if they were kept, and reconciling them against the invoice, if the totals allow it. A shared key makes the question unanswerable. A key per team answers it only as well as each team’s logging does, and only until someone asks about a user rather than a team.

Attribution done afterwards is attribution done by whoever has time to do it. The invoice arrives monthly. The request that spent the tokens carried an identity at the moment it was made, and nothing wrote it down.

Every token spent has an owner

Every request that reaches a provider through PreRoute arrived with an identity: the credential the organisation issued to the application, verified before any processing began, naming the tenant it belongs to, the application, the user where the credential names one, and the grant it acts under. Only a request the organisation has accepted can spend tokens at all. The identity is checked at the edge, carried through the pipeline, and written into the audit record of the call the request became.

deployer configuration tokens models company data

The owner is written into the audit record at the moment of the call.

What the audit record holds, per call

Recorded on every provider call

  • The identity

    The tenant, the application, the user and the grant the request arrived under.

  • The tokens

    Input and output, as the provider reported them.

  • The provider and the model

    Which one answered, and which model it ran.

  • The attempt

    One audit record per attempt, including an attempt that failed after it reached the provider.

Where each part comes from

  • From the verified credential

    Never from the request body. A body that names a different tenant is refused, not believed.

  • From the provider’s own report

    When a provider reports no usable count, the audit record says so and why, rather than writing a zero.

  • From the routing decision

    The candidate that was selected under policy, the same way for every request.

  • At the moment of the call

    Written as it happens, with a trace id the gateway minted and your own correlation id if you sent one.

Who spent what, on which model, under which application, stops being a reconstruction and becomes a lookup: by tenant, by application, by user where one is named, by grant, for any period you keep the records, from the same audit trail that holds every allow and every deny.

Counts, not prices

Left to finance, on purpose

  • Prices and currencies
  • Budgets in money
  • Reports and dashboards

The gateway counts tokens. It does not price them. There is no rate card in it, no currency and no cost figure, and that is a decision rather than a gap: the gateway sees tokens and finance sees money, and a price list in the request path would be a second source of truth for a number finance already owns. What flows out is the token counts and the provider and model identity, on the audit stream, for the organisation’s own tooling to join against its own rates.

The limits that do exist are in the gateway’s own units. A token quota per tenant, with a cap per identity inside it, both opt-in and checked before the call is made. Request rate limits per application identity and per tenant. A per-tenant cap on concurrent requests. Each is enforced before a token is spent, and each is a bound on consumption, not a bill. Operator metrics carry the tenant, the provider and the model, never a user, an application or a request identifier: those live in the audit record, where access is governed, and nowhere else.

That is what PreRoute is built for: the control plane every AI request passes through, where the identity that spends a token is verified before the call and written into the audit record of it.

Read next