Something went wrong. Try again.
Something went wrong. Try again.
1234567891011121314151617181920212223242526/** * Usage — token/cost accounting for a provider call (PROTOCOL §11). * * Emitted by the `usage` event (finer-grained than turn-end) and carried on `turn_end`. * All fields are optional except input/output so providers that don't report cache/cost * still validate. * * `provider` + `model` form the per-model/per-provider aggregation key the daemon's usage * log stamps onto each event (saga vr7kgx.20). Both optional + additive — providers that * omit them still validate; the aggregate falls back to a sentinel key. */import { Type, type Static } from '@sinclair/typebox';
export const UsageSchema = Type.Object({ input: Type.Integer(), output: Type.Integer(), cache_read: Type.Optional(Type.Integer()), cache_write: Type.Optional(Type.Integer()), cost: Type.Optional(Type.Number()), context_tokens: Type.Optional(Type.Integer()), model: Type.Optional(Type.String()), provider: Type.Optional(Type.String()),});
export type Usage = Static<typeof UsageSchema>;