Skip to content

Graphorin API reference v0.7.0


Graphorin API reference / @graphorin/core / / Usage

Interface: Usage

Defined in: packages/core/src/types/usage.ts:10

Token / cost metrics for a single LLM call.

cost is optional because the framework cannot compute it without a pricing snapshot - providers/middleware fill it in (e.g. through the separate @graphorin/pricing package) when the snapshot is available.

Stable

Properties

PropertyTypeDescriptionDefined in
cachedReadTokens?numberPrompt tokens served from the provider's prompt cache (a subset of promptTokens), billed at the discounted cache-read rate.packages/core/src/types/usage.ts:29
cacheWriteTokens?numberPrompt tokens written to the provider's prompt cache this call (a subset of promptTokens), billed at the cache-write premium where the provider charges one (Anthropic does; OpenAI does not report writes).packages/core/src/types/usage.ts:35
completionTokensnumber-packages/core/src/types/usage.ts:17
cost?Cost-packages/core/src/types/usage.ts:37
promptTokensnumberTotal input tokens for the call, INCLUDING any prompt-cache reads and writes (cachedReadTokens / cacheWriteTokens are informational subsets, not additions). This matches the context size the model saw.packages/core/src/types/usage.ts:16
reasoningTokens?numberReasoning tokens billed IN ADDITION to completionTokens (exclusive; adapters that receive an inclusive total split it so the sum stays exact). Cost formulas may add this to the output leg without double-counting.packages/core/src/types/usage.ts:24
totalTokensnumber-packages/core/src/types/usage.ts:36