Skip to content
Calm motion: animations on this site only fade, with no movement

Context meter ​

How much of the context window the tokens use

Shows, in a small ring, how full the context window of a model is. The context window is the number of tokens that a model can read at one time. A click on the ring opens a breakdown of the parts. Put it next to the prompt input.

Basic
  • parts is a list of the parts that use tokens. Each part has a label, a number of tokens, and an optional color. max is the size of the window in tokens.
  • The ring and the share show the sum of the parts. At the warn share (default 0.8), the ring turns to the warning color. At 95%, it turns to the danger color.
  • The breakdown shows a bar with the parts, the tokens of each part, the free tokens, and the sum. Numbers show in short form, such as 41.5K.
  • The ring is a button. Its name says the use in words, for example "80% of the context used: 160K of 200K tokens". Change the words with labels or a label pack: title, free, and used (a function of the used tokens, the window, and the share).

Usage ​

ts
import { BlessContextMeter } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
parts*BlessContextPart[]—the parts of the context that use tokens
max*number—the size of the context window, in tokens
warnnumber0.8the share at which the ring turns to the warning color
labelsPartial<{ title: string; free: string; used: (used: string, max: string, share: string) => string; }>—

Released under the MIT License. Character names and artwork belong to their owners.