A native disclosure of context occupancy, token categories and estimated costs from application-supplied rates or model catalogs.
Preview
Context usage · 10%
Example model
12,400 of 128,000 tokens10%
Input tokens
10,800
Output tokens
1,600
Reasoning tokens
400
Cached input tokens
4,200
In action
Read the supplied context budget
Context usage · 10%
Example model
12,400 of 128,000 tokens10%
Input tokens
10,800
Output tokens
1,600
Reasoning tokens
400
Cached input tokens
4,200
Token usage and limits come from the application. Optional prices are supplied per million tokens; cached input and reasoning remain subsets of input and output. Unknown counts and rates stay unavailable.
When to use
Use it for
Supply usedTokens and maxTokens for context occupancy; usage supplies separate input, output, reasoning and cached-input counts.
pricing accepts inputPerMillion, outputPerMillion, reasoningPerMillion, cacheReadPerMillion and optional currency. No model catalog or prices are fetched.
Pass modelId and a supplied Tokenlens or models.dev catalog to resolve a model name, context limit, and rates. Explicit model, maxTokens, and pricing replace their resolved counterparts.
resolveContextPricing exposes the same lookup for application composition. Qualified provider/model ids select provider pricing; a providerless id must match exactly one model.
Catalog context tiers require the actual input token count through usage.inputTokens, or inputTokens in resolver options. Unknown, ambiguous, or invalid metadata remains unavailable.
Cached input is a subset of input; reasoning is a subset of output. Separate rates replace the parent rate for those subsets rather than adding duplicate charges.
Missing or invalid data displays Unavailable. Costs are estimates from the supplied rates, not provider billing totals.
Use open/onToggle for a controlled native disclosure or defaultOpen for the initial state. CSS-only markup shows supplied values.
Avoid
Treating missing token counts or unknown pricing as zero.
Displaying rates without verifying them in the application that supplies them.
Install
React package
npm install @noorddev/vlak-react
Load the stylesheet once at your app root, then import the components you use.
import "@noorddev/vlak-react/css";
import { ContextUsage, type ContextPricingCatalog } from "@noorddev/vlak-react";
Per-component imports are available at @noorddev/vlak-react/components/context-usage.
Copy the source
npx @noorddev/vlak-cli add context-usage
Adds the component and its dependencies to components/vlak/. Follow the StyleX setup to compile the source in your application.
Also accepts Omit<DetailsHTMLAttributes<HTMLDetailsElement>, "title">.
The ref reaches HTMLDetailsElement.
resolveContextPricing (function)
Resolve cached catalog metadata without fetching, timers, or a bundled pricing snapshot. Qualified provider/model ids select the provider's prices; providerless ids must be unique. Catalogs may be obtained with Tokenlens or models.dev in application/server code.
Keyboard
Keys
Does
Tab
Focuses the native disclosure summary
Enter, Space
Opens or closes usage details
Accessibility
The summary exposes current occupancy in text. The shared Progress names the token range and clamps its visual extent.
Unknown limits omit the meter; usage above the supplied limit retains the real count and an explanation.
Native details attributes and its ref are forwarded.
Markup
The same styles are available as CSS. Native HTML provides the static presentation; React or application code supplies state updates and actions.