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
feat(openai/o_series_transformation.py): support native streaming for all openai o-series models (#8552)
Krish Dholakia0c0f6c23e204
diff --git a/litellm/llms/openai/chat/o_series_transformation.py b/litellm/llms/openai/chat/o_series_transformation.pyindex 3cc05b3c955..9e68fca46f5 100644--- a/litellm/llms/openai/chat/o_series_transformation.py+++ b/litellm/llms/openai/chat/o_series_transformation.py@@ -43,23 +43,6 @@ class OpenAIOSeriesConfig(OpenAIGPTConfig):"""return messages- def should_fake_stream(- self,- model: Optional[str],- stream: Optional[bool],- custom_llm_provider: Optional[str] = None,- ) -> bool:- if stream is not True:- return False-- if model is None:- return True- supported_stream_models = ["o1-mini", "o1-preview", "o3-mini"]- for supported_model in supported_stream_models:- if supported_model in model:- return False- return True-def get_supported_openai_params(self, model: str) -> list:"""Get the supported OpenAI params for the given modeldiff --git a/tests/llm_translation/test_openai_o1.py b/tests/llm_translation/test_openai_o1.pyindex 16b86414c2f..4208f1ae383 100644--- a/tests/llm_translation/test_openai_o1.py+++ b/tests/llm_translation/test_openai_o1.py@@ -206,12 +206,13 @@ def test_o3_reasoning_effort():assert resp.choices[0].message.content is not None-def test_streaming_response():[email protected]("model", ["o1-preview", "o1-mini", "o1", "o3-mini"])+def test_streaming_response(model):"""Test that streaming response is returned correctly"""from litellm import completionresponse = completion(- model="o3-mini",+ model=model,messages=[{"role": "system", "content": "Be a good bot!"},{"role": "user", "content": "Hello!"},