From 06409493337fd755157381df0d8355e9b71094e3 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sat, 8 Nov 2025 16:47:48 -0800 Subject: [PATCH] fix(litellm_logging.py): correctly log token usage for audio transcription calls to langfuse --- litellm/litellm_core_utils/litellm_logging.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py index 9d25228ca45..d85231fcbbd 100644 --- a/litellm/litellm_core_utils/litellm_logging.py +++ b/litellm/litellm_core_utils/litellm_logging.py @@ -1597,7 +1597,16 @@ class Logging(LiteLLMLoggingBaseClass): if hasattr(result, "model_dump") else dict(result) ) + elif isinstance(result, TranscriptionResponse): + from litellm.litellm_core_utils.llm_cost_calc.usage_object_transformation import ( + TranscriptionUsageObjectTransformation, + ) + result = result.model_copy() + transformed_usage = TranscriptionUsageObjectTransformation.transform_transcription_usage_object( + result.usage # type: ignore + ) + setattr(result, "usage", transformed_usage) if ( litellm.max_budget and self.stream is False