Generation statsPro
Numbers for a reply while it streams: first-token delay, tokens per second (with a tiny trend line), tokens out and spend climb next to the model logo, then freeze and expand into where the time went.
oxyn add generation-stats- TTFT
- —
- Speed
- 0 tok/s
- Output
- 0
- Cost
- $0.0055
The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.
Rendered from Rust at build time · goes live when visible
When to use
- Show how a streaming reply performs: time to first token, speed with a sparkline, output tokens and cost.
When not to use
- Replays a multi-agent run on one clock: use Agent timeline instead.
- One model at a glance: use Model card instead.
- A small automation on a single rail: use AI workflow instead.
Installation
Generation stats is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.
oxyn add generation-statsUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Streaming
Counting up while the reply streams.
- TTFT
- —
- Speed
- 0 tok/s
- Output
- 0
- Cost
- $0.0055
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Breakdown
Finished, with the latency breakdown and session totals (Oxyn extra).
- TTFT
- 420 ms
- Speed
- 80 tok/s
- Output
- 649
- Cost
- $0.02
649 tokens in 8.2s · $0.02 · input 1,840 tokens at $3.00/1M, output at $15.00/1M
This session: 3 replies · 2,365 tokens · $0.05
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Inline
A compact chip under a message (Oxyn extra).
- TTFT
- —
- Speed
- 0 tok/s
- Output
- 0
- Cost
- $0.0023
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Error
Failed part way; what arrived is kept.
- TTFT
- —
- Speed
- 0 tok/s
- Output
- 0
- Cost
- $0.0055
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
GenerationStats
| Prop | Type | Default | Description |
|---|---|---|---|
nowrequired | ClockMs | — | Host clock. |
scenario | String | "stream" | `stream` (starts on mount), `done`, `idle` or `error`. |
variant | String | "card" | `card` or `inline`. |
model | usize | Default::default() | Model (0 Claude Sonnet 4.5, 1 GPT-5, 2 Gemini 2.5 Flash). |
looping | bool | Default::default() | Replay after finishing. |
session | bool | Default::default() | Show session totals (Oxyn extra). |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| Tab | Stop or Run, then the breakdown toggle |
| EnterorSpace | Stop, run again, retry or open the breakdown |
Accessibility
- Each value is a labelled term; numbers are tabular in reserved widths, so updates never shift.
- The status is a word with an icon; the error uses role alert.
- The breakdown toggle has aria-expanded; the sparkline is decorative.
From the spec
Done summary is announced once (not every tick); the breakdown is a disclosure. Every action returns the line the polite live region announces. The focus outline shows only for keyboard focus.
Motion & interaction
Numbers count up with the stream and settle; the sparkline grows right; expanding shows queue / TTFT / generation bars.
Timing
Everything on screen is derived from the host clock now (no timers in the component), so playback, tests and the GPUI view agree.
| Transition | Duration | Easing |
|---|---|---|
| Queue | 60 ms | — |
| TTFT | 420 ms | — |
| Loop gap (demo) | 2500 ms | — |
Reduced motion: streamed text and moves appear at their end state; progress still advances, without travel animation.
Responsive behaviour
- The strip wraps under 520 px; Stop and the toggle follow the stats.
- Inline drops labels and the sparkline to fit under a message.
Edge cases (spec)
Tabular figures keep widths stable while counting. Inline chip wraps under the message on narrow columns. Checked at 1440, 768 and 390 px in light and dark with no text overlap. Chrome is monochrome grey; colour is semantic only (success, warning, danger, info) plus the providers' coloured brand marks.
Notes for AI
- Import
GenerationStatsfromoxyn_dioxusand includeSTATUS_INDICATOR_CSSplus the token stylesheet once. - A GPUI version exists:
AiKitViewinoxyn_gpui. - Props to set first:
now. - It reads a clock (
now) for live timers; pass one clock for the whole page rather than one per component. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.