Graphorin API reference v0.7.0
Graphorin API reference / @graphorin/provider / / CostAccumulator
Interface: CostAccumulator
Defined in: packages/provider/src/middleware/with-cost-tracking.ts:42
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:44 |
Methods
reset()
reset(): void;Defined in: packages/provider/src/middleware/with-cost-tracking.ts:50
Clear all accumulated totals.
Returns
void
totalFor()
totalFor(providerName, modelId): CostTrackingTotals;Defined in: packages/provider/src/middleware/with-cost-tracking.ts:48
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:46
Snapshot of every tracked provider::model → totals.
Returns
ReadonlyMap<string, CostTrackingTotals>