Skip to content

Rulvar API reference


Rulvar API reference / @rulvar/rulvar / priceEntryUsage

Function: priceEntryUsage()

ts
function priceEntryUsage(entry, priceUsd): PricedUsage;

Defined in: packages/core/dist/index.d.ts

The single pricing fold over one terminal entry, shared by the kernel ledger and the CostReport fold so a run's total and its per-model breakdown can never disagree. Each slice is priced at ITS OWN model's rate. A price function returning NaN or a negative amount (a broken user-supplied rate) is treated exactly like a missing row: the slice folds as unpriced instead of poisoning or crediting the totals (v1.20.0 review follow-up). The optional third argument hands the price function the entry's seq, so a segment-aware snapshot can price the row under the rates of ITS segment (RV505); two-argument price functions simply ignore it.

Parameters

ParameterType
entryJournalEntry
priceUsd(servedBy, usage, seq?) => number | undefined

Returns

PricedUsage