ReqLLM. Usage
(ReqLLM v1.13.0)
View Source
Usage normalization helpers.
Provides a stable entrypoint for normalizing provider usage maps to ReqLLM's canonical usage shape.
Summary
Functions
Merge two usage maps, taking the max of numeric fields (to handle cumulative streaming usage) and recomputing derived totals.
Normalize usage into a canonical map.
Zero out a usage map for application-layer cache hits.
Functions
Merge two usage maps, taking the max of numeric fields (to handle cumulative streaming usage) and recomputing derived totals.
Normalize usage into a canonical map.
Guarantees canonical token keys:
:input_tokens:output_tokens:total_tokens
Also guarantees compatibility aliases:
:input:output
Zero out a usage map for application-layer cache hits.
Existing keys are preserved where possible, but numeric values are reset so callers can reliably distinguish response-cache hits from provider-native cache reads that still incur an API call.