Skip to content
Back

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
Claude Sonnet 4.5Waiting for first token
TTFT
—
Speed
0 tok/s
Output
0
Cost
$0.0055
The code is part of Oxyn Pro

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.

Get Pro

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

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.

Terminal
oxyn add generation-stats

Usage

Dioxus · rust
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Examples

Streaming

Counting up while the reply streams.

Claude Sonnet 4.5Waiting for first token
TTFT
—
Speed
0 tok/s
Output
0
Cost
$0.0055
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Breakdown

Finished, with the latency breakdown and session totals (Oxyn extra).

Claude Sonnet 4.5Done
TTFT
420 ms
Speed
80 tok/s
Output
649
Cost
$0.02
Queue60 ms
Time to first token420 ms
Generation7741 ms

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 code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Inline

A compact chip under a message (Oxyn extra).

Waiting for first token
TTFT
—
Speed
0 tok/s
Output
0
Cost
$0.0023
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Error

Failed part way; what arrived is kept.

Claude Sonnet 4.5Waiting for first token
TTFT
—
Speed
0 tok/s
Output
0
Cost
$0.0055
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

API reference

GenerationStats

PropTypeDefaultDescription
nowrequiredClockMs—Host clock.
scenarioString"stream"`stream` (starts on mount), `done`, `idle` or `error`.
variantString"card"`card` or `inline`.
modelusizeDefault::default()Model (0 Claude Sonnet 4.5, 1 GPT-5, 2 Gemini 2.5 Flash).
loopingboolDefault::default()Replay after finishing.
sessionboolDefault::default()Show session totals (Oxyn extra).

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
TabStop or Run, then the breakdown toggle
EnterorSpaceStop, 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.

TransitionDurationEasing
Queue60 ms—
TTFT420 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 GenerationStats from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: AiKitView in oxyn_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.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI