storybook: show the Jev task cost estimate per 1M tasks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SWn6etZjfGz6p8NWYkCQve
This commit is contained in:
Claude committed 2026-09-24 22:36:52 +00:00
1 parent 121cf126bd
commit 226103d1d1
2 files changed
+4 -2

No files matched your search

@@ -918,6 +918,8 @@ function JevConfidence({
const formatTokens = (value: number) => value.toLocaleString("en-US");
const formatUsd = (value: number) => `$${value < 0.01 ? value.toFixed(5) : value.toFixed(4)}`;
/** Whole dollars with separators, for the at-scale estimate (for example "$160"). */
const formatScaledUsd = (value: number) => `$${Math.round(value).toLocaleString("en-US")}`;
function TaskCostSummary({ jev, title, titlePending }: { jev: LiveStats; title: ModelUsage | null; titlePending: boolean }) {
const total = jev.cost + (title?.cost ?? 0);
@@ -946,7 +948,7 @@ function TaskCostSummary({ jev, title, titlePending }: { jev: LiveStats; title:
<div className="flex items-baseline gap-3 text-foreground">
<span className="w-24 shrink-0 sm:w-32">Total</span>
<span className="min-w-0 flex-1 break-words font-mono text-muted-foreground">
{title ? `≈ $${(total * 1000).toFixed(2)} per 1,000 tasks` : ""}
{title ? `≈ ${formatScaledUsd(total * 1_000_000)} per 1M tasks` : ""}
</span>
<span className="shrink-0 font-mono">{formatUsd(total)}</span>
</div>
@@ -102,7 +102,7 @@ Every task shows an **Estimated cost** table:
is the real Messages API body for `claude-haiku-4-5`: a short system
instruction, the prompt, and `max_tokens: 64`. $1 per million input tokens and
$5 per million output tokens.
- **Total**, with a per-1,000-tasks estimate.
- **Total**, with an estimate for 1 million tasks like this one.
Token counts are estimated at about four characters per token. In production,
read `usage` from each response instead.