Responses WebSocket (/v1/responses) closes with code 1000 and no events when temperature is a decimal (e.g., 1.2)

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?

1 Like

Note: A temperature or top_p of value 1 (or 1.0000) is treated as a default on Responses, essentially dropped. You can send 1.0 even to reasoning models that do not support the parameter explicitly, and 1.0 is echoed as being that default when not sent, because 1 is essentially also meaning “no extra math”.

Thus, the test to confirm your theory (and not just that temperature is broken) is to send a temperature or top_p of 0 - another place you can send integer instead of a float.

Then, try it against gpt-4.1, gpt-4o, etc., and report back. If it’s not just one model, that might communicate the issue better to OpenAI. Also mention whether this is your first experiment with the WebSocket method.

Just confirmed that I also experienced this. Could we get this fixed please?

For now the temporary fix is it simply use temperature = 1 or omit temperature.

1 Like