diff --git a/backend/open_webui/apps/openai/main.py b/backend/open_webui/apps/openai/main.py index 93155063f..e0a40a1f5 100644 --- a/backend/open_webui/apps/openai/main.py +++ b/backend/open_webui/apps/openai/main.py @@ -415,6 +415,9 @@ async def generate_chat_completion( payload["max_tokens"] = payload["max_completion_tokens"] del payload["max_completion_tokens"] else: + if payload["model"].lower().startswith("o1-") and "max_tokens" in payload: + payload["max_completion_tokens"] = payload["max_tokens"] + del payload["max_tokens"] if "max_tokens" in payload and "max_completion_tokens" in payload: del payload["max_tokens"]