From f2a66c304355766530a9fbd39e22c2160a348d67 Mon Sep 17 00:00:00 2001 From: Ayinkx Date: Wed, 28 Oct 2026 12:32:16 +0100 Subject: [PATCH 1/3] fix(billing): label estimated costs in reports --- app/templates/billing/usage.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/templates/billing/usage.html b/app/templates/billing/usage.html index d12c7ac..7d8526a 100644 --- a/app/templates/billing/usage.html +++ b/app/templates/billing/usage.html @@ -62,7 +62,7 @@

Totals

Prompt tokens{{ dashboard.totals.prompt_tokens }}
Completion tokens{{ dashboard.totals.completion_tokens }}
Operations{{ dashboard.totals['count'] }}
-
Estimated cost{{ dashboard.currency.symbol }}{{ '%.6f'|format(dashboard.totals.cost_estimate) }}
+
Estimated cost{{ dashboard.currency.symbol }}{{ '%.6f'|format(dashboard.totals.cost_estimate) }}

{{ title }}

Prompt Completion Total tokens - Estimated cost + Estimated cost @@ -92,7 +92,7 @@

{{ title }}

{{ row.prompt_tokens }} {{ row.completion_tokens }} {{ row.total_tokens }} - {{ dashboard.currency.symbol }}{{ '%.6f'|format(row.cost_estimate) }} + {{ dashboard.currency.symbol }}{{ '%.6f'|format(row.cost_estimate) }} {% endfor %} @@ -118,7 +118,7 @@

Daily time series

Prompt Completion Total tokens - Estimated cost + Estimated cost @@ -129,7 +129,7 @@

Daily time series

{{ row.prompt_tokens }} {{ row.completion_tokens }} {{ row.total_tokens }} - {{ dashboard.currency.symbol }}{{ '%.6f'|format(row.cost_estimate) }} + {{ dashboard.currency.symbol }}{{ '%.6f'|format(row.cost_estimate) }} {% endfor %} From 6f4b7dd5ec0030c6f9070012045b706be7c86c01 Mon Sep 17 00:00:00 2001 From: Ayinkx Date: Wed, 28 Oct 2026 12:32:20 +0100 Subject: [PATCH 2/3] fix(billing): label estimated costs in reports --- app/templates/admin/usage_report.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/templates/admin/usage_report.html b/app/templates/admin/usage_report.html index b8b9404..3342502 100644 --- a/app/templates/admin/usage_report.html +++ b/app/templates/admin/usage_report.html @@ -75,7 +75,7 @@

Filtered totals

Prompt tokens{{ summary.prompt_tokens }}
Completion tokens{{ summary.completion_tokens }}
Total tokens{{ summary.total_tokens }}
-
Estimated cost{{ currency.symbol }}{{ '%.6f'|format(summary.cost_estimate) }}
+
Estimated cost{{ currency.symbol }}{{ '%.6f'|format(summary.cost_estimate) }}

Usage rows

Model Status Tokens - Estimated cost + Estimated cost @@ -111,7 +111,7 @@

Usage rows

{{ row.model or 'unknown' }} {{ row.status or 'unknown' }} {{ row.total_tokens or 0 }} - {% if row.cost_estimate is none %}—{% else %}{{ currency.symbol }}{{ '%.6f'|format(row.cost_estimate) }}{% endif %} + {% if row.cost_estimate is none %}—{% else %}{{ currency.symbol }}{{ '%.6f'|format(row.cost_estimate) }}{% endif %} {% endfor %} From 95f0a82c728972aacb713e800ab8c1b20bc086ed Mon Sep 17 00:00:00 2001 From: Ayinkx Date: Wed, 28 Oct 2026 12:32:29 +0100 Subject: [PATCH 3/3] test(billing): assert estimate labels in admin usage report --- tests/test_admin_usage_report.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_admin_usage_report.py b/tests/test_admin_usage_report.py index 1dbe86d..6cf5f4a 100644 --- a/tests/test_admin_usage_report.py +++ b/tests/test_admin_usage_report.py @@ -206,3 +206,17 @@ def test_filters_persist_in_pagination_links(self, client, login): html = response.get_data(as_text=True) assert "source=chat" in html assert f"user_id={user.id}" in html + + def test_cost_values_are_explicitly_labelled_as_estimates(self, client, login): + user = _user("cost-reader", "cost-reader@example.com") + _admin() + _record(user) + login(email="admin@example.com") + + response = client.get("/admin/usage/report") + + assert response.status_code == 200 + html = response.get_data(as_text=True) + assert 'title="Estimated from the configured price table; not a provider-confirmed charge."' in html + assert 'aria-label="Estimated cost, USD"' in html + assert "Estimated cost" in html