Skip to content

TokenMeter

A one-line context-window meter: used/limit token counts, a utilization bar, and a percentage (Context: 78k/200k [####......] 39%). From warningThreshold of the limit (80% by default) it adds NEAR LIMIT, and from errorThreshold (95% by default) OVER LIMIT — words, not color alone, so the state reads in monochrome.

Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.

TokenMeter(
usage: const TokenUsage(contextUsed: 128000, contextLimit: 200000),
label: 'Context',
width: 20,
)
ParameterTypeDefaultDescription
usage:TokenUsagerequiredToken and context-window metrics to display.
label:String'Context'Visible and semantic label placed before the usage value.
width:int10Number of cells used by the utilization bar; zero hides the bar.
warningThreshold:double0.8Context-usage ratio at which the near-limit state begins.
errorThreshold:double0.95Context-usage ratio at which the over-limit state begins.

TokenMeter is defined in packages/fleury/lib/src/catalog/model_status_bar.dart.

Category: Agent surfaces · All widgets