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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Fix: Responses API usage field type mismatch
Sameer Kankute0afb2cb56870
diff --git a/litellm/types/llms/openai.py b/litellm/types/llms/openai.pyindex 3f9842de7da..59835b05184 100644--- a/litellm/types/llms/openai.py+++ b/litellm/types/llms/openai.py@@ -71,7 +71,7 @@ from openai.types.responses.response_create_params import (ToolParam,)from openai.types.responses.response_function_tool_call import ResponseFunctionToolCall-from pydantic import BaseModel, ConfigDict, Discriminator, PrivateAttr+from pydantic import BaseModel, ConfigDict, Discriminator, PrivateAttr, field_validatorfrom typing_extensions import Annotated, Dict, Required, TypedDict, overridefrom litellm.types.llms.base import BaseLiteLLMOpenAIResponseObject@@ -1199,6 +1199,16 @@ class ResponsesAPIResponse(BaseLiteLLMOpenAIResponseObject):# Define private attributes using PrivateAttr_hidden_params: dict = PrivateAttr(default_factory=dict)+ @field_validator("usage", mode="before")+ @classmethod+ def validate_usage(cls, value):+ """Convert usage dict to ResponseAPIUsage object if needed"""+ if value is None:+ return value+ if isinstance(value, dict):+ return ResponseAPIUsage(**value)+ return value+@propertydef output_text(self) -> str:"""