Graphorin API reference v0.5.0
Graphorin API reference / @graphorin/provider / / CostAccumulator
Interface: CostAccumulator
Defined in: packages/provider/src/middleware/with-cost-tracking.ts:38
A process-local cost accumulator (PS-8). Wire CostAccumulator.onUsage into withCostTracking and read the running totals — keyed by provider × model — back via CostAccumulator.totals / CostAccumulator.totalFor.
Stable
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
onUsage | readonly | (info) => void | Pass this to withCostTracking's onUsage. | packages/provider/src/middleware/with-cost-tracking.ts:40 |
Methods
reset()
reset(): void;Defined in: packages/provider/src/middleware/with-cost-tracking.ts:46
Clear all accumulated totals.
Returns
void
totalFor()
totalFor(providerName, modelId): CostTrackingTotals;Defined in: packages/provider/src/middleware/with-cost-tracking.ts:44
Running totals for one provider × model (zeros when unseen).
Parameters
| Parameter | Type |
|---|---|
providerName | string |
modelId | string |
Returns
totals()
totals(): ReadonlyMap<string, CostTrackingTotals>;Defined in: packages/provider/src/middleware/with-cost-tracking.ts:42
Snapshot of every tracked provider::model → totals.
Returns
ReadonlyMap<string, CostTrackingTotals>