Skip to content

Commit 219abba

Browse files
dcramercodex
andauthored
fix(dashboard): Round costs to two decimal places (#857)
Dashboard cost values now consistently render as USD with exactly two decimal places across list rows, conversation details, charts, tooltips, stats, and exports. The shared formatter test covers both sub-cent values and rounding up to the next dollar. Co-authored-by: GPT-5 Codex <noreply@openai.com>
1 parent cf9aca5 commit 219abba

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

packages/junior-dashboard/src/client/format.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ export function summarizeCost(
533533
return total !== undefined || componentTotal > 0 ? summary : undefined;
534534
}
535535

536-
/** Format estimated model cost in USD with useful sub-cent precision. */
536+
/** Format estimated model cost in USD for consistent dashboard display. */
537537
export function formatCostSummary(
538538
summary: CostUsageSummary | undefined,
539539
): string {
@@ -542,7 +542,7 @@ export function formatCostSummary(
542542
style: "currency",
543543
currency: "USD",
544544
minimumFractionDigits: 2,
545-
maximumFractionDigits: 6,
545+
maximumFractionDigits: 2,
546546
}).format(summary.total);
547547
}
548548

packages/junior-dashboard/tests/format.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ describe("dashboard token formatting", () => {
8282
cacheWrite: undefined,
8383
total: 0.0121,
8484
});
85-
expect(formatCostTotal(usage)).toBe("$0.0121");
85+
expect(formatCostTotal(usage)).toBe("$0.01");
86+
expect(formatCostTotal({ cost: { total: 1.999 } })).toBe("$2.00");
8687
});
8788

8889
it("formats cumulative conversation runtime", () => {

0 commit comments

Comments
 (0)