A stats strip under one assistant message for one model call: which model answered, whether it is waiting, streaming, done, stopped or failed, then time to first token, speed, output tokens and cost. The numbers count while it streams and settle on the exact values, and Details opens the phase timings and a token table in place.
On this page
- Under each chat answer
- Model playground runs
- Eval and prompt logs
- Debugging a slow call
Examples
Sample runs
With no props it plays three calls in turn once it is on screen: one that finishes, one stopped by the person and one that fails. Under reduced motion it shows the first call, settled.
Done, with Details open
Failed, with Retry
Still frames
Every status, as it renders on the server and on first paint.
Installation
Installation is part of Pro
Pro components install from a licensed registry. The live preview stays open to everyone.
Props
- status
"waiting"|"streaming"|"done"|"stopped"|"failed"- Where the call is. Leave every prop out to play the sample runs.
- model
string- The model's name. Its logo comes from the model icons when the name matches one.
- usage
{ input, output, cached?, reasoning? }- Tokens so far. Cached is input read from a prompt cache; reasoning is thinking the model did not show.
- pricing
{ input, output, cached?, reasoning? }- US dollars per million tokens. Cached falls back to input, reasoning to output.
- timings
{ queue?, firstToken?, reasoning?, total?, rates? }- Default
{} - Milliseconds from send. reasoning is how long it thought after the first token. rates is the speed series; measured while it streams when left out.
- error
string- Why it failed: shown under the head and in the announcement.
- defaultExpanded
boolean- Default
false - Details open on first render, with no entrance.
- expanded / onExpandedChange
boolean / (open) => void- Controlled Details.
- onRetry
() => void- Shows Retry when the call failed.
- icon
ReactNode- Default
model logo - A mark of your own instead of the model's logo.
- className
string- On the outer section.
| Prop | Type | Default | Description |
|---|---|---|---|
| status | "waiting" | "streaming" | "done" | "stopped" | "failed" | - | Where the call is. Leave every prop out to play the sample runs. |
| model | string | - | The model's name. Its logo comes from the model icons when the name matches one. |
| usage | { input, output, cached?, reasoning? } | - | Tokens so far. Cached is input read from a prompt cache; reasoning is thinking the model did not show. |
| pricing | { input, output, cached?, reasoning? } | - | US dollars per million tokens. Cached falls back to input, reasoning to output. |
| timings | { queue?, firstToken?, reasoning?, total?, rates? } | {} | Milliseconds from send. reasoning is how long it thought after the first token. rates is the speed series; measured while it streams when left out. |
| error | string | - | Why it failed: shown under the head and in the announcement. |
| defaultExpanded | boolean | false | Details open on first render, with no entrance. |
| expanded / onExpandedChange | boolean / (open) => void | - | Controlled Details. |
| onRetry | () => void | - | Shows Retry when the call failed. |
| icon | ReactNode | model logo | A mark of your own instead of the model's logo. |
| className | string | - | On the outer section. |
Accessibility
- The strip is a labelled section ("Sonnet 5.5 response stats") and the cells are a description list, so each value is read with its name.
- Rolling digits are hidden from assistive tech; the plain number is read instead. The sparkline is an image with its first and last speed in its name.
- One polite sentence is announced when the call settles ("Sonnet 5.5: Done in 3.6s. 412 output tokens at 204 tokens per second, $0.0190."), never while it streams.
- Details is a button with aria-expanded and aria-controls; the panel is a region with a table whose rows and columns have headers. Retry is a plain button and shows only on a failed call.
- Status is said in words, not by colour alone. Reduced motion makes every change instant.
What it handles
- 01Works out speed and cost from what the stream already gives you: token counts, prices per million and a few timestamps. Speed is read live from the last second of counts and settles on the exact average from first token to end.
- 02Rolls the counting cells (speed, output tokens, cost) on the motion lib's odometer, so only the digits that change turn, and lands on the exact numbers the moment the call ends.
- 03Says where the call is in words and a glyph: waiting, streaming, done in 3.6s, stopped at 1.9s, or failed with the reason and a Retry button.
- 04Opens Details in place: a phase ribbon where queue, first token, reasoning and output take their share of the time, the first token is pinned, and the output phase is drawn as its own speed profile.
- 05Lists every kind of token (input, cached input, output, reasoning) with its price per million and its cost, cached falling back to the input price and reasoning to the output price.
- 06Announces one sentence when the call settles and nothing while it streams, so a screen reader is not read every tick.
States
- First render
- Nothing moves; the values given are shown as they are
- none
- Streaming
- Speed, output tokens and cost roll only the digits that change, carried from the right
- 420ms, ease out
- Done
- The check draws in; the numbers settle on the exact values
- 180ms, ease out
- Failed
- The glyph shakes once and the X draws; Retry appears
- 280ms, ease out
- Details opens or closes
- The panel unfolds in place
- 180ms open, 120ms close, ease out
- Phase ribbon while streaming
- Segments resize to their share of the time
- 280ms, ease in-out
- Reduced motion
- Every change is instant; sample runs show one settled call
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing moves; the values given are shown as they are | none |
| Streaming | Speed, output tokens and cost roll only the digits that change, carried from the right | 420ms, ease out |
| Done | The check draws in; the numbers settle on the exact values | 180ms, ease out |
| Failed | The glyph shakes once and the X draws; Retry appears | 280ms, ease out |
| Details opens or closes | The panel unfolds in place | 180ms open, 120ms close, ease out |
| Phase ribbon while streaming | Segments resize to their share of the time | 280ms, ease in-out |
| Reduced motion | Every change is instant; sample runs show one settled call | 0ms |
Works with
- Cost MeterShares its price and formatting helpers; use it for the live bill of a whole run with a budget.
- Context WindowSits beside it in a chat header for how full the context is.
- Model PickerPicks the model whose calls this strip reports.
- Message ActionsThe row of actions that sits next to it under an answer.
- ChartIts Sparkline draws the speed in the strip.
When to use
When to use
- Under each assistant message in a chat or playground: which model answered, how fast the first token came, its speed, tokens and cost.
- Comparing calls in a model playground or an eval log, where each answer keeps its own receipt with the phase timings and a token table.
When not to use
- The live bill of a whole agent run against a budget: use Cost Meter.
- How full the model's context is and what fills it: use Context Window.
- Spend and credits across many runs against a plan: use Usage Meter.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Response Stats to my app and wire it to my own data.
- I need under each assistant message in a chat or playground: which model answered, how fast the first token came, its speed, tokens and cost. Set that up with the Knowns UI Response Stats.
- Which Response Stats props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "response-stats" }) and search_docs({ query: "response stats" }). Pro props, full examples and source come back once your license key is in the MCP config.