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
[Bug Fix] litellm incompatible with newest release of openAI v1.100.0 (#13728)
Ishaan Jaff76f106422902
diff --git a/.circleci/config.yml b/.circleci/config.ymlindex 796ac8ce597..e5b1a2d0bf3 100644--- a/.circleci/config.yml+++ b/.circleci/config.yml@@ -95,7 +95,7 @@ jobs:pip install opentelemetry-api==1.25.0pip install opentelemetry-sdk==1.25.0pip install opentelemetry-exporter-otlp==1.25.0- pip install openai==1.99.5+ pip install openai==1.100.1pip install prisma==0.11.0pip install "detect_secrets==1.5.0"pip install "httpx==0.24.1"@@ -220,7 +220,7 @@ jobs:pip install opentelemetry-api==1.25.0pip install opentelemetry-sdk==1.25.0pip install opentelemetry-exporter-otlp==1.25.0- pip install openai==1.99.5+ pip install openai==1.100.1pip install prisma==0.11.0pip install "detect_secrets==1.5.0"pip install "httpx==0.24.1"@@ -327,7 +327,7 @@ jobs:pip install opentelemetry-api==1.25.0pip install opentelemetry-sdk==1.25.0pip install opentelemetry-exporter-otlp==1.25.0- pip install openai==1.99.5+ pip install openai==1.100.1pip install prisma==0.11.0pip install "detect_secrets==1.5.0"pip install "httpx==0.24.1"@@ -602,7 +602,7 @@ jobs:pip install opentelemetry-api==1.25.0pip install opentelemetry-sdk==1.25.0pip install opentelemetry-exporter-otlp==1.25.0- pip install openai==1.99.5+ pip install openai==1.100.1pip install prisma==0.11.0pip install "detect_secrets==1.5.0"pip install "httpx==0.24.1"@@ -1522,7 +1522,7 @@ jobs:pip install "aiodynamo==23.10.1"pip install "asyncio==3.4.3"pip install "PyGithub==1.59.1"- pip install "openai==1.99.5"+ pip install "openai==1.100.1"- run:name: Install dockerizecommand: |@@ -1679,7 +1679,7 @@ jobs:pip install "aiodynamo==23.10.1"pip install "asyncio==3.4.3"pip install "PyGithub==1.59.1"- pip install "openai==1.99.5"+ pip install "openai==1.100.1"# Run pytest and generate JUnit XML report- run:name: Install dockerize@@ -1819,7 +1819,7 @@ jobs:pip install "aiodynamo==23.10.1"pip install "asyncio==3.4.3"pip install "PyGithub==1.59.1"- pip install "openai==1.99.5"+ pip install "openai==1.100.1"- run:name: Install dockerizecommand: |@@ -2399,7 +2399,7 @@ jobs:pip install "pytest-asyncio==0.21.1"pip install "google-cloud-aiplatform==1.43.0"pip install aiohttp- pip install "openai==1.99.5"+ pip install "openai==1.100.1"pip install "assemblyai==0.37.0"python -m pip install --upgrade pippip install "pydantic==2.10.2"@@ -2790,7 +2790,7 @@ jobs:pip install "pytest-retry==1.6.3"pip install "pytest-asyncio==0.21.1"pip install aiohttp- pip install "openai==1.99.5"+ pip install "openai==1.100.1"python -m pip install --upgrade pippip install "pydantic==2.10.2"pip install "pytest==7.3.1"diff --git a/.circleci/requirements.txt b/.circleci/requirements.txtindex f610e1aa56f..f41a5291e50 100644--- a/.circleci/requirements.txt+++ b/.circleci/requirements.txt@@ -1,5 +1,5 @@# used by CI/CD testing-openai==1.99.5+openai==1.100.1python-dotenvtiktokenimportlib_metadatadiff --git a/.github/workflows/test-linting.yml b/.github/workflows/test-linting.ymlindex 5a4323b3e9b..ffca305a0d0 100644--- a/.github/workflows/test-linting.yml+++ b/.github/workflows/test-linting.yml@@ -22,11 +22,8 @@ jobs:- name: Install dependenciesrun: |- pip install openai==1.99.5poetry install --with dev- pip install openai==1.99.5--+ poetry run pip install openai==1.100.1- name: Run Black formattingrun: |@@ -40,6 +37,10 @@ jobs:poetry run ruff check .cd ..+ - name: Print OpenAI version+ run: |+ poetry run python -c "import openai; print(f'OpenAI version: {openai.__version__}')"+- name: Run MyPy type checkingrun: |cd litellmdiff --git a/docker/build_from_pip/requirements.txt b/docker/build_from_pip/requirements.txtindex 71e038b6267..cc14b99727f 100644--- a/docker/build_from_pip/requirements.txt+++ b/docker/build_from_pip/requirements.txt@@ -2,4 +2,5 @@ litellm[proxy]==1.67.4.dev1 # Specify the litellm version you want to useprometheus_clientlangfuseprisma+openai==1.99.9ddtrace==2.19.0 # for advanced DD tracing / profilingdiff --git a/litellm/responses/litellm_completion_transformation/transformation.py b/litellm/responses/litellm_completion_transformation/transformation.pyindex 3706b2f7fc9..ba453edbf66 100644--- a/litellm/responses/litellm_completion_transformation/transformation.py+++ b/litellm/responses/litellm_completion_transformation/transformation.py@@ -33,7 +33,6 @@ from litellm.types.llms.openai import (ResponseInputParam,ResponsesAPIOptionalRequestParams,ResponsesAPIResponse,- ResponseTextConfig,)from litellm.types.responses.main import (GenericResponseOutputItem,@@ -659,7 +658,7 @@ class LiteLLMCompletionResponsesConfig:),reasoning=Reasoning(),status=getattr(chat_completion_response, "status", "completed"),- text=ResponseTextConfig(),+ text={},truncation=getattr(chat_completion_response, "truncation", None),usage=LiteLLMCompletionResponsesConfig._transform_chat_completion_usage_to_responses_usage(chat_completion_response=chat_completion_responsediff --git a/litellm/responses/main.py b/litellm/responses/main.pyindex b5f18cf9e1a..2a26c54a56e 100644--- a/litellm/responses/main.py+++ b/litellm/responses/main.py@@ -21,7 +21,7 @@ from litellm.types.llms.openai import (ResponseInputParam,ResponsesAPIOptionalRequestParams,ResponsesAPIResponse,- ResponseTextConfigParam,+ ResponseText,ToolChoice,ToolParam,)@@ -104,7 +104,7 @@ async def aresponses_api_with_mcp(background: Optional[bool] = None,stream: Optional[bool] = None,temperature: Optional[float] = None,- text: Optional[ResponseTextConfigParam] = None,+ text: Optional["ResponseText"] = None,tool_choice: Optional[ToolChoice] = None,tools: Optional[Iterable[ToolParam]] = None,top_p: Optional[float] = None,@@ -237,7 +237,7 @@ async def aresponses(background: Optional[bool] = None,stream: Optional[bool] = None,temperature: Optional[float] = None,- text: Optional[ResponseTextConfigParam] = None,+ text: Optional["ResponseText"] = None,tool_choice: Optional[ToolChoice] = None,tools: Optional[Iterable[ToolParam]] = None,top_p: Optional[float] = None,@@ -348,7 +348,7 @@ def responses(background: Optional[bool] = None,stream: Optional[bool] = None,temperature: Optional[float] = None,- text: Optional[ResponseTextConfigParam] = None,+ text: Optional["ResponseText"] = None,tool_choice: Optional[ToolChoice] = None,tools: Optional[Iterable[ToolParam]] = None,top_p: Optional[float] = None,diff --git a/litellm/types/llms/openai.py b/litellm/types/llms/openai.pyindex f2f64fa3c5d..30bf7f7c956 100644--- a/litellm/types/llms/openai.py+++ b/litellm/types/llms/openai.py@@ -37,15 +37,21 @@ from openai.types.responses.response import (IncompleteDetails,Response,ResponseOutputItem,- ResponseTextConfig,Tool,ToolChoice,)++# Handle OpenAI SDK version compatibility for Text type+try:+ from openai.types.responses.response_create_params import Text as ResponseText+except (ImportError, AttributeError):+ # Fall back to the concrete config type available in all SDK versions+ from openai.types.responses.response_text_config_param import ResponseTextConfigParam as ResponseText+from openai.types.responses.response_create_params import (Reasoning,ResponseIncludable,ResponseInputParam,- ResponseTextConfigParam,ToolChoice,ToolParam,)@@ -959,7 +965,7 @@ class ResponsesAPIOptionalRequestParams(TypedDict, total=False):background: Optional[bool]stream: Optional[bool]temperature: Optional[float]- text: Optional[ResponseTextConfigParam]+ text: Optional["ResponseText"]tool_choice: Optional[ToolChoice]tools: Optional[List[ALL_RESPONSES_API_TOOL_PARAMS]]top_p: Optional[float]@@ -1034,7 +1040,7 @@ class ResponsesAPIResponse(BaseLiteLLMOpenAIResponseObject):previous_response_id: Optional[str]reasoning: Optional[Reasoning]status: Optional[str]- text: Optional[ResponseTextConfig]+ text: Optional[Union["ResponseText", Dict[str, Any]]]truncation: Optional[Literal["auto", "disabled"]]usage: Optional[ResponseAPIUsage]user: Optional[str]diff --git a/tests/llm_responses_api_testing/base_responses_api.py b/tests/llm_responses_api_testing/base_responses_api.pyindex bf15e44879b..72f6fb8c9cf 100644--- a/tests/llm_responses_api_testing/base_responses_api.py+++ b/tests/llm_responses_api_testing/base_responses_api.py@@ -21,7 +21,6 @@ from litellm.types.utils import StandardLoggingPayloadfrom litellm.types.llms.openai import (ResponseCompletedEvent,ResponsesAPIResponse,- ResponseTextConfig,ResponseAPIUsage,IncompleteDetails,)@@ -78,7 +77,7 @@ def validate_responses_api_response(response, final_chunk: bool = False):"previous_response_id": (str, type(None)),"reasoning": dict,"status": str,- "text": ResponseTextConfig,+ "text": dict,"truncation": (str, type(None)),"usage": ResponseAPIUsage,"user": (str, type(None)),diff --git a/tests/llm_responses_api_testing/test_anthropic_responses_api.py b/tests/llm_responses_api_testing/test_anthropic_responses_api.pyindex 1e24457145f..8f7a96a016d 100644--- a/tests/llm_responses_api_testing/test_anthropic_responses_api.py+++ b/tests/llm_responses_api_testing/test_anthropic_responses_api.py@@ -17,7 +17,6 @@ from litellm.types.utils import StandardLoggingPayloadfrom litellm.types.llms.openai import (ResponseCompletedEvent,ResponsesAPIResponse,- ResponseTextConfig,ResponseAPIUsage,IncompleteDetails,)diff --git a/tests/llm_responses_api_testing/test_azure_responses_api.py b/tests/llm_responses_api_testing/test_azure_responses_api.pyindex 82f68b4a065..692f6774ac4 100644--- a/tests/llm_responses_api_testing/test_azure_responses_api.py+++ b/tests/llm_responses_api_testing/test_azure_responses_api.py@@ -13,7 +13,6 @@ from litellm.types.utils import StandardLoggingPayloadfrom litellm.types.llms.openai import (ResponseCompletedEvent,ResponsesAPIResponse,- ResponseTextConfig,ResponseAPIUsage,IncompleteDetails,)diff --git a/tests/llm_responses_api_testing/test_openai_responses_api.py b/tests/llm_responses_api_testing/test_openai_responses_api.pyindex 10cb65d59ff..d7042c4304f 100644--- a/tests/llm_responses_api_testing/test_openai_responses_api.py+++ b/tests/llm_responses_api_testing/test_openai_responses_api.py@@ -18,7 +18,6 @@ from litellm.types.utils import StandardLoggingPayloadfrom litellm.types.llms.openai import (ResponseCompletedEvent,ResponsesAPIResponse,- ResponseTextConfig,ResponseAPIUsage,IncompleteDetails,)diff --git a/tests/test_litellm/router_utils/pre_call_checks/test_responses_api_deployment_check.py b/tests/test_litellm/router_utils/pre_call_checks/test_responses_api_deployment_check.pyindex 5db5cb853cd..e2abed2d7f0 100644--- a/tests/test_litellm/router_utils/pre_call_checks/test_responses_api_deployment_check.py+++ b/tests/test_litellm/router_utils/pre_call_checks/test_responses_api_deployment_check.py@@ -17,7 +17,6 @@ from litellm.types.llms.openai import (ResponseAPIUsage,ResponseCompletedEvent,ResponsesAPIResponse,- ResponseTextConfig,)from litellm.types.utils import StandardLoggingPayload