Context window meter
ProHow full a model’s context window is and with what: system prompt, tools, files and conversation against the limit and the room kept for the reply, warnings at 80% and 95%, and Compact with the room it will win back. A small version sits in a composer.
pnpm dlx shadcn@latest add @caliper/context-window-meterContext windowClaude Sonnet 5.5 · 200k
84%151k / 200k
- System prompt3,2002%
- Tools (14)11.8k6%
- Files (6)64.4k32%
- Conversation71.9k36%
- Kept for the reply16.0k8%
- Free32.7k16%
Over 80%. Long answers may be cut short.
When to use #
Use it for
- Assistants that work with long conversations or many files.
- Developer tools that show what a request sends.
Skip it when
- Plan usage and billing; use the usage meter.
Installation #
pnpm dlx shadcn@latest add @caliper/context-window-meter
Adds its 5 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage #
Import it from your copy of the source. The example behind the preview comes with the source. It is built from contextUsage and ContextWindowMeter.
import { contextUsage, ContextWindowMeter } from "@/components/ui/context-window-meter"
The worked example comes with Pro
The 38-line example behind the preview opens here with a Pro or Team licence.
API reference #
contextUsage
component
No props of its own; it accepts the native props of its root element.
ContextWindowMeter
component
Accessibility #
It exposes status semantics, with aria-label, aria-hidden and aria-describedby kept in step with state. Changes that matter are announced through a live region.
Keyboard and focus handling comes from Radix popover: arrow keys move through items, Enter and Space select, and Escape closes and returns focus.
Motion #
It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.