Skip to content

TokenFormat

Category: Extensions

Source: token_format.dart

Compact, single-column token count: 999, 1.2k, 42k.

Functions

String formatCompactTokens(int n)

Compact, single-column token count: 999, 1.2k, 42k.

String? formatContextGauge(int used, int? window)

Context-occupancy gauge: 14k/131k ctx (11%). Numerator is the latest turn's billed input (what the model saw); denominator is the resolved context window. Returns null — so the caller omits the segment — when the window is unknown/non-positive or no turn has run yet.

Released under the MIT License.