From ba3beaf1ffbda22c767e5716c4e3f65e62188565 Mon Sep 17 00:00:00 2001
From: Chenyme <118253778+chenyme@users.noreply.github.com>
Date: Sun, 19 Jul 2026 12:06:34 +0800
Subject: [PATCH] fix: update pricing calculations and improve tooltip display
for bot risk
---
backend/internal/domain/audit/pricing.go | 2 +-
backend/internal/domain/audit/pricing_test.go | 4 ++--
.../features/accounts/account-name-cell.tsx | 23 +++++++++++--------
.../features/audits/request-audits-page.tsx | 4 ++--
frontend/src/shared/i18n/index.ts | 4 ++--
5 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/backend/internal/domain/audit/pricing.go b/backend/internal/domain/audit/pricing.go
index 56ddb8bc..b36d5b86 100644
--- a/backend/internal/domain/audit/pricing.go
+++ b/backend/internal/domain/audit/pricing.go
@@ -55,7 +55,7 @@ func buildOfficialTokenPrices() map[string]tokenPrice {
}
register("grok-build-0.1", tokenPrice{InputTicks: 10000, CachedInputTicks: 2000, OutputTicks: 20000, LongContextTokens: 200000, LongInputTicks: 20000, LongCachedTicks: 4000, LongOutputTicks: 40000},
"grok-code-fast-1", "grok-code-fast", "grok-code-fast-1-0825", "grok-composer-2.5-fast")
- register("grok-4.5", tokenPrice{InputTicks: 20000, CachedInputTicks: 5000, OutputTicks: 60000, LongContextTokens: 200000, LongInputTicks: 40000, LongCachedTicks: 10000, LongOutputTicks: 120000},
+ register("grok-4.5", tokenPrice{InputTicks: 20000, CachedInputTicks: 3000, OutputTicks: 60000, LongContextTokens: 200000, LongInputTicks: 40000, LongCachedTicks: 6000, LongOutputTicks: 120000},
"grok-4.5-latest", "grok-build-latest")
standard := tokenPrice{InputTicks: 12500, CachedInputTicks: 2000, OutputTicks: 25000, LongContextTokens: 200000, LongInputTicks: 25000, LongCachedTicks: 4000, LongOutputTicks: 50000}
register("grok-4.3", standard, "grok-4.3-latest", "grok-latest")
diff --git a/backend/internal/domain/audit/pricing_test.go b/backend/internal/domain/audit/pricing_test.go
index cd0aea0f..8011c1f7 100644
--- a/backend/internal/domain/audit/pricing_test.go
+++ b/backend/internal/domain/audit/pricing_test.go
@@ -12,7 +12,7 @@ func TestEstimateOfficialCostHandlesCacheAliasesAndLongContext(t *testing.T) {
t.Fatalf("composer result = %#v, ok = %v", result, ok)
}
result, ok = EstimateOfficialCost("grok-4.5", 1_000_000, 200_000, 500_000, 210_000)
- if !ok || result.CostInUSDTicks != 94_000_000_000 {
+ if !ok || result.CostInUSDTicks != 93_200_000_000 {
t.Fatalf("long-context result = %#v, ok = %v", result, ok)
}
result, ok = EstimateOfficialCost("Web/grok-4.5-build-free", 100, 0, 50, 100)
@@ -53,7 +53,7 @@ func TestOfficialPricingMatchesPublishedTokenRates(t *testing.T) {
inputCost, cachedCost, outputCost int64
}{
{model: "grok-build-0.1", inputCost: 10_000_000_000, cachedCost: 2_000_000_000, outputCost: 20_000_000_000},
- {model: "grok-4.5", inputCost: 20_000_000_000, cachedCost: 5_000_000_000, outputCost: 60_000_000_000},
+ {model: "grok-4.5", inputCost: 20_000_000_000, cachedCost: 3_000_000_000, outputCost: 60_000_000_000},
{model: "grok-4.3", inputCost: 12_500_000_000, cachedCost: 2_000_000_000, outputCost: 25_000_000_000},
{model: "grok-4.20-multi-agent-0309", inputCost: 12_500_000_000, cachedCost: 2_000_000_000, outputCost: 25_000_000_000},
{model: "grok-4.20-0309-reasoning", inputCost: 12_500_000_000, cachedCost: 2_000_000_000, outputCost: 25_000_000_000},
diff --git a/frontend/src/features/accounts/account-name-cell.tsx b/frontend/src/features/accounts/account-name-cell.tsx
index eb801358..0b88c619 100644
--- a/frontend/src/features/accounts/account-name-cell.tsx
+++ b/frontend/src/features/accounts/account-name-cell.tsx
@@ -1,4 +1,4 @@
-import { Compass, Handshake, SquareTerminal, VenusAndMars, Webhook, type LucideIcon } from "lucide-react";
+import { Bot, Compass, Handshake, SquareTerminal, VenusAndMars, Webhook, type LucideIcon } from "lucide-react";
import { useTranslation } from "react-i18next";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
@@ -59,14 +59,6 @@ export function AccountNameCell({ account }: { account: AccountDTO }) {