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
build: Squashed commit of the following: (#16176)
Krish Dholakia74ae7aed4443
diff --git a/litellm/integrations/arize/_utils.py b/litellm/integrations/arize/_utils.pyindex 36c28368946..1359f279ee9 100644--- a/litellm/integrations/arize/_utils.py+++ b/litellm/integrations/arize/_utils.py@@ -1,41 +1,97 @@import json-from typing import TYPE_CHECKING, Any, Optional, Union+from abc import ABC+from typing import TYPE_CHECKING, Any, Dict, List, Optional, Type, Union++from typing_extensions import overridefrom litellm._logging import verbose_logger+from litellm.integrations.opentelemetry_utils.base_otel_llm_obs_attributes import (+ BaseLLMObsOTELAttributes,+ safe_set_attribute,+)from litellm.litellm_core_utils.safe_json_dumps import safe_dumpsfrom litellm.types.utils import StandardLoggingPayloadif TYPE_CHECKING:- from opentelemetry.trace import Span as _Span+ from opentelemetry.trace import Span- Span = Union[_Span, Any]-else:- Span = Any+class ArizeOTELAttributes(BaseLLMObsOTELAttributes):-def cast_as_primitive_value_type(value) -> Union[str, bool, int, float]:- """- Converts a value to an OTEL-supported primitive for Arize/Phoenix observability.- """- if value is None:- return ""- if isinstance(value, (str, bool, int, float)):- return value- try:- return str(value)- except Exception:- return ""+ @staticmethod+ @override+ def set_messages(span: "Span", kwargs: Dict[str, Any]):+ from litellm.integrations._types.open_inference import (+ MessageAttributes,+ SpanAttributes,+ )+ messages = kwargs.get("messages")-def safe_set_attribute(span: Span, key: str, value: Any):- """- Sets a span attribute safely with OTEL-compliant primitive typing for Arize/Phoenix.- """- primitive_value = cast_as_primitive_value_type(value)- span.set_attribute(key, primitive_value)+ # for /chat/completions+ # https://docs.arize.com/arize/large-language-models/tracing/semantic-conventions+ if messages:+ last_message = messages[-1]+ safe_set_attribute(+ span,+ SpanAttributes.INPUT_VALUE,+ last_message.get("content", ""),+ )+ # LLM_INPUT_MESSAGES shows up under `input_messages` tab on the span page.+ for idx, msg in enumerate(messages):+ prefix = f"{SpanAttributes.LLM_INPUT_MESSAGES}.{idx}"+ # Set the role per message.+ safe_set_attribute(+ span, f"{prefix}.{MessageAttributes.MESSAGE_ROLE}", msg.get("role")+ )+ # Set the content per message.+ safe_set_attribute(+ span,+ f"{prefix}.{MessageAttributes.MESSAGE_CONTENT}",+ msg.get("content", ""),+ )++ @staticmethod+ @override+ def set_response_output_messages(span: "Span", response_obj):+ """+ Sets output message attributes on the span from the LLM response.++ Args:+ span: The OpenTelemetry span to set attributes on+ response_obj: The response object containing choices with messages+ """+ from litellm.integrations._types.open_inference import (+ MessageAttributes,+ SpanAttributes,+ )-def set_attributes(span: Span, kwargs, response_obj): # noqa: PLR0915+ for idx, choice in enumerate(response_obj.get("choices", [])):+ response_message = choice.get("message", {})+ safe_set_attribute(+ span,+ SpanAttributes.OUTPUT_VALUE,+ response_message.get("content", ""),+ )++ # This shows up under `output_messages` tab on the span page.+ prefix = f"{SpanAttributes.LLM_OUTPUT_MESSAGES}.{idx}"+ safe_set_attribute(+ span,+ f"{prefix}.{MessageAttributes.MESSAGE_ROLE}",+ response_message.get("role"),+ )+ safe_set_attribute(+ span,+ f"{prefix}.{MessageAttributes.MESSAGE_CONTENT}",+ response_message.get("content", ""),+ )+++def set_attributes(+ span: "Span", kwargs, response_obj, attributes: Type[BaseLLMObsOTELAttributes]+): # noqa: PLR0915"""Populates span with OpenInference-compliant LLM attributes for Arize and Phoenix tracing."""@@ -152,31 +208,7 @@ def set_attributes(span: Span, kwargs, response_obj): # noqa: PLR0915SpanAttributes.OPENINFERENCE_SPAN_KIND,OpenInferenceSpanKindValues.LLM.value,)- messages = kwargs.get("messages")-- # for /chat/completions- # https://docs.arize.com/arize/large-language-models/tracing/semantic-conventions- if messages:- last_message = messages[-1]- safe_set_attribute(- span,- SpanAttributes.INPUT_VALUE,- last_message.get("content", ""),- )-- # LLM_INPUT_MESSAGES shows up under `input_messages` tab on the span page.- for idx, msg in enumerate(messages):- prefix = f"{SpanAttributes.LLM_INPUT_MESSAGES}.{idx}"- # Set the role per message.- safe_set_attribute(- span, f"{prefix}.{MessageAttributes.MESSAGE_ROLE}", msg.get("role")- )- # Set the content per message.- safe_set_attribute(- span,- f"{prefix}.{MessageAttributes.MESSAGE_CONTENT}",- msg.get("content", ""),- )+ attributes.set_messages(span, kwargs)# Capture tools (function definitions) used in the LLM call.tools = optional_params.get("tools")diff --git a/litellm/integrations/arize/arize.py b/litellm/integrations/arize/arize.pyindex 06e05f1271d..9d587dcfa0e 100644--- a/litellm/integrations/arize/arize.py+++ b/litellm/integrations/arize/arize.py@@ -9,6 +9,7 @@ from datetime import datetimefrom typing import TYPE_CHECKING, Any, Optional, Unionfrom litellm.integrations.arize import _utils+from litellm.integrations.arize._utils import ArizeOTELAttributesfrom litellm.integrations.opentelemetry import OpenTelemetryfrom litellm.types.integrations.arize import ArizeConfigfrom litellm.types.services import ServiceLoggerPayload@@ -33,7 +34,7 @@ class ArizeLogger(OpenTelemetry):@staticmethoddef set_arize_attributes(span: Span, kwargs, response_obj):- _utils.set_attributes(span, kwargs, response_obj)+ _utils.set_attributes(span, kwargs, response_obj, ArizeOTELAttributes)return@staticmethod@@ -107,39 +108,38 @@ class ArizeLogger(OpenTelemetry):async def async_health_check(self):"""Performs a health check for Arize integration.-+Returns:dict: Health check result with status and message"""try:config = self.get_arize_config()-+if not config.space_key:return {"status": "unhealthy",- "error_message": "ARIZE_SPACE_KEY environment variable not set"+ "error_message": "ARIZE_SPACE_KEY environment variable not set",}-+if not config.api_key:return {- "status": "unhealthy",- "error_message": "ARIZE_API_KEY environment variable not set"+ "status": "unhealthy",+ "error_message": "ARIZE_API_KEY environment variable not set",}-+return {"status": "healthy",- "message": "Arize credentials are configured properly"+ "message": "Arize credentials are configured properly",}-+except Exception as e:return {"status": "unhealthy",- "error_message": f"Arize health check failed: {str(e)}"+ "error_message": f"Arize health check failed: {str(e)}",}def construct_dynamic_otel_headers(- self,- standard_callback_dynamic_params: StandardCallbackDynamicParams+ self, standard_callback_dynamic_params: StandardCallbackDynamicParams) -> Optional[dict]:"""Construct dynamic Arize headers from standard callback dynamic params@@ -163,7 +163,7 @@ class ArizeLogger(OpenTelemetry):dynamic_headers["arize-space-id"] = standard_callback_dynamic_params.get("arize_space_key")-+########################################################## `api_key` handling#########################################################@@ -171,5 +171,5 @@ class ArizeLogger(OpenTelemetry):dynamic_headers["api_key"] = standard_callback_dynamic_params.get("arize_api_key")-+return dynamic_headersdiff --git a/litellm/integrations/arize/arize_phoenix.py b/litellm/integrations/arize/arize_phoenix.pyindex 044486fcd27..60566ee55c0 100644--- a/litellm/integrations/arize/arize_phoenix.py+++ b/litellm/integrations/arize/arize_phoenix.py@@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Any, Unionfrom litellm._logging import verbose_loggerfrom litellm.integrations.arize import _utils+from litellm.integrations.arize._utils import ArizeOTELAttributesfrom litellm.types.integrations.arize_phoenix import ArizePhoenixConfigif TYPE_CHECKING:@@ -28,7 +29,7 @@ ARIZE_HOSTED_PHOENIX_ENDPOINT = "https://app.phoenix.arize.com/v1/traces"class ArizePhoenixLogger:@staticmethoddef set_arize_phoenix_attributes(span: Span, kwargs, response_obj):- _utils.set_attributes(span, kwargs, response_obj)+ _utils.set_attributes(span, kwargs, response_obj, ArizeOTELAttributes)return@staticmethod@@ -70,7 +71,9 @@ class ArizePhoenixLogger:otlp_auth_headers = f"api_key={api_key}"elif api_key is not None:# api_key/auth is optional for self hosted phoenix- otlp_auth_headers = f"Authorization={urllib.parse.quote(f'Bearer {api_key}')}"+ otlp_auth_headers = (+ f"Authorization={urllib.parse.quote(f'Bearer {api_key}')}"+ )return ArizePhoenixConfig(otlp_auth_headers=otlp_auth_headers, protocol=protocol, endpoint=endpointdiff --git a/litellm/integrations/langfuse/langfuse_otel.py b/litellm/integrations/langfuse/langfuse_otel.pyindex 58d1333c778..fc010928101 100644--- a/litellm/integrations/langfuse/langfuse_otel.py+++ b/litellm/integrations/langfuse/langfuse_otel.py@@ -5,6 +5,9 @@ from typing import TYPE_CHECKING, Any, Optional, Unionfrom litellm._logging import verbose_loggerfrom litellm.integrations.arize import _utils+from litellm.integrations.langfuse.langfuse_otel_attributes import (+ LangfuseLLMObsOTELAttributes,+)from litellm.integrations.opentelemetry import OpenTelemetryfrom litellm.types.integrations.langfuse_otel import (LangfuseOtelConfig,@@ -33,27 +36,24 @@ LANGFUSE_CLOUD_EU_ENDPOINT = "https://cloud.langfuse.com/api/public/otel"LANGFUSE_CLOUD_US_ENDPOINT = "https://us.cloud.langfuse.com/api/public/otel"-class LangfuseOtelLogger(OpenTelemetry):def __init__(self, *args, **kwargs):super().__init__(*args, **kwargs)-@staticmethoddef set_langfuse_otel_attributes(span: Span, kwargs, response_obj):"""Sets OpenTelemetry span attributes for Langfuse observability.Uses the same attribute setting logic as Arize Phoenix for consistency."""- _utils.set_attributes(span, kwargs, response_obj)++ _utils.set_attributes(span, kwargs, response_obj, LangfuseLLMObsOTELAttributes)########################################################## Set Langfuse specific attributes#########################################################LangfuseOtelLogger._set_langfuse_specific_attributes(- span=span,- kwargs=kwargs,- response_obj=response_obj+ span=span, kwargs=kwargs, response_obj=response_obj)return@@ -176,7 +176,11 @@ class LangfuseOtelLogger(OpenTelemetry):# Parse arguments from JSON string to objecttry:- arguments_obj = json.loads(arguments_str) if isinstance(arguments_str, str) else arguments_str+ arguments_obj = (+ json.loads(arguments_str)+ if isinstance(arguments_str, str)+ else arguments_str+ )except json.JSONDecodeError:arguments_obj = {}@@ -301,8 +305,7 @@ class LangfuseOtelLogger(OpenTelemetry):verbose_logger.debug(f"Using Langfuse US cloud endpoint: {endpoint}")auth_header = LangfuseOtelLogger._get_langfuse_authorization_header(- public_key=public_key,- secret_key=secret_key+ public_key=public_key, secret_key=secret_key)otlp_auth_headers = f"Authorization={auth_header}"@@ -313,7 +316,7 @@ class LangfuseOtelLogger(OpenTelemetry):return LangfuseOtelConfig(otlp_auth_headers=otlp_auth_headers, protocol="otlp_http")-+@staticmethoddef _get_langfuse_authorization_header(public_key: str, secret_key: str) -> str:"""@@ -321,11 +324,10 @@ class LangfuseOtelLogger(OpenTelemetry):"""auth_string = f"{public_key}:{secret_key}"auth_header = base64.b64encode(auth_string.encode()).decode()- return f'Basic {auth_header}'-+ return f"Basic {auth_header}"+def construct_dynamic_otel_headers(- self,- standard_callback_dynamic_params: StandardCallbackDynamicParams+ self, standard_callback_dynamic_params: StandardCallbackDynamicParams) -> Optional[dict]:"""Construct dynamic Langfuse headers from standard callback dynamic params@@ -337,13 +339,17 @@ class LangfuseOtelLogger(OpenTelemetry):"""dynamic_headers = {}- dynamic_langfuse_public_key = standard_callback_dynamic_params.get("langfuse_public_key")- dynamic_langfuse_secret_key = standard_callback_dynamic_params.get("langfuse_secret_key")+ dynamic_langfuse_public_key = standard_callback_dynamic_params.get(+ "langfuse_public_key"+ )+ dynamic_langfuse_secret_key = standard_callback_dynamic_params.get(+ "langfuse_secret_key"+ )if dynamic_langfuse_public_key and dynamic_langfuse_secret_key:auth_header = LangfuseOtelLogger._get_langfuse_authorization_header(public_key=dynamic_langfuse_public_key,- secret_key=dynamic_langfuse_secret_key+ secret_key=dynamic_langfuse_secret_key,)dynamic_headers["Authorization"] = auth_header-+return dynamic_headersdiff --git a/litellm/integrations/langfuse/langfuse_otel_attributes.py b/litellm/integrations/langfuse/langfuse_otel_attributes.pynew file mode 100644index 00000000000..f14412ad53b--- /dev/null+++ b/litellm/integrations/langfuse/langfuse_otel_attributes.py@@ -0,0 +1,110 @@+"""+If the LLM Obs has any specific attributes to log request or response, we can add them here.++Relevant Issue: https://github.com/BerriAI/litellm/issues/13764+"""++import json+from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union++from numpy import isin+from pydantic import BaseModel+from typing_extensions import override++import litellm+from litellm.integrations.opentelemetry_utils.base_otel_llm_obs_attributes import (+ BaseLLMObsOTELAttributes,+ safe_set_attribute,+)+from litellm.types.llms.openai import HttpxBinaryResponseContent, ResponsesAPIResponse+from litellm.types.utils import (+ EmbeddingResponse,+ ImageResponse,+ ModelResponse,+ RerankResponse,+ TextCompletionResponse,+ TranscriptionResponse,+)++if TYPE_CHECKING:+ from opentelemetry.trace import Span+++def get_output_content_by_type(+ response_obj: Union[+ None,+ dict,+ EmbeddingResponse,+ ModelResponse,+ TextCompletionResponse,+ ImageResponse,+ TranscriptionResponse,+ RerankResponse,+ HttpxBinaryResponseContent,+ ResponsesAPIResponse,+ list,+ ],+ kwargs: Optional[Dict[str, Any]] = None,+) -> str:+ """+ Extract output content from response objects based on their type.++ This utility function handles the type-specific logic for converting+ various response objects into appropriate output formats for Langfuse logging.++ Args:+ response_obj: The response object returned by the function+ kwargs: Optional keyword arguments containing call_type and other metadata++ Returns:+ The formatted output content suitable for Langfuse logging, or None+ """+ if response_obj is None:+ return ""++ kwargs = kwargs or {}+ call_type = kwargs.get("call_type", None)++ # Embedding responses - no output content+ if call_type == "embedding" or isinstance(response_obj, EmbeddingResponse):+ return "embedding-output"++ # Binary/Speech responses+ if isinstance(response_obj, HttpxBinaryResponseContent):+ return "speech-output"++ if isinstance(response_obj, BaseModel):+ return response_obj.model_dump_json()++ if response_obj and (+ isinstance(response_obj, dict) or isinstance(response_obj, list)+ ):+ return json.dumps(response_obj)+ else:+ return ""+++class LangfuseLLMObsOTELAttributes(BaseLLMObsOTELAttributes):+ @staticmethod+ @override+ def set_messages(span: "Span", kwargs: Dict[str, Any]):+ prompt = {"messages": kwargs.get("messages")}+ optional_params = kwargs.get("optional_params", {})+ functions = optional_params.get("functions")+ tools = optional_params.get("tools")+ if functions is not None:+ prompt["functions"] = functions+ if tools is not None:+ prompt["tools"] = tools++ input = prompt+ safe_set_attribute(span, "langfuse.observation.input", json.dumps(input))++ @staticmethod+ @override+ def set_response_output_messages(span: "Span", response_obj):+ safe_set_attribute(+ span,+ "langfuse.observation.output",+ get_output_content_by_type(response_obj),+ )diff --git a/litellm/integrations/opentelemetry_utils/base_otel_llm_obs_attributes.py b/litellm/integrations/opentelemetry_utils/base_otel_llm_obs_attributes.pynew file mode 100644index 00000000000..8d7b2d681ab--- /dev/null+++ b/litellm/integrations/opentelemetry_utils/base_otel_llm_obs_attributes.py@@ -0,0 +1,37 @@+from abc import ABC+from typing import TYPE_CHECKING, Any, Dict, List, Union++if TYPE_CHECKING:+ from opentelemetry.trace import Span+++class BaseLLMObsOTELAttributes(ABC):+ @staticmethod+ def set_messages(span: "Span", kwargs: Dict[str, Any]):+ pass++ @staticmethod+ def set_response_output_messages(span: "Span", response_obj):+ pass+++def cast_as_primitive_value_type(value) -> Union[str, bool, int, float]:+ """+ Converts a value to an OTEL-supported primitive for Arize/Phoenix observability.+ """+ if value is None:+ return ""+ if isinstance(value, (str, bool, int, float)):+ return value+ try:+ return str(value)+ except Exception:+ return ""+++def safe_set_attribute(span: "Span", key: str, value: Any):+ """+ Sets a span attribute safely with OTEL-compliant primitive typing for Arize/Phoenix.+ """+ primitive_value = cast_as_primitive_value_type(value)+ span.set_attribute(key, primitive_value)diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.pyindex afb6da0bae2..974dd18ccc9 100644--- a/litellm/litellm_core_utils/litellm_logging.py+++ b/litellm/litellm_core_utils/litellm_logging.py@@ -68,7 +68,9 @@ from litellm.litellm_core_utils.redact_messages import (redact_message_input_output_from_custom_logger,redact_message_input_output_from_logging,)+from litellm.llms.base_llm.ocr.transformation import OCRResponsefrom litellm.responses.utils import ResponseAPILoggingUtils+from litellm.types.containers.main import ContainerObjectfrom litellm.types.llms.openai import (AllMessageValues,Batch,@@ -76,6 +78,7 @@ from litellm.types.llms.openai import (HttpxBinaryResponseContent,OpenAIFileObject,OpenAIModerationResponse,+ ResponseAPIUsage,ResponseCompletedEvent,ResponsesAPIResponse,)@@ -116,9 +119,7 @@ from litellm.types.utils import (Usage,)from litellm.types.videos.main import VideoObject-from litellm.types.containers.main import ContainerObjectfrom litellm.utils import _get_base_model_from_metadata, executor, print_verbose-from litellm.llms.base_llm.ocr.transformation import OCRResponsefrom ..integrations.argilla import ArgillaLoggerfrom ..integrations.arize.arize_phoenix import ArizePhoenixLogger@@ -1311,6 +1312,7 @@ class Logging(LiteLLMLoggingBaseClass):response_cost = litellm.response_cost_calculator(**response_cost_calculator_kwargs)+verbose_logger.debug(f"response_cost: {response_cost}")return response_costexcept Exception as e: # error calculating cost@@ -2997,6 +2999,17 @@ class Logging(LiteLLMLoggingBaseClass):elif isinstance(result, TextCompletionResponse):return resultelif isinstance(result, ResponseCompletedEvent):+ ## return unified Usage object+ if isinstance(result.response.usage, ResponseAPIUsage):+ setattr(+ result.response,+ "usage",+ (+ ResponseAPILoggingUtils._transform_response_api_usage_to_chat_usage(+ result.response.usage+ )+ ),+ )return result.responseelse:return Nonediff --git a/litellm/proxy/_experimental/out/api-reference.html b/litellm/proxy/_experimental/out/api-reference/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/api-reference.htmlrename to litellm/proxy/_experimental/out/api-reference/index.htmldiff --git a/litellm/proxy/_experimental/out/guardrails.html b/litellm/proxy/_experimental/out/guardrails.htmldeleted file mode 100644index 99ec72d9c9d..00000000000--- a/litellm/proxy/_experimental/out/guardrails.html+++ /dev/null@@ -1 +0,0 @@-<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/litellm-asset-prefix/_next/static/chunks/webpack-db32e14ed3b4a921.js"/><script src="/litellm-asset-prefix/_next/static/chunks/fd9d1056-64e84c4092e0c5d7.js" async=""></script><script src="/litellm-asset-prefix/_next/static/chunks/2117-2da5ec8fad6a6c25.js" async=""></script><script src="/litellm-asset-prefix/_next/static/chunks/main-app-c6945ec5b2d5e671.js" async=""></script><title>LiteLLM Dashboard</title><meta name="description" content="LiteLLM Proxy Admin UI"/><link rel="icon" href="/favicon.ico" type="image/x-icon" sizes="16x16"/><link rel="icon" href="./favicon.ico"/><meta name="next-size-adjust"/><script src="/litellm-asset-prefix/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><script src="/litellm-asset-prefix/_next/static/chunks/webpack-db32e14ed3b4a921.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/litellm-asset-prefix/_next/static/media/e4af272ccee01ff0-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/litellm-asset-prefix/_next/static/css/349654da14372cd9.css\",\"style\"]\n3:HL[\"/litellm-asset-prefix/_next/static/css/40feb962788c268d.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"4:I[12846,[],\"\"]\n6:I[19107,[],\"ClientPageRoot\"]\n7:I[49514,[\"1114\",\"static/chunks/1114-744a38eea84cb2ab.js\",\"1491\",\"static/chunks/1491-8280340b5391aa11.js\",\"4556\",\"static/chunks/4556-6a2e7184dcc130ca.js\",\"2417\",\"static/chunks/2417-b28f330f82bf4a82.js\",\"2926\",\"static/chunks/2926-b5dcad9f62f5e2b1.js\",\"3709\",\"static/chunks/3709-b17db86e0ab325d2.js\",\"9775\",\"static/chunks/9775-ac7313139c5f089d.js\",\"2525\",\"static/chunks/2525-13b137f40949dcf1.js\",\"2284\",\"static/chunks/2284-4cbc9a7f33eb7c89.js\",\"7908\",\"static/chunks/7908-07a76cfe29c543c9.js\",\"9011\",\"static/chunks/9011-0769cb78a6e5f233.js\",\"2945\",\"static/chunks/2945-00442a283770ee5d.js\",\"169\",\"static/chunks/169-07530b6fecd36167.js\",\"5030\",\"static/chunks/5030-d46e46be47c1567d.js\",\"2522\",\"static/chunks/2522-66e1a76ca1d40f57.js\",\"8049\",\"static/chunks/8049-b89d8be2044ba775.js\",\"4734\",\"static/chunks/4734-4afc9b5bc8f3c0c0.js\",\"6607\",\"static/chunks/app/(dashboard)/guardrails/page-710b72cc39198373.js\"],\"default\",1]\n8:I[4707,[],\"\"]\n9:I[36423,[],\"\"]\na:I[89219,[\"1114\",\"static/chunks/1114-744a38eea84cb2ab.js\",\"1491\",\"static/chunks/1491-8280340b5391aa11.js\",\"4556\",\"static/chunks/4556-6a2e7184dcc130ca.js\",\"3709\",\"static/chunks/3709-b17db86e0ab325d2.js\",\"1529\",\"static/chunks/1529-130888c02463f3dd.js\",\"3603\",\"static/chunks/3603-dd19ac8e31e4bc25.js\",\"9165\",\"static/chunks/9165-2a738a73d0d5f1d1.js\",\"8098\",\"static/chunks/8098-3da3212991542668.js\",\"8049\",\"static/chunks/8049-b89d8be2044ba775.js\",\"2019\",\"static/chunks/2019-ecc3e3a4de376109.js\",\"5642\",\"static/chunks/app/(dashboard)/layout-4ed8f2b71aeac958.js\"],\"default\",1]\nc:I[31857,[\"1114\",\"static/chunks/1114-744a38eea84cb2ab.js\",\"1491\",\"static/chunks/1491-8280340b5391aa11.js\",\"8049\",\"static/chunks/8049-b89d8be2044ba775.js\",\"3185\",\"static/chunks/app/layout-8f12248205e8af0b.js\"],\"FeatureFlagsProvider\"]\n12:I[61060,[],\"\"]\nb:{}\nd:{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justif"])</script><script>self.__next_f.push([1,"yContent\":\"center\"}\ne:{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"}\nf:{\"display\":\"inline-block\"}\n10:{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0}\n13:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L4\",null,{\"buildId\":\"D4fwNrBygvLONmgebv5_0\",\"assetPrefix\":\"/litellm-asset-prefix\",\"urlParts\":[\"\",\"guardrails\"],\"initialTree\":[\"\",{\"children\":[\"(dashboard)\",{\"children\":[\"guardrails\",{\"children\":[\"__PAGE__\",{}]}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"(dashboard)\",{\"children\":[\"guardrails\",{\"children\":[\"__PAGE__\",{},[[\"$L5\",[\"$\",\"$L6\",null,{\"props\":{\"params\":{},\"searchParams\":{}},\"Component\":\"$7\"}],null],null],null]},[null,[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"(dashboard)\",\"children\",\"guardrails\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[null,[\"$\",\"$La\",null,{\"children\":[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"(dashboard)\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}],\"params\":\"$b\"}]],null],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/litellm-asset-prefix/_next/static/css/349654da14372cd9.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/litellm-asset-prefix/_next/static/css/40feb962788c268d.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_1c856b\",\"children\":[\"$\",\"$Lc\",null,{\"children\":[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$d\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$e\",\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":\"$f\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$10\",\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]}]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[null,\"$L11\"],\"globalErrorComponent\":\"$12\",\"missingSlots\":\"$W13\"}]\n"])</script><script>self.__next_f.push([1,"11:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"LiteLLM Dashboard\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"LiteLLM Proxy Admin UI\"}],[\"$\",\"link\",\"4\",{\"rel\":\"icon\",\"href\":\"/favicon.ico\",\"type\":\"image/x-icon\",\"sizes\":\"16x16\"}],[\"$\",\"link\",\"5\",{\"rel\":\"icon\",\"href\":\"./favicon.ico\"}],[\"$\",\"meta\",\"6\",{\"name\":\"next-size-adjust\"}]]\n5:null\n"])</script></body></html>\ No newline at end of filediff --git a/litellm/proxy/_experimental/out/logs.html b/litellm/proxy/_experimental/out/logs/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/logs.htmlrename to litellm/proxy/_experimental/out/logs/index.htmldiff --git a/litellm/proxy/_experimental/out/model-hub.html b/litellm/proxy/_experimental/out/model-hub/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/model-hub.htmlrename to litellm/proxy/_experimental/out/model-hub/index.htmldiff --git a/litellm/proxy/_experimental/out/model_hub_table.html b/litellm/proxy/_experimental/out/model_hub_table/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/model_hub_table.htmlrename to litellm/proxy/_experimental/out/model_hub_table/index.htmldiff --git a/litellm/proxy/_experimental/out/models-and-endpoints.html b/litellm/proxy/_experimental/out/models-and-endpoints/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/models-and-endpoints.htmlrename to litellm/proxy/_experimental/out/models-and-endpoints/index.htmldiff --git a/litellm/proxy/_experimental/out/onboarding.html b/litellm/proxy/_experimental/out/onboarding.htmldeleted file mode 100644index a03ee54b8f7..00000000000--- a/litellm/proxy/_experimental/out/onboarding.html+++ /dev/null@@ -1 +0,0 @@-<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/litellm-asset-prefix/_next/static/chunks/webpack-db32e14ed3b4a921.js"/><script src="/litellm-asset-prefix/_next/static/chunks/fd9d1056-64e84c4092e0c5d7.js" async=""></script><script src="/litellm-asset-prefix/_next/static/chunks/2117-2da5ec8fad6a6c25.js" async=""></script><script src="/litellm-asset-prefix/_next/static/chunks/main-app-c6945ec5b2d5e671.js" async=""></script><title>LiteLLM Dashboard</title><meta name="description" content="LiteLLM Proxy Admin UI"/><link rel="icon" href="/favicon.ico" type="image/x-icon" sizes="16x16"/><link rel="icon" href="./favicon.ico"/><meta name="next-size-adjust"/><script src="/litellm-asset-prefix/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><script src="/litellm-asset-prefix/_next/static/chunks/webpack-db32e14ed3b4a921.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/litellm-asset-prefix/_next/static/media/e4af272ccee01ff0-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/litellm-asset-prefix/_next/static/css/349654da14372cd9.css\",\"style\"]\n3:HL[\"/litellm-asset-prefix/_next/static/css/40feb962788c268d.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"4:I[12846,[],\"\"]\n6:I[19107,[],\"ClientPageRoot\"]\n7:I[12011,[\"3665\",\"static/chunks/3014691f-702e24806fe9cec4.js\",\"1114\",\"static/chunks/1114-744a38eea84cb2ab.js\",\"1491\",\"static/chunks/1491-8280340b5391aa11.js\",\"4556\",\"static/chunks/4556-6a2e7184dcc130ca.js\",\"8806\",\"static/chunks/8806-85c2bcba4ca300e2.js\",\"8049\",\"static/chunks/8049-b89d8be2044ba775.js\",\"8461\",\"static/chunks/app/onboarding/page-b7c15ec1ef82f030.js\"],\"default\",1]\n8:I[4707,[],\"\"]\n9:I[36423,[],\"\"]\na:I[31857,[\"1114\",\"static/chunks/1114-744a38eea84cb2ab.js\",\"1491\",\"static/chunks/1491-8280340b5391aa11.js\",\"8049\",\"static/chunks/8049-b89d8be2044ba775.js\",\"3185\",\"static/chunks/app/layout-8f12248205e8af0b.js\"],\"FeatureFlagsProvider\"]\nc:I[61060,[],\"\"]\nd:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L4\",null,{\"buildId\":\"D4fwNrBygvLONmgebv5_0\",\"assetPrefix\":\"/litellm-asset-prefix\",\"urlParts\":[\"\",\"onboarding\"],\"initialTree\":[\"\",{\"children\":[\"onboarding\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"onboarding\",{\"children\":[\"__PAGE__\",{},[[\"$L5\",[\"$\",\"$L6\",null,{\"props\":{\"params\":{},\"searchParams\":{}},\"Component\":\"$7\"}],null],null],null]},[null,[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"onboarding\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/litellm-asset-prefix/_next/static/css/349654da14372cd9.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/litellm-asset-prefix/_next/static/css/40feb962788c268d.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_1c856b\",\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]}]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[null,\"$Lb\"],\"globalErrorComponent\":\"$c\",\"missingSlots\":\"$Wd\"}]\n"])</script><script>self.__next_f.push([1,"b:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"LiteLLM Dashboard\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"LiteLLM Proxy Admin UI\"}],[\"$\",\"link\",\"4\",{\"rel\":\"icon\",\"href\":\"/favicon.ico\",\"type\":\"image/x-icon\",\"sizes\":\"16x16\"}],[\"$\",\"link\",\"5\",{\"rel\":\"icon\",\"href\":\"./favicon.ico\"}],[\"$\",\"meta\",\"6\",{\"name\":\"next-size-adjust\"}]]\n5:null\n"])</script></body></html>\ No newline at end of filediff --git a/litellm/proxy/_experimental/out/organizations.html b/litellm/proxy/_experimental/out/organizations/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/organizations.htmlrename to litellm/proxy/_experimental/out/organizations/index.htmldiff --git a/litellm/proxy/_experimental/out/teams.html b/litellm/proxy/_experimental/out/teams/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/teams.htmlrename to litellm/proxy/_experimental/out/teams/index.htmldiff --git a/litellm/proxy/_experimental/out/test-key.html b/litellm/proxy/_experimental/out/test-key/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/test-key.htmlrename to litellm/proxy/_experimental/out/test-key/index.htmldiff --git a/litellm/proxy/_experimental/out/usage.html b/litellm/proxy/_experimental/out/usage/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/usage.htmlrename to litellm/proxy/_experimental/out/usage/index.htmldiff --git a/litellm/proxy/_experimental/out/users.html b/litellm/proxy/_experimental/out/users/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/users.htmlrename to litellm/proxy/_experimental/out/users/index.htmldiff --git a/litellm/proxy/_experimental/out/virtual-keys.html b/litellm/proxy/_experimental/out/virtual-keys/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/virtual-keys.htmlrename to litellm/proxy/_experimental/out/virtual-keys/index.htmldiff --git a/litellm/types/llms/openai.py b/litellm/types/llms/openai.pyindex 00410fe7732..7dab61b151f 100644--- a/litellm/types/llms/openai.py+++ b/litellm/types/llms/openai.py@@ -674,7 +674,9 @@ class OpenAIChatCompletionAssistantMessage(TypedDict, total=False):class ChatCompletionAssistantMessage(OpenAIChatCompletionAssistantMessage, total=False):cache_control: ChatCompletionCachedContent- thinking_blocks: Optional[List[Union[ChatCompletionThinkingBlock, ChatCompletionRedactedThinkingBlock]]]+ thinking_blocks: Optional[+ List[Union[ChatCompletionThinkingBlock, ChatCompletionRedactedThinkingBlock]]+ ]class ChatCompletionToolMessage(TypedDict):@@ -1410,6 +1412,7 @@ class ImageGenerationPartialImageEvent(BaseLiteLLMOpenAIResponseObject):class ErrorEventError(BaseLiteLLMOpenAIResponseObject):"""Nested error object within ErrorEvent"""+type: str # e.g., 'invalid_request_error'code: str # e.g., 'context_length_exceeded'message: str@@ -1853,10 +1856,10 @@ class OpenAIMcpServerTool(TypedDict, total=False):class CreateVideoRequest(TypedDict, total=False):"""CreateVideoRequest for OpenAI video generation API-+Required Params:prompt: str - Text prompt that describes the video to generate-+Optional Params:input_reference: Optional[str] - Optional image reference that guides generationmodel: Optional[str] - The video generation model to use (defaults to sora-2)@@ -1867,6 +1870,7 @@ class CreateVideoRequest(TypedDict, total=False):extra_body: Optional[Dict[str, str]] - Additional body parameterstimeout: Optional[float] - Request timeout"""+prompt: Required[str]input_reference: Optional[str]model: Optional[str]@@ -1880,42 +1884,43 @@ class CreateVideoRequest(TypedDict, total=False):class OpenAIVideoObject(BaseModel):"""OpenAI Video Object representing a video generation job."""+id: str"""Unique identifier for the video job."""-+object: Literal["video"]"""The object type, which is always 'video'."""-+status: str"""Current lifecycle status of the video job."""-+created_at: int"""Unix timestamp (seconds) for when the job was created."""-+completed_at: Optional[int] = None"""Unix timestamp (seconds) for when the job completed, if finished."""-+expires_at: Optional[int] = None"""Unix timestamp (seconds) for when the downloadable assets expire, if set."""-+error: Optional[Dict[str, Any]] = None"""Error payload that explains why generation failed, if applicable."""-+progress: Optional[int] = None"""Approximate completion percentage for the generation task."""-+remixed_from_video_id: Optional[str] = None"""Identifier of the source video if this video is a remix."""-+seconds: Optional[str] = None"""Duration of the generated clip in seconds."""-+size: Optional[str] = None"""The resolution of the generated video."""-+model: Optional[str] = None"""The video generation model that produced the job."""-+_hidden_params: Dict[str, Any] = {}def __contains__(self, key):diff --git a/tests/llm_responses_api_testing/test_openai_responses_api.py b/tests/llm_responses_api_testing/test_openai_responses_api.pyindex 21d2f82c984..24a0321d0c7 100644--- a/tests/llm_responses_api_testing/test_openai_responses_api.py+++ b/tests/llm_responses_api_testing/test_openai_responses_api.py@@ -24,11 +24,13 @@ from litellm.types.llms.openai import (from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandlerfrom base_responses_api import BaseResponsesAPITest, validate_responses_api_response+class TestOpenAIResponsesAPITest(BaseResponsesAPITest):def get_base_completion_call_args(self):return {"model": "openai/gpt-4o",}+def get_base_completion_reasoning_call_args(self):return {"model": "openai/gpt-5-mini",@@ -195,12 +197,12 @@ async def test_openai_responses_api_returns_headers(sync_mode):"""Test that OpenAI responses API returns OpenAI headers in _hidden_params.This ensures the proxy can forward these headers to clients.-+Related issue: LiteLLM responses API should return OpenAI headers like chat completions does"""litellm._turn_on_debug()litellm.set_verbose = True-+if sync_mode:response = litellm.responses(model="gpt-4o",@@ -213,23 +215,28 @@ async def test_openai_responses_api_returns_headers(sync_mode):input="Say hello",max_output_tokens=20,)-+# Verify response is validassert response is not Noneassert isinstance(response, ResponsesAPIResponse)-+# Verify _hidden_params exists- assert hasattr(response, "_hidden_params"), "Response should have _hidden_params attribute"+ assert hasattr(+ response, "_hidden_params"+ ), "Response should have _hidden_params attribute"assert response._hidden_params is not None, "_hidden_params should not be None"-+# Verify additional_headers exists in _hidden_params- assert "additional_headers" in response._hidden_params, \- "_hidden_params should contain 'additional_headers' key"-+ assert (+ "additional_headers" in response._hidden_params+ ), "_hidden_params should contain 'additional_headers' key"+additional_headers = response._hidden_params["additional_headers"]- assert isinstance(additional_headers, dict), "additional_headers should be a dictionary"+ assert isinstance(+ additional_headers, dict+ ), "additional_headers should be a dictionary"assert len(additional_headers) > 0, "additional_headers should not be empty"-+# Check for expected OpenAI rate limit headers# These can be either direct (x-ratelimit-*) or prefixed (llm_provider-x-ratelimit-*)rate_limit_headers = [@@ -238,22 +245,26 @@ async def test_openai_responses_api_returns_headers(sync_mode):"x-ratelimit-remaining-requests","x-ratelimit-limit-requests",]-+found_headers = []for header_name in rate_limit_headers:if header_name in additional_headers:found_headers.append(header_name)elif f"llm_provider-{header_name}" in additional_headers:found_headers.append(f"llm_provider-{header_name}")-- assert len(found_headers) > 0, \- f"Should find at least one OpenAI rate limit header. Headers found: {list(additional_headers.keys())}"-++ assert (+ len(found_headers) > 0+ ), f"Should find at least one OpenAI rate limit header. Headers found: {list(additional_headers.keys())}"+# Verify headers key also exists (raw headers)- assert "headers" in response._hidden_params, \- "_hidden_params should contain 'headers' key with raw response headers"-- print(f"✓ Successfully validated OpenAI headers in {'sync' if sync_mode else 'async'} mode")+ assert (+ "headers" in response._hidden_params+ ), "_hidden_params should contain 'headers' key with raw response headers"++ print(+ f"✓ Successfully validated OpenAI headers in {'sync' if sync_mode else 'async'} mode"+ )print(f" Found {len(additional_headers)} headers total")print(f" Rate limit headers found: {found_headers}")@@ -659,8 +670,6 @@ async def test_openai_responses_litellm_router_no_metadata():request_body = mock_post.call_args.kwargs["json"]print("Request body:", json.dumps(request_body, indent=4))--# Assert metadata is not in the requestassert ("metadata" not in request_body@@ -1132,6 +1141,7 @@ def test_basic_computer_use_preview_tool_call():"user": None,"metadata": {},}+class MockResponse:def __init__(self, json_data, status_code):self._json_data = json_data@@ -1151,21 +1161,23 @@ def test_basic_computer_use_preview_tool_call():# Call the responses API with computer_use_preview toolresponse = litellm.responses(model="openai/computer-use-preview",- tools=[{- "type": "computer_use_preview",- "display_width": 1024,- "display_height": 768,- "environment": "linux" # other possible values: "mac", "windows", "ubuntu"- }],+ tools=[+ {+ "type": "computer_use_preview",+ "display_width": 1024,+ "display_height": 768,+ "environment": "linux", # other possible values: "mac", "windows", "ubuntu"+ }+ ],input="Check the latest OpenAI news on bing.com.",reasoning={"summary": "concise"},- truncation="auto"+ truncation="auto",)# Verify the request was made correctlymock_post.assert_called_once()request_body = mock_post.call_args.kwargs["json"]-+# Validate the request structureassert request_body["model"] == "computer-use-preview"assert len(request_body["tools"]) == 1@@ -1173,15 +1185,14 @@ def test_basic_computer_use_preview_tool_call():assert request_body["tools"][0]["display_width"] == 1024assert request_body["tools"][0]["display_height"] == 768assert request_body["tools"][0]["environment"] == "linux"-+# Check that reasoning was passed correctlyassert request_body["reasoning"]["summary"] == "concise"assert request_body["truncation"] == "auto"-+# Validate the input formatassert isinstance(request_body["input"], str)assert request_body["input"] == "Check the latest OpenAI news on bing.com."-def test_mcp_tools_with_responses_api():@@ -1193,19 +1204,15 @@ def test_mcp_tools_with_responses_api():"server_url": "https://mcp.zapier.com/api/mcp/mcp","headers": {"Authorization": f"Bearer {os.getenv('ZAPIER_CI_CD_MCP_TOKEN')}"- }+ },}]MODEL = "openai/gpt-4.1"USER_QUERY = "how does tiktoken work?"#########################################################- # Step 1: OpenAI will use MCP LIST, and return a list of MCP calls for our approval+ # Step 1: OpenAI will use MCP LIST, and return a list of MCP calls for our approvaltry:- response = litellm.responses(- model=MODEL,- tools=MCP_TOOLS,- input=USER_QUERY- )+ response = litellm.responses(model=MODEL, tools=MCP_TOOLS, input=USER_QUERY)print(response)response = cast(ResponsesAPIResponse, response)@@ -1225,20 +1232,26 @@ def test_mcp_tools_with_responses_api():{"type": "mcp_approval_response","approve": True,- "approval_request_id": mcp_approval_id+ "approval_request_id": mcp_approval_id,}],previous_response_id=response.id,)print(response_with_mcp_call)except litellm.APIError as e:- if "424" in str(e) or "Failed Dependency" in str(e) or "external_connector_error" in str(e):+ if (+ "424" in str(e)+ or "Failed Dependency" in str(e)+ or "external_connector_error" in str(e)+ ):pytest.skip(f"Skipping test due to external MCP server error: {e}")else:raise eexcept litellm.InternalServerError as e:if "500" in str(e) or "server_error" in str(e):- pytest.skip(f"Skipping test due to OpenAI server error (likely MCP server unavailable): {e}")+ pytest.skip(+ f"Skipping test due to OpenAI server error (likely MCP server unavailable): {e}"+ )else:raise e@@ -1248,29 +1261,28 @@ async def test_openai_responses_api_field_types():"""Test that specific fields in the response have the correct types"""litellm._turn_on_debug()litellm.set_verbose = True-+# Test with store=Trueresponse = await litellm.aresponses(model="gpt-4o",input="hi",)-+# Verify created_at is an integerassert isinstance(response.created_at, int), "created_at should be an integer"-+# Verify store field is present and matches inputassert hasattr(response, "store"), "store field should be present"assert response.store is True, "store field should match input value"-+# Test without store parameter- response_without_store = await litellm.aresponses(- model="gpt-4o",- input="hi"- )-+ response_without_store = await litellm.aresponses(model="gpt-4o", input="hi")+# Verify created_at is still an integer- assert isinstance(response_without_store.created_at, int), "created_at should be an integer"-+ assert isinstance(+ response_without_store.created_at, int+ ), "created_at should be an integer"+# Verify store field is present but None when not specifiedassert hasattr(response_without_store, "store"), "store field should be present"@@ -1279,7 +1291,7 @@ async def test_openai_responses_api_field_types():async def test_store_field_transformation():"""Test store field transformation with mocked API responses"""config = OpenAIResponsesAPIConfig()-+# Initialize logging object with required parameterslogging_obj = LiteLLMLoggingObj(model="gpt-4o",@@ -1288,7 +1300,7 @@ async def test_store_field_transformation():call_type="aresponses",start_time=time.time(),litellm_call_id="test-call-id",- function_id="test-function-id"+ function_id="test-function-id",)# Base response data with all required fields@@ -1297,7 +1309,17 @@ async def test_store_field_transformation():"created_at": 1751443898,"model": "gpt-4o","object": "response",- "output": [{"type": "message", "id": "msg_1", "status": "completed", "role": "assistant", "content": [{"type": "output_text", "text": "Hello", "annotations": []}]}],+ "output": [+ {+ "type": "message",+ "id": "msg_1",+ "status": "completed",+ "role": "assistant",+ "content": [+ {"type": "output_text", "text": "Hello", "annotations": []}+ ],+ }+ ],"parallel_tool_calls": True,"tool_choice": "auto","tools": [],@@ -1314,70 +1336,70 @@ async def test_store_field_transformation():"text": None,"truncation": "auto","usage": {"input_tokens": 10, "output_tokens": 20, "total_tokens": 30},- "user": "test_user"+ "user": "test_user",}# Test case 1: API returns store=Truemock_response_store_true = httpx.Response(- status_code=200,- content=json.dumps({**base_response, "store": True}).encode()+ status_code=200, content=json.dumps({**base_response, "store": True}).encode())# Test case 2: API returns store=Falsemock_response_store_false = httpx.Response(- status_code=200,- content=json.dumps({**base_response, "store": False}).encode()+ status_code=200, content=json.dumps({**base_response, "store": False}).encode())# Test case 3: API returns store=nullmock_response_store_null = httpx.Response(- status_code=200,- content=json.dumps({**base_response, "store": None}).encode()+ status_code=200, content=json.dumps({**base_response, "store": None}).encode())# Test case 4: API omits store fieldmock_response_no_store = httpx.Response(- status_code=200,- content=json.dumps(base_response).encode()+ status_code=200, content=json.dumps(base_response).encode())# Test when store=True in requestlogging_obj.optional_params = {"store": True}response = config.transform_response_api_response(- model="gpt-4o",- raw_response=mock_response_store_true,- logging_obj=logging_obj+ model="gpt-4o", raw_response=mock_response_store_true, logging_obj=logging_obj)- assert response.store is True, "store should be True when specified in request and API returns True"+ assert (+ response.store is True+ ), "store should be True when specified in request and API returns True"# Test when store=False in requestlogging_obj.optional_params = {"store": False}response = config.transform_response_api_response(- model="gpt-4o",- raw_response=mock_response_store_false,- logging_obj=logging_obj+ model="gpt-4o", raw_response=mock_response_store_false, logging_obj=logging_obj)- assert response.store is False, "store should be False when specified in request and API returns False"+ assert (+ response.store is False+ ), "store should be False when specified in request and API returns False"# Test when store not in request but API returns nullresponse = config.transform_response_api_response(- model="gpt-4o",- raw_response=mock_response_store_null,- logging_obj=logging_obj+ model="gpt-4o", raw_response=mock_response_store_null, logging_obj=logging_obj)- assert response.store is None, "store should be None when not specified in request and API returns null"+ assert (+ response.store is None+ ), "store should be None when not specified in request and API returns null"# Test when store not in request and API omits store fieldresponse = config.transform_response_api_response(- model="gpt-4o",- raw_response=mock_response_no_store,- logging_obj=logging_obj+ model="gpt-4o", raw_response=mock_response_no_store, logging_obj=logging_obj)- assert response.store is None, "store should be None when not specified in request and API omits store"+ assert (+ response.store is None+ ), "store should be None when not specified in request and API omits store"# Verify created_at is always converted to integer- assert isinstance(response.created_at, int), "created_at should always be converted to integer"- assert response.created_at == 1751443898, "created_at should maintain the same value after conversion"+ assert isinstance(+ response.created_at, int+ ), "created_at should always be converted to integer"+ assert (+ response.created_at == 1751443898+ ), "created_at should maintain the same value after conversion"@pytest.mark.asyncio@@ -1455,10 +1477,14 @@ async def test_aresponses_service_tier_and_safety_identifier():mock_post.assert_called_once()request_body = mock_post.call_args.kwargs["json"]print("request_body=", json.dumps(request_body, indent=4, default=str))-+# Validate that both parameters are present in the request body- assert request_body["service_tier"] == "flex", "service_tier should be 'flex' in request body"- assert request_body["safety_identifier"] == "123", "safety_identifier should be '123' in request body"+ assert (+ request_body["service_tier"] == "flex"+ ), "service_tier should be 'flex' in request body"+ assert (+ request_body["safety_identifier"] == "123"+ ), "safety_identifier should be '123' in request body"assert request_body["model"] == "gpt-4o"assert request_body["input"] == "Test with service tier and safety identifier"@@ -1469,11 +1495,11 @@ async def test_aresponses_service_tier_and_safety_identifier():@pytest.mark.asyncioasync def test_openai_gpt5_reasoning_effort_parameter():"""Test that reasoning_effort parameter is properly sent in the HTTP request for GPT-5 models."""-+# Mock response for GPT-5 responses API (correct format)mock_response = {"id": "resp_01ABC123",- "object": "response",+ "object": "response","created_at": 1729621667,"status": "completed","model": "gpt-5-mini",@@ -1481,10 +1507,14 @@ async def test_openai_gpt5_reasoning_effort_parameter():{"type": "message","id": "msg_123",- "status": "completed",+ "status": "completed","role": "assistant","content": [- {"type": "output_text", "text": "The capital of France is Paris.", "annotations": []}+ {+ "type": "output_text",+ "text": "The capital of France is Paris.",+ "annotations": [],+ }],}],@@ -1544,8 +1574,12 @@ async def test_openai_gpt5_reasoning_effort_parameter():print("request_body=", json.dumps(request_body, indent=4, default=str))print("reasoning=", request_body["reasoning"])# Validate that reasoning_effort is present in the request body- assert "reasoning" in request_body, "reasoning should be present in request body"- assert request_body["reasoning"]["effort"] == "minimal", "reasoning_effort should be 'minimal' in request body"+ assert (+ "reasoning" in request_body+ ), "reasoning should be present in request body"+ assert (+ request_body["reasoning"]["effort"] == "minimal"+ ), "reasoning_effort should be 'minimal' in request body"assert request_body["model"] == "gpt-5-mini"assert request_body["input"] == "What is the capital of France?"@@ -1553,9 +1587,6 @@ async def test_openai_gpt5_reasoning_effort_parameter():print("Response:", json.dumps(response, indent=4, default=str))---@pytest.mark.asyncio@pytest.mark.parametrize("stream", [True, False])async def test_basic_openai_responses_with_websearch(stream):@@ -1565,12 +1596,7 @@ async def test_basic_openai_responses_with_websearch(stream):model=request_model,stream=stream,input="hi",- tools=[- {- "type": "web_search",- "search_context_size": "low"- }- ]+ tools=[{"type": "web_search", "search_context_size": "low"}],)if stream:async for chunk in response:@@ -1596,10 +1622,49 @@ async def test_openai_responses_api_token_limit_error():# This will raise ValidationError instead of showing the real errorresponse = await litellm.aresponses(- model="gpt-5-mini",- input=oversized_text,- stream=True+ model="gpt-5-mini", input=oversized_text, stream=True+ )++ async for event in response:+ print(event) # Never reaches here - ValidationError is raised+++async def test_openai_streaming_logging():+ """Test that hard_limit parameter is properly sent in the HTTP request for GPT-5 models."""+ litellm._turn_on_debug()+ from litellm.integrations.custom_logger import CustomLogger+ from litellm.types.utils import Usage++ class TestCustomLogger(CustomLogger):+ validate_usage = False++ def __init__(self):+ self.standard_logging_object: Optional[StandardLoggingPayload] = None++ async def async_log_success_event(+ self, kwargs, response_obj, start_time, end_time+ ):+ print(f"response_obj: {response_obj.usage}")+ assert isinstance(+ response_obj.usage, Usage+ ), f"Expected response_obj.usage to be of type Usage, but got {type(response_obj.usage)}"+ print("\n\nVALIDATED USAGE\n\n")+ self.validate_usage = True++ tcl = TestCustomLogger()+ litellm.callbacks = [tcl]+ request_model = "gpt-5-mini"+ response = await litellm.aresponses(+ model=request_model,+ input="What is the capital of France?",+ stream=True,)+ print("response=", json.dumps(response, indent=4, default=str))async for event in response:- print(event) # Never reaches here - ValidationError is raised\ No newline at end of file+ if event.type == "response.completed":+ final_response = event+ print("litellm response=", json.dumps(event, indent=4, default=str))++ await asyncio.sleep(2)+ assert tcl.validate_usage, "Usage should be validated"diff --git a/tests/local_testing/test_completion.py b/tests/local_testing/test_completion.pyindex 6f333c4eddf..a3f3ba5729a 100644--- a/tests/local_testing/test_completion.py+++ b/tests/local_testing/test_completion.py@@ -2470,8 +2470,6 @@ def test_completion_azure_key_completion_arg():pytest.fail(f"Error occurred: {e}")--async def test_re_use_azure_async_client():try:print("azure gpt-3.5 ASYNC with clie nttest\n\n")@@ -4272,7 +4270,6 @@ def test_deepseek_reasoning_content_completion():pytest.skip("Model is timing out")-def test_qwen_text_completion():# litellm._turn_on_debug()resp = litellm.completion(@@ -4407,3 +4404,37 @@ def test_completion_gpt_4o_empty_str():messages=[{"role": "user", "content": ""}],)assert resp.choices[0].message.content is not None+++def test_edit_note():+ litellm.callbacks = ["langfuse_otel"]+ response = completion(+ model="gpt-4o",+ messages=[+ {+ "role": "system",+ "content": "Your only job is to call the edit_note tool with the content specified in the user's message.",+ },+ {+ "role": "user",+ "content": "Edit the note with the content: 'This is a test note.'",+ },+ ],+ tools=[+ {+ "type": "function",+ "function": {+ "name": "edit_note",+ "description": "Edit the note with the content specified in the user's message.",+ "parameters": {+ "type": "object",+ "properties": {+ "content": {"type": "string"},+ },+ },+ },+ },+ ],+ )++ return responsediff --git a/tests/test_litellm/integrations/test_langfuse_otel.py b/tests/test_litellm/integrations/test_langfuse_otel.pyindex 6694ea95472..f8c662979ad 100644--- a/tests/test_litellm/integrations/test_langfuse_otel.py+++ b/tests/test_litellm/integrations/test_langfuse_otel.py@@ -1,5 +1,6 @@import jsonimport os+from datetime import datetimefrom unittest.mock import MagicMock, patchimport pytest@@ -7,7 +8,6 @@ import pytestfrom litellm.integrations.langfuse.langfuse_otel import LangfuseOtelLoggerfrom litellm.types.integrations.langfuse_otel import LangfuseOtelConfigfrom litellm.types.llms.openai import ResponsesAPIResponse-from datetime import datetimeclass TestLangfuseOtelIntegration:@@ -75,6 +75,10 @@ class TestLangfuseOtelIntegration:def test_set_langfuse_otel_attributes(self):"""Test that set_langfuse_otel_attributes calls the Arize utils function."""+ from litellm.integrations.langfuse.langfuse_otel_attributes import (+ LangfuseLLMObsOTELAttributes,+ )+mock_span = MagicMock()mock_kwargs = {"test": "kwargs"}mock_response = {"test": "response"}@@ -82,7 +86,7 @@ class TestLangfuseOtelIntegration:with patch('litellm.integrations.arize._utils.set_attributes') as mock_set_attributes:LangfuseOtelLogger.set_langfuse_otel_attributes(mock_span, mock_kwargs, mock_response)- mock_set_attributes.assert_called_once_with(mock_span, mock_kwargs, mock_response)+ mock_set_attributes.assert_called_once_with(mock_span, mock_kwargs, mock_response, LangfuseLLMObsOTELAttributes)def test_set_langfuse_environment_attribute(self):"""Test that Langfuse environment is set correctly when environment variable is present."""@@ -191,8 +195,8 @@ class TestLangfuseOtelIntegration:def test_set_langfuse_specific_attributes_with_content(self):"""Test that _set_langfuse_specific_attributes correctly sets observation.output with regular content response."""- from litellm.types.utils import Choices, ModelResponsefrom litellm.types.integrations.langfuse_otel import LangfuseSpanAttributes+ from litellm.types.utils import Choices, ModelResponse# Create response with contentresponse_obj = ModelResponse(@@ -240,8 +244,13 @@ class TestLangfuseOtelIntegration:def test_set_langfuse_specific_attributes_with_tool_calls(self):"""Test that _set_langfuse_specific_attributes correctly sets observation.output with tool calls in Langfuse format."""- from litellm.types.utils import Choices, Function, ChatCompletionMessageToolCall, ModelResponsefrom litellm.types.integrations.langfuse_otel import LangfuseSpanAttributes+ from litellm.types.utils import (+ ChatCompletionMessageToolCall,+ Choices,+ Function,+ ModelResponse,+ )# Create response with tool callsresponse_obj = ModelResponse(@@ -388,13 +397,17 @@ class TestLangfuseOtelResponsesAPI:mock_span = MagicMock()+ from litellm.integrations.langfuse.langfuse_otel_attributes import (+ LangfuseLLMObsOTELAttributes,+ )+with patch('litellm.integrations.arize._utils.set_attributes') as mock_set_attributes:with patch('litellm.integrations.arize._utils.safe_set_attribute') as mock_safe_set_attribute:logger = LangfuseOtelLogger()logger.set_langfuse_otel_attributes(mock_span, kwargs, mock_response)# Verify that set_attributes was called for general attributes- mock_set_attributes.assert_called_once_with(mock_span, kwargs, mock_response)+ mock_set_attributes.assert_called_once_with(mock_span, kwargs, mock_response, LangfuseLLMObsOTELAttributes)# Verify that Langfuse-specific attributes were setmock_safe_set_attribute.assert_any_call(