Skip to content

Graphorin API reference v0.7.0


Graphorin API reference / @graphorin/provider / / WithCostTrackingOptions

Interface: WithCostTrackingOptions

Defined in: packages/provider/src/middleware/with-cost-tracking.ts:97

Options for withCostTracking.

Stable

Properties

PropertyModifierTypeDescriptionDefined in
onUsage?readonly(info) => voidHook fired on every finish event with the parsed usage. The hook receives the underlying provider's name + modelId so the caller can route into a per-model accumulator.packages/provider/src/middleware/with-cost-tracking.ts:103
priceLookup?readonly(info) => | { cachedReadPerMtok?: number; cacheWritePerMtok?: number; inputPerMtok?: number; outputPerMtok?: number; } | nullOptional pricing lookup. When set, the middleware computes costUsd from the returned price and surfaces it on the hook. cachedReadPerMtok / cacheWritePerMtok price the prompt-cache legs (core-provider-02); when omitted, cache tokens are billed at the full input rate (never cheaper than reality, so absent price data degrades to the pre-cache behaviour).packages/provider/src/middleware/with-cost-tracking.ts:123