Context Meter
How full the context window is. A small ring for the toolbar that shifts to warning at 80% and destructive at 95%, with a breakdown on hover.
Installation
pnpm dlx shadcn@latest add @jds/context-meter
Usage
import { ContextMeter } from "@/components/ai/context-meter"
<ContextMeter
used={usage.totalTokens}
max={200_000}
breakdown={[
{ label: "System and tools", tokens: 12_400 },
{ label: "Messages", tokens: 48_000 },
]}
/>API Reference
ContextMeter
| Prop | Type | Default |
|---|---|---|
usedTokens currently in context. | number | – |
maxContext window size. | number | – |
breakdownShown in the hover card. | { label, tokens }[] | – |
showLabelPercentage next to the ring. | boolean | true |