fn snapshot_from_openrouter_key(
payload: KeyResponse,
balance: Option<f64>,
) -> Result<UsageSnapshot, ProbeError>Expand description
Map an OpenRouter key payload into a snapshot. Window-free: a pay-per-token key has no plan window and, when uncapped, no denominator, so nothing here synthesises a utilization.
balance is the account-wide figure from the credits fetch, or
None when that fetch failed - it never fails the snapshot.
Fallible on purpose. A 200 whose body carries no data envelope, or
an envelope with none of the three usage figures, is a response
forge cannot read rather than a bill of zero - and since set_usage
takes any snapshot to Ready without inspecting it, mapping those
to zeroes would report a confident number nothing prompts anyone to
doubt. An absent figure alongside a present sibling is a real zero
and maps as one.