import Row from "@moduletrace/twui/layout/Row"; import Span from "@moduletrace/twui/layout/Span"; import Stack from "@moduletrace/twui/layout/Stack"; import type { UsageOverview } from "@/src/types"; import formatTokens from "@/src/utils/format-tokens"; import { UsageHarnessTitles } from "../(data)/usage-harness-titles"; type Props = { row: UsageOverview["models"][number]; }; /** * One model's line: which provider and model it was, what it was used for, * how many calls and tokens it took, and the price of a thousand tokens * worked out from both, which is what makes models comparable. */ export default function UsageModelRow({ row }: Props) { const per_thousand = row.cost && row.total_tokens ? `$${((row.cost / row.total_tokens) * 1000).toFixed(3)}` : "-"; return ( {row.model_name || row.model_slug} {row.provider_name} - {UsageHarnessTitles[row.harness] || row.harness} {formatTokens({ tokens: row.calls })} {formatTokens({ tokens: row.prompt_tokens })} {formatTokens({ tokens: row.completion_tokens })} {formatTokens({ tokens: row.total_tokens })} {per_thousand} {row.cost ? `$${row.cost.toFixed(2)}` : "-"} ); }