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(litellm_logging.py): correctly log token usage for audio transcription calls to langfuse

Krrish Dholakia06409493337f
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