diff --git a/ui/src/components/ProviderQuotaCard.test.tsx b/ui/src/components/ProviderQuotaCard.test.tsx
index 6555c5144f8..7d8bdae4fa1 100644
--- a/ui/src/components/ProviderQuotaCard.test.tsx
+++ b/ui/src/components/ProviderQuotaCard.test.tsx
@@ -15,6 +15,30 @@ describe("provider cost shares", () => {
expect(html).toContain("50% of company budget");
expect(html).not.toContain("of allocation");
});
+ it("renders normalized mixed-era OpenAI totals consistently across models, windows, and subscription shares", () => {
+ // The report API combines one inclusive historical row and one exclusive
+ // receipt-backed row into 40 ordinary + 160 cached + 20 output per group.
+ const rows = (["metered_api", "subscription_included"] as const).map(billingType => ({
+ provider: "openai", biller: "openai", model: `test-${billingType}`, billingType,
+ costCents: 18, inputTokens: 40, cachedInputTokens: 160, outputTokens: 20,
+ apiRunCount: billingType === "metered_api" ? 2 : 0,
+ subscriptionRunCount: billingType === "subscription_included" ? 2 : 0,
+ subscriptionInputTokens: billingType === "subscription_included" ? 40 : 0,
+ subscriptionCachedInputTokens: billingType === "subscription_included" ? 160 : 0,
+ subscriptionOutputTokens: billingType === "subscription_included" ? 20 : 0,
+ }));
+ const html = renderToStaticMarkup();
+ expect(html).toContain('>400 in');
+ expect(html).toContain('>40 out');
+ expect(html.match(/220 tok/g)).toHaveLength(2);
+ expect(html).toContain("440 tok");
+ expect(html).toContain("50% of token usage via subscription");
+ expect(html.match(/title="50% of provider tokens"/g)).toHaveLength(2);
+ expect(html).toContain("$0.36");
+ });
it("hides historical spend-to-monthly-budget comparisons for providers and billers", () => {
const common = { budgetMonthlyCents: 1000, totalCompanySpendCents: 20000, weekSpendCents: 0, showBudgetUtilization: false };
const provider = renderToStaticMarkup();