Skip to content
Back

Token usage chartPro

Daily tokens as an area with the cached share as a line: hover any day for its numbers, switch the range and the totals roll.

oxyn add token-usage-chart
Token usage
See your token usage from Sat, Aug 29 – Sun, Sep 27.
Total usage188.10 M
Avg. daily usage6.27 M
Est. cost$370.28
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

  • Daily tokens as an area with the cached share as a dashed line (spark_path).
  • Hovering a day or arrowing through the plot draws a rule and a tooltip with the date, Tokens and Cached.
  • Range buttons (30d, 90d, All) re-window the plot, the date line and the totals: Total usage, Avg. daily usage and Est. cost (usage_totals: uncached tokens at per_m_cents a million, cached at a tenth), which roll to their new values.

When not to use

  • A launch countdown with digits that roll per unit, a compact one-line variant, hours absorbing days when days are hidden, and a live state with a pulsing dot at zero: use Countdown instead.
  • A total that moves clearly: use Animated counter instead.
  • A collapsible JSON tree with search, paging for long arrays, copy value or path, the current path under the tree and full keyboard moves: use JSON viewer instead.

Installation

Token usage chart 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 token-usage-chart

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

Quarter

Three months, three ranges.

Token usage
See your token usage from Sat, Aug 29 – Sun, Sep 27.
Total usage188.10 M
Avg. daily usage6.27 M
Est. cost$370.28
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

Short

Two weeks of data.

Token usage
See your token usage from Sat, Jun 27 – Fri, Jul 10.
Total usage73.11 M
Avg. daily usage5.22 M
Est. cost$144.71
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

TokenUsageChart

PropTypeDefaultDescription
daysrequiredVec<UsageDay>—Days, oldest first; the last is today.
start(i32, u32)(2026, 177)Year and day of the year of the first day (for the date labels).
per_m_centsf64300.0Price of a million uncached tokens, cents.
titleString"Token usage"Title.
rangesVec<usize>vec![30, 90, 0]Range options in days (0 = all).

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
←or→Read the previous / next day
EscHide the tooltip

Accessibility

  • The plot is one focusable image with the totals in its label; the day tooltip is role=status.
  • Range buttons are aria-pressed toggles.
From the spec
  • The plot is one focusable image with totals in its label; the tooltip is role=status; range buttons are aria-pressed.

Motion & interaction

Timing
  • Plot fade 350 ms; totals roll 260 ms; tooltip 120 ms.
  • Reduced motion: no fade or roll.

Responsive behaviour

  • Fills its card up to 420 px; the area stretches, strokes stay 1.5 px.
Edge cases (spec)
  • Up to 420 px; the area stretches and strokes stay 1.5 px (non-scaling).

Notes for AI

  • Import TokenUsageChart from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: TokenUsageChartEl in oxyn_gpui.
  • Props to set first: days.
  • 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