/** Gateway billing mode attached by Veryfront Cloud usage envelopes. */ export type GatewayBillingMode = "direct" | "deferred"; /** Provenance of the cost values attached to runtime usage. */ export type RuntimeUsageCostSource = "gateway" | "missing" | "partial"; /** Completeness of the usage captured for a runtime response. */ export type RuntimeUsageCaptureStatus = "complete" | "partial" | "missing"; /** * Canonical provider-neutral usage reported by text-generation runtimes. * * Token counters are non-negative safe integers. Cost and credit counters are * non-negative finite numbers. Use {@link sanitizeRuntimeUsage} or * {@link mergeRuntimeUsage} when values originate outside the process. * Normalized usage is a data-only record and may have a null prototype so an * absent field cannot resolve through a polluted global prototype. Use * `Object.hasOwn(record, field)` instead of instance methods such as * `record.hasOwnProperty(field)`. */ export interface RuntimeUsage { inputTokens?: number; outputTokens?: number; totalTokens?: number; cacheCreationInputTokens?: number; cacheReadInputTokens?: number; /** Compatibility alias for {@link RuntimeUsage.cacheReadInputTokens}. */ cachedInputTokens?: number; reasoningTokens?: number; billableInputTokens?: number; billableOutputTokens?: number; costUsd?: number; providerCostUsd?: number; providerInputCostUsd?: number; providerOutputCostUsd?: number; veryfrontChargeUsd?: number; veryfrontInputChargeUsd?: number; veryfrontOutputChargeUsd?: number; veryfrontBilledUsd?: number; costCredits?: number; costSource?: RuntimeUsageCostSource; billingMode?: GatewayBillingMode; usageCaptureStatus?: RuntimeUsageCaptureStatus; } /** Read a non-negative safe-integer token counter. */ export declare function readRuntimeTokenCount(value: unknown): number | undefined; /** * Add two optional token counters without returning an unsafe integer. * * An absent pair remains absent; an overflowing pair is rejected. */ export declare function sumRuntimeTokenCounts(first: number | undefined, second: number | undefined): number | undefined; /** Read a non-negative finite cost or credit value. */ export declare function readRuntimeCost(value: unknown): number | undefined; /** Read a trusted gateway billing mode from provider metadata. */ export declare function readGatewayBillingMode(value: unknown): GatewayBillingMode | undefined; /** * Merge two usage snapshots using the latest valid value for each counter. * * A deferred billing mode remains deferred across internal gateway turns. * When input/output counters are present, `totalTokens` is the greater of the * valid reported total and their overflow-safe sum. This preserves * provider-reported reasoning tokens without allowing an undercount. * * Only own data properties participate. Inherited properties and accessors are * ignored without invoking their getters. The returned canonical record has a * null prototype so reads of absent fields cannot fall through to a polluted * global object prototype; its enumerable JSON shape remains unchanged. */ export declare function mergeRuntimeUsage(current: RuntimeUsage | undefined, next: RuntimeUsage | undefined): RuntimeUsage | undefined; /** * Validate and normalize one externally sourced usage snapshot. * * Returns `undefined` when the input is absent or contains no valid own data * fields. Inherited properties and accessors are ignored without invoking * their getters. */ export declare function sanitizeRuntimeUsage(usage: unknown): RuntimeUsage | undefined; //# sourceMappingURL=runtime-usage.d.ts.map