Skip to content
Eskais UI

Agent tasks

Usage

Token, time and cost usage of an agent task: UsageStat for a card and UsageTable on Table, with compact counts, the exact value in the title, honest unknown and estimated values, and summaries side by side as columns.

Example

Input tokens60K
Output tokens10.5K
Cost$0.43 (estimated)
MetricValue
Input tokens60K
Output tokens10.5K
Cache read36K
Cache writeunknown
Reasoning tokens4.2K
Duration20s
Active timeunknown
Cost$0.43 (estimated)

Installation

npx shadcn@latest add @eskais/usage

Usage

Import
import {  UsageQuantity,  UsageStat,  UsageTable,  usageFormatter,  usageLabels,  usageLabelsEs,  usageMetrics,} from "@/components/ui/usage"import { UsageGrid, usageGridMetrics } from "@/components/ui/usage-grid"

API reference

UsageQuantity

Takes Omit<PartProps<"span">, "children"> &.

UsageStat

Takes PartProps<"div"> &.

UsageTable

Takes Omit<PartProps<"table">, "children"> &.

UsageGrid

PropTypeDefault
usageUsageSummary–
labelsPartial<UsageLabels>–
localestring–
formatCurrency(usd: number) => string–
variant`"compact"` lists the figures as term and value rows, for a narrow side column."tiles" | "compact""tiles"

Also takes <div> attributes and render except children.

Other exports

usageFormatterusageLabelsusageLabelsEsusageMetricsusageGridMetricstype UsageColumntype UsageKindtype UsageLabelstype UsageMetrictype UsageQuantityPropstype UsageStatPropstype UsageTablePropstype UsageGridProps

Accessibility

  • UsageTable is a real table; unknown values show a dash, estimates a tilde.

Agent actions

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.