Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(ui/usage): subtract cache tokens from Input Tokens summary card to avoid double-counting

Ishaan Jaffer6b1dc1156e0d
diff --git a/ui/litellm-dashboard/src/components/UsagePage/components/UsagePageView.tsx b/ui/litellm-dashboard/src/components/UsagePage/components/UsagePageView.tsx
index 1495c7d3e5b..69b29564d83 100644
--- a/ui/litellm-dashboard/src/components/UsagePage/components/UsagePageView.tsx
+++ b/ui/litellm-dashboard/src/components/UsagePage/components/UsagePageView.tsx
@@ -641,7 +641,12 @@ const UsagePage: React.FC<UsagePageProps> = ({ teams, organizations }) => {
<Card>
<Title>Input Tokens</Title>
<Text className="text-2xl font-bold mt-2 text-blue-600">
- {userSpendData.metadata?.total_prompt_tokens?.toLocaleString() || 0}
+ {Math.max(
+ 0,
+ (userSpendData.metadata?.total_prompt_tokens || 0) -
+ (userSpendData.metadata?.total_cache_read_input_tokens || 0) -
+ (userSpendData.metadata?.total_cache_creation_input_tokens || 0)
+ ).toLocaleString()}
</Text>
</Card>
<Card>