I’m seeing what looks like a server-side inconsistency between the Responses API docs and actual WebSocket behavior.
Summary
When sending response.create over WebSocket (wss://api.openai.com/v1/responses), requests with decimal sampling values
(for example temperature: 1.2) are closed immediately with:
- close code: 1000
- close reason: empty
- no events received (events=)
No error event is returned.
Expected behavior
Based on docs, temperature is a numeric field and decimal values should be accepted.
- WebSocket mode guide: request body mirrors Responses create params (except stream/background differences)
- Responses create docs: temperature is a number
Actual behavior
- temperature: 1.2 → connection closes immediately (1000, no events)
- temperature: 1 → works normally
- temperature: “1.2” (string) → proper invalid_type error event (as expected for wrong type)
This suggests decimal numbers are being handled differently from integers in WebSocket mode.
Repro script (Python)
import asyncio
import json
import websockets
API_KEY = “YOUR_API_KEY”
URL = “wss://api.openai.com/v1/responses”
async def test(temp_value):
async with websockets.connect(
URL,
additional_headers={“Authorization”: f"Bearer {API_KEY}"},
) as ws:
payload = {
“type”: “response.create”,
“model”: “gpt-4.1-mini”,
“input”: \[{
“type”: “message”,
“role”: “user”,
“content”: \[{“type”: “input_text”, “text”: “hello”}\],
}\],
“temperature”: temp_value,
}
await ws.send(json.dumps(payload))
events = []
try:
async for raw in ws:
ev = json.loads(raw)
events.append(ev.get("type"))
if ev.get("type") in {"response.completed", "response.incomplete", "response.failed", "error"}:
break
except websockets.ConnectionClosed:
pass
print("temp:", repr(temp_value))
print("close_code:", ws.close_code)
print("close_reason:", repr(ws.close_reason))
print("events:", events)
asyncio.run(test(1.2)) # closes 1000, events=[ ]
asyncio.run(test(1)) # works
Environment
- Endpoint: wss://api.openai.com/v1/responses
- Model tested: gpt-4.1-mini (also reproduced with other models on our side)
- Client library: Python websockets
- Date observed: 2026-03-03
Could you confirm whether decimal sampling values are currently unsupported in Responses WebSocket mode, or if this is
a bug/regression?