ResponseMetrics
A response's numbers on one line: time to first token, total time, tokens in and out, reasoning, cost. Empty before a response; while one streams it shows what is known so far.
- First token
- 420 ms
- Total
- 3.14 s
- Tokens
- 1,204 in · 856 out
- Reasoning
- 312
- Cost
- $0.009725
<ResponseMetrics timeToFirstToken={420} duration={3140} inputTokens={1204} outputTokens={856} reasoningTokens={312} cost="0.009725" />import { ResponseMetrics, formatLatency } from "@logicplanes/kaeso-ui/playground";Props
coststring | nullUSD as a decimal string, shown with its own decimals (two at least, six at most): "0.004213" reads "$0.004213", "1.2311" reads "$1.2311", zero reads "$0" and less than a millionth reads "< $0.000001".
costKnownboolean = trueFalse when the model has no price for what it made: the cost reads "Unknown" (true by default).
durationnumber | nullMilliseconds from sending to the last token.
formatCost((cost: string) => string)Writes
costin place of the dollar format, such as in another currency at the day's rate.inputTokensnumber | nullThe tokens sent, once known.
liveboolean = falseA response is arriving: Total counts up from
startedAt, and an unknown cost isn't called Unknown yet.outputTokensnumber | nullThe tokens received, once known.
reasoningTokensnumber | nullOf the output tokens, those spent reasoning. Shown when the provider reported them.
size"md" | "sm" = smThe text size.
startedAtnumberWhen the request was sent (Date.now()): while live, Total counts up quietly, in tenths of a second and in whole seconds past ten, until
durationarrives.timeToFirstTokennumber | nullMilliseconds from sending to the first token.