Skip to main content

Interface: IUsage

Defined in: contracts/types.ts:189

Token accounting of one model call.

Reported by the LLMClient after every call: to the trace, to the usage adapter (addUsage), on the assistant ITurn, and summed over the steps of a run into IAnswerResponse.usage.

Properties​

cachedInputTokens?​

optional cachedInputTokens?: number

Defined in: contracts/types.ts:195

Of inputTokens, the ones read from the provider's prompt cache, when reported.


cacheWriteInputTokens?​

optional cacheWriteInputTokens?: number

Defined in: contracts/types.ts:201

Of inputTokens, the ones written to the provider's prompt cache by this call, when reported.

Anthropic bills them above the input price (1.25× for the 5-minute cache); the first call of a profile writes, the next ones read.


inputTokens​

inputTokens: number

Defined in: contracts/types.ts:191

All prompt tokens, the cached ones included.


outputTokens​

outputTokens: number

Defined in: contracts/types.ts:193

Tokens the model generated: the answer and its tool calls.