Utility
Terminal
Installation
$ pnpm dlx shadcn@latest add @termcn/ink/token-usage
Usage
import { TokenUsage, ContextMeter } from "@/components/ui/token-usage";<TokenUsage prompt={2450} completion={890} model="gpt-4o" showCost />API Reference
TokenUsage
| Prop | Type | Default |
|---|---|---|
prompt | number | required |
completion | number | required |
model | string | - |
showCost | boolean | false |
ContextMeter
| Prop | Type | Default |
|---|---|---|
used | number | required |
limit | number | required |
label | string | - |
showPercent | boolean | true |
warnAt | number | 75 |
criticalAt | number | 90 |
width | number | 20 |
Notes
Accessibility
termcn exposes the following behavior through Ink's terminal accessibility APIs. This is not a browser ARIA or general WCAG-conformance claim.
- Screen reader: Ink labels and semantic state expose the component without relying on visual styling alone.