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(azure/responses): always remove status
Krrish Dholakia5336fcc0002c
diff --git a/litellm/llms/azure/responses/transformation.py b/litellm/llms/azure/responses/transformation.pyindex 0050bd163d1..9cd5de46be9 100644--- a/litellm/llms/azure/responses/transformation.py+++ b/litellm/llms/azure/responses/transformation.py@@ -1,6 +1,7 @@from typing import TYPE_CHECKING, Any, Dict, Literal, Optional, Tupleimport httpx+from openai.types.responses import ResponseReasoningItemfrom litellm._logging import verbose_loggerfrom litellm.llms.azure.common_utils import BaseAzureLLM@@ -38,6 +39,50 @@ class AzureOpenAIResponsesAPIConfig(OpenAIResponsesAPIConfig):model = model.replace("o_series/", "")return model+ def _handle_reasoning_item(self, item: Dict[str, Any]) -> Dict[str, Any]:+ """+ Handle reasoning items specifically to filter out status=None using OpenAI's model.+ Issue: https://github.com/BerriAI/litellm/issues/13484+ OpenAI API does not accept ReasoningItem(status=None), so we need to:+ 1. Check if the item is a reasoning type+ 2. Create a ResponseReasoningItem object with the item data+ 3. Convert it back to dict with exclude_none=True to filter None values+ """+ if item.get("type") == "reasoning":+ try:+ # Ensure required fields are present for ResponseReasoningItem+ item_data = dict(item)+ if "id" not in item_data:+ item_data["id"] = f"reasoning_{hash(str(item_data))}"+ if "summary" not in item_data:+ item_data["summary"] = (+ item_data.get("reasoning_content", "")[:100] + "..."+ if len(item_data.get("reasoning_content", "")) > 100+ else item_data.get("reasoning_content", "")+ )++ # Create ResponseReasoningItem object from the item data+ reasoning_item = ResponseReasoningItem(**item_data)++ # Convert back to dict with exclude_none=True to exclude None fields+ dict_reasoning_item = reasoning_item.model_dump(exclude_none=True)+ dict_reasoning_item.pop("status", None)++ return dict_reasoning_item+ except Exception as e:+ verbose_logger.debug(+ f"Failed to create ResponseReasoningItem, falling back to manual filtering: {e}"+ )+ # Fallback: manually filter out known None fields+ filtered_item = {+ k: v+ for k, v in item.items()+ if v is not None+ or k not in {"status", "content", "encrypted_content"}+ }+ return filtered_item+ return item+def transform_responses_api_request(self,model: str,@@ -48,12 +93,13 @@ class AzureOpenAIResponsesAPIConfig(OpenAIResponsesAPIConfig):) -> Dict:"""No transform applied since inputs are in OpenAI spec already"""stripped_model_name = self.get_stripped_model_name(model)- return dict(- ResponsesAPIRequestParams(- model=stripped_model_name,- input=input,- **response_api_optional_request_params,- )++ return super().transform_responses_api_request(+ model=stripped_model_name,+ input=input,+ response_api_optional_request_params=response_api_optional_request_params,+ litellm_params=litellm_params,+ headers=headers,)def get_complete_url(@@ -217,15 +263,15 @@ class AzureOpenAIResponsesAPIConfig(OpenAIResponsesAPIConfig):at the correct location (before any query parameters)."""from urllib.parse import urlparse, urlunparse-+# Parse the URL to separate its componentsparsed_url = urlparse(api_base)-+# Insert the response_id and /cancel at the end of the path component# Remove trailing slash if present to avoid double slashespath = parsed_url.path.rstrip("/")new_path = f"{path}/{response_id}/cancel"-+# Reconstruct the URL with all original components but with the modified pathcancel_url = urlunparse((diff --git a/litellm/llms/openai/responses/transformation.py b/litellm/llms/openai/responses/transformation.pyindex 25078267571..3d0ec243e5c 100644--- a/litellm/llms/openai/responses/transformation.py+++ b/litellm/llms/openai/responses/transformation.py@@ -1,12 +1,4 @@-from typing import (- TYPE_CHECKING,- Any,- Dict,- Optional,- Union,- cast,- get_type_hints,-)+from typing import TYPE_CHECKING, Any, Dict, Optional, Union, cast, get_type_hintsimport httpxfrom openai.types.responses import ResponseReasoningItem@@ -127,7 +119,6 @@ class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig):2. Create a ResponseReasoningItem object with the item data3. Convert it back to dict with exclude_none=True to filter None values"""- verbose_logger.debug(f"Handling reasoning item: {item}")if item.get("type") == "reasoning":try:# Ensure required fields are present for ResponseReasoningItemdiff --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/onboarding.html b/litellm/proxy/_experimental/out/onboarding.htmldeleted file mode 100644index 6171839cc6d..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-a426aae3231a8df1.js"/><script src="/litellm-asset-prefix/_next/static/chunks/fd9d1056-205af899b895cbac.js" async=""></script><script src="/litellm-asset-prefix/_next/static/chunks/117-6a9f6a591033d4a0.js" async=""></script><script src="/litellm-asset-prefix/_next/static/chunks/main-app-bb35cb240fbb9dca.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-a426aae3231a8df1.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/c200be8dd8638678.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"4:I[12846,[],\"\"]\n6:I[19107,[],\"ClientPageRoot\"]\n7:I[12011,[\"665\",\"static/chunks/3014691f-b7b79b78e27792f3.js\",\"50\",\"static/chunks/50-d0da2dd7acce2eb9.js\",\"49\",\"static/chunks/49-b6f167418ea8dbf4.js\",\"461\",\"static/chunks/app/onboarding/page-1fd26064f407ad1d.js\"],\"default\",1]\n8:I[4707,[],\"\"]\n9:I[36423,[],\"\"]\nb:I[61060,[],\"\"]\nc:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L4\",null,{\"buildId\":\"_S0i_Y-CCoYQWc9dIuLxF\",\"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/c200be8dd8638678.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_1c856b\",\"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,\"$La\"],\"globalErrorComponent\":\"$b\",\"missingSlots\":\"$Wc\"}]\n"])</script><script>self.__next_f.push([1,"a:[[\"$\",\"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/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yamlindex b7b30d36f99..52a6fc16ff1 100644--- a/litellm/proxy/_new_secret_config.yaml+++ b/litellm/proxy/_new_secret_config.yaml@@ -1,33 +1,6 @@model_list:- - model_name: openai/gpt-4o+ - model_name: gpt-5-minilitellm_params:- model: openai/gpt-4o-mini- api_base: "https://webhook.site/2f385e05-00aa-402b-86d1-efc9261471a5"- api_key: dummy- - model_name: "byok-wildcard/*"- litellm_params:- model: openai/*- - model_name: xai-grok-3- litellm_params:- model: xai/grok-3- - model_name: hosted_vllm/whisper-v3- litellm_params:- model: hosted_vllm/whisper-v3- api_base: "https://webhook.site/2f385e05-00aa-402b-86d1-efc9261471a5"- api_key: dummy--# mcp_servers:-# github_mcp:-# url: "https://api.githubcopilot.com/mcp"-# auth_type: oauth2-# authorization_url: https://github.com/login/oauth/authorize-# token_url: https://github.com/login/oauth/access_token-# client_id: os.environ/GITHUB_OAUTH_CLIENT_ID-# client_secret: os.environ/GITHUB_OAUTH_CLIENT_SECRET-# scopes: ["public_repo", "user:email"]-# allowed_tools: ["list_tools"]-# # disallowed_tools: ["repo_delete"]--litellm_settings:- callbacks: ["prometheus"]- custom_prometheus_metadata_labels: ["metadata.initiative", "metadata.business-unit"]\ No newline at end of file+ model: azure/gpt-5-mini-2+ api_key: os.environ/AZURE_API_KEY_ALT+ api_base: os.environ/AZURE_API_BASE_ALTdiff --git a/tests/llm_responses_api_testing/test_azure_responses_api.py b/tests/llm_responses_api_testing/test_azure_responses_api.pyindex 692f6774ac4..6305137ff45 100644--- a/tests/llm_responses_api_testing/test_azure_responses_api.py+++ b/tests/llm_responses_api_testing/test_azure_responses_api.py@@ -19,6 +19,7 @@ from litellm.types.llms.openai import (from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandlerfrom base_responses_api import BaseResponsesAPITest+class TestAzureResponsesAPITest(BaseResponsesAPITest):def get_base_completion_call_args(self):return {@@ -43,4 +44,55 @@ async def test_azure_responses_api_preview_api_version():api_base=os.getenv("AZURE_RESPONSES_OPENAI_ENDPOINT"),api_key=os.getenv("AZURE_RESPONSES_OPENAI_API_KEY"),input="Hello, can you tell me a short joke?",- )\ No newline at end of file+ )+++async def test_azure_responses_api_status_error():+ """+ Ensure new azure preview api version is working+ """+ litellm._turn_on_debug()++ request_data = {+ "model": "gpt-5-mini",+ "input": [+ {"content": "tell me an interesting fact", "role": "user"},+ {+ "id": "rs_0ab687487834d9df0068e462a1b2d88197aabbc832c9ba5316",+ "summary": [],+ "type": "reasoning",+ "content": None,+ "encrypted_content": None,+ "status": "completed",+ },+ {+ "id": "msg_0ab687487834d9df0068e462a1df188197b74b1eef05102c18",+ "content": [+ {+ "annotations": [],+ "text": "Octopuses have three hearts: two pump blood to the gills, while the third pumps it to the rest of the body. Even more unusual, their blood is blue because it uses the copper-containing protein hemocyanin to carry oxygen, which is more efficient than hemoglobin in cold, low-oxygen environments.",+ "type": "output_text",+ "logprobs": [],+ }+ ],+ "role": "assistant",+ "status": "completed",+ "type": "message",+ },+ {"role": "user", "content": "tell me another"},+ ],+ "include": [],+ "instructions": "You are a helpful assistant.",+ "reasoning": {"effort": "minimal"},+ "stream": False,+ "tools": [],+ }+ response = await litellm.aresponses(+ model="azure/gpt-5-mini-2",+ truncation="auto",+ api_version="preview",+ api_base=os.getenv("AZURE_GPT5_MINI_API_BASE"),+ api_key=os.getenv("AZURE_GPT5_MINI_API_KEY"),+ input=request_data["input"],+ )