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
transform_response_api_response
Ishaan Jaffb3999b4c75e6
diff --git a/litellm/llms/base_llm/responses/transformation.py b/litellm/llms/base_llm/responses/transformation.pyindex 03d496c0538..8bf7d68bc21 100644--- a/litellm/llms/base_llm/responses/transformation.py+++ b/litellm/llms/base_llm/responses/transformation.py@@ -103,10 +103,9 @@ class BaseResponsesAPIConfig(ABC):self,model: str,raw_response: httpx.Response,- model_response: ResponsesAPIResponse,logging_obj: LiteLLMLoggingObj,) -> ResponsesAPIResponse:- return model_response+ passdef get_error_class(self, error_message: str, status_code: int, headers: Union[dict, httpx.Headers]diff --git a/litellm/llms/openai/responses/transformation.py b/litellm/llms/openai/responses/transformation.pyindex fa4fe0274d8..0e480e0c3c3 100644--- a/litellm/llms/openai/responses/transformation.py+++ b/litellm/llms/openai/responses/transformation.py@@ -1,4 +1,6 @@-from typing import Optional, Union+from typing import TYPE_CHECKING, Any, Optional, Union++import httpximport litellmfrom litellm.llms.base_llm.responses.transformation import BaseResponsesAPIConfig@@ -7,9 +9,19 @@ from litellm.types.llms.openai import (ResponseInputParam,ResponsesAPIOptionalRequestParams,ResponsesAPIRequestParams,+ ResponsesAPIResponse,)from litellm.types.router import GenericLiteLLMParams+from ..common_utils import OpenAIError++if TYPE_CHECKING:+ from litellm.litellm_core_utils.litellm_logging import Logging as _LiteLLMLoggingObj++ LiteLLMLoggingObj = _LiteLLMLoggingObj+else:+ LiteLLMLoggingObj = Any+class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig):def get_supported_openai_params(self, model: str) -> list:@@ -83,6 +95,20 @@ class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig):model=model, input=input, **response_api_optional_request_params)+ def transform_response_api_response(+ self,+ model: str,+ raw_response: httpx.Response,+ logging_obj: LiteLLMLoggingObj,+ ) -> ResponsesAPIResponse:+ try:+ raw_response_json = raw_response.json()+ except Exception:+ raise OpenAIError(+ message=raw_response.text, status_code=raw_response.status_code+ )+ return ResponsesAPIResponse(**raw_response_json)+def validate_environment(self,headers: dict,