diff --git a/tests/entrypoints/openai/chat_completion/test_chat.py b/tests/entrypoints/openai/chat_completion/test_chat.py index 6703095aec..16a3cd857c 100644 --- a/tests/entrypoints/openai/chat_completion/test_chat.py +++ b/tests/entrypoints/openai/chat_completion/test_chat.py @@ -808,14 +808,20 @@ async def test_invocations(server: RemoteOpenAIServer, client: openai.AsyncOpenA "logprobs": False, } - chat_completion = await client.chat.completions.create(**request_args) + # Use raw HTTP for both endpoints so we compare server responses + # directly, without the openai SDK injecting extra fields + # (e.g. `moderation` added in newer SDK versions). + chat_response = requests.post( + server.url_for("v1/chat/completions"), json=request_args + ) + chat_response.raise_for_status() invocation_response = requests.post( server.url_for("invocations"), json=request_args ) invocation_response.raise_for_status() - chat_output = chat_completion.model_dump() + chat_output = chat_response.json() invocation_output = invocation_response.json() assert chat_output.keys() == invocation_output.keys()