diff --git a/proxy/cache_tracker.go b/proxy/cache_tracker.go index 582754b..2c07d5a 100644 --- a/proxy/cache_tracker.go +++ b/proxy/cache_tracker.go @@ -512,13 +512,9 @@ func computePromptCacheTTLBreakdown(profile *promptCacheProfile, matchedTokens i return cache5m, cache1h } -func billedClaudeInputTokens(inputTokens int, usage promptCacheUsage) int { - return maxInt(inputTokens-usage.CacheCreationInputTokens-usage.CacheReadInputTokens, 0) -} - func buildClaudeUsageMap(inputTokens, outputTokens int, usage promptCacheUsage, includeCache bool) map[string]interface{} { result := map[string]interface{}{ - "input_tokens": billedClaudeInputTokens(inputTokens, usage), + "input_tokens": inputTokens, "output_tokens": outputTokens, } if !includeCache { diff --git a/proxy/cache_tracker_test.go b/proxy/cache_tracker_test.go index aa620c8..f0130f3 100644 --- a/proxy/cache_tracker_test.go +++ b/proxy/cache_tracker_test.go @@ -56,8 +56,8 @@ func TestBuildClaudeUsageMapIncludesCacheFields(t *testing.T) { m := buildClaudeUsageMap(100, 50, usage, true) - if got := m["input_tokens"]; got != 50 { - t.Fatalf("expected billed input tokens 50, got %#v", got) + if got := m["input_tokens"]; got != 100 { + t.Fatalf("expected input tokens 100 (no deduction), got %#v", got) } if got := m["cache_creation_input_tokens"]; got != 30 { t.Fatalf("expected cache creation tokens 30, got %#v", got) diff --git a/proxy/handler.go b/proxy/handler.go index bfccaf3..904fc07 100644 --- a/proxy/handler.go +++ b/proxy/handler.go @@ -1286,7 +1286,7 @@ func (h *Handler) handleClaudeNonStream(w http.ResponseWriter, account *config.A } resp := KiroToClaudeResponse(finalContent, responseThinkingContent, includeEmptyThinkingBlock, toolUses, inputTokens, outputTokens, model) - resp.Usage.InputTokens = billedClaudeInputTokens(inputTokens, cacheUsage) + resp.Usage.InputTokens = inputTokens resp.Usage.CacheCreationInputTokens = cacheUsage.CacheCreationInputTokens resp.Usage.CacheReadInputTokens = cacheUsage.CacheReadInputTokens if cacheProfile != nil {