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: [Bug]: litellm.litellm_core_utils.litellm_logging.Logging incorrectly handles ResponseAPIResponse

Sameer Kankute3748c706756a
diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py
index 9cef21bfdf6..572c797aa55 100644
--- a/litellm/litellm_core_utils/litellm_logging.py
+++ b/litellm/litellm_core_utils/litellm_logging.py
@@ -1624,15 +1624,7 @@ class Logging(LiteLLMLoggingBaseClass):
result.usage
)
)
- setattr(
- result,
- "usage",
- (
- transformed_usage.model_dump()
- if hasattr(transformed_usage, "model_dump")
- else dict(transformed_usage)
- ),
- )
+ setattr(result, "usage", transformed_usage)
if (
standard_logging_payload := self.model_call_details.get(
"standard_logging_object"
diff --git a/litellm/types/llms/openai.py b/litellm/types/llms/openai.py
index 467c57c33d5..3359a6dd495 100644
--- a/litellm/types/llms/openai.py
+++ b/litellm/types/llms/openai.py
@@ -1191,7 +1191,7 @@ class ResponsesAPIResponse(BaseLiteLLMOpenAIResponseObject):
status: Optional[str] = None
text: Optional[Union["ResponseText", Dict[str, Any]]] = None
truncation: Optional[Literal["auto", "disabled"]] = None
- usage: Optional[ResponseAPIUsage] = None
+ usage: Optional[Any] = None
user: Optional[str] = None
store: Optional[bool] = None
# Define private attributes using PrivateAttr