suiss/ui · AI
Context
Shows how much of the model's context window the conversation has used, with a breakdown on hover.
Context shows how much of the model's context window the conversation has used. The trigger shows the share used, and a Hover Card opens a Progress bar with the input, output and reasoning tokens.
Installation
Context is built with the Hover Card, Progress and Button components.
Or use the suiss/ui CLI:
Usage
AI SDK
Read usage from the metadata on the agent's message. messageMetadata runs when the stream finishes.
limit is the model's context window. The AI SDK does not send it, so set it from the model you use.
API Reference
See Hover Card and Progress.
Accessibility
- The trigger is a button, so the breakdown opens on focus as well as on hover.
- Give the progress bar an accessible name with
aria-label, such as "Context used". - Put the share in the trigger text, so it is announced without opening the card.