Expand description
Compression statistics tracking across three layers.
§Layers
- tokenless (external hook/rewrite): reported via
TOKENLESS_TOKENSenv var - compress middleware (agent-proxy):
SchemaCompressor+ResponseCompressor - upstream (API response): usage fields extracted by cost module
§Data flow
tokenless env var → parse → CompressionStats → ctx.extensions
→ compress middleware appends schema/response stats
→ cost module reads to compute saved_costStructs§
- Compression
Stats - Complete multi-layer compression statistics.
Functions§
- read_
tokenless_ stats - Parses the
TOKENLESS_TOKENSenvironment variable intoCompressionStats.