OpenAI Live API (wss://api.openai.com/v1/live/sessions, gpt-live-1.1 /
gpt-live-1) wire format: client events sent to OpenAI and the events
server frames decode to. Pure, so it's tested without a socket.
Summary
Functions
Decodes one incoming WebSocket frame into {:ok, [event]} or {:error, reason}.
Builds and validates the session.delegation object from :delegation and
optional agent tools.
Validates idle_timeout_s (nil or an integer in 5..60).
The model name without any openai: prefix.
Validates a PCM sample rate supported by OpenAI Live (16_000 or 24_000).
The session.start frame, the first event sent on a primary WebSocket.
Validates :transport (:webrtc or :websocket).
Builds and validates session.wake_policy (nil/false, :speech,
[type: :speech, vad_threshold: 0.5], or a raw map).
The JSON request body for POST /v1/live/sessions over WebRTC.
Functions
Decodes one incoming WebSocket frame into {:ok, [event]} or {:error, reason}.
Builds and validates the session.delegation object from :delegation and
optional agent tools.
Validates idle_timeout_s (nil or an integer in 5..60).
The model name without any openai: prefix.
Validates a PCM sample rate supported by OpenAI Live (16_000 or 24_000).
The session.start frame, the first event sent on a primary WebSocket.
Options:
:model(needed, e.g."gpt-live-1.1"):voice(default"marin"):sample_rate(16_000or24_000, default24_000):instructions(system prompt):delegation(:client,[type: :client],[model: "...", ...]for Responses delegation, or a raw delegation map):tools(%Octoroom.Agent.Tool{}structs or OpenAI tool maps, merged into Responses delegation when configured):idle_timeout_s(integer in5..60, seconds of inactivity before standby; WebRTC only):wake_policy(:speech,[type: :speech, vad_threshold: 0.5], or a raw wake policy map; WebRTC only):initial_items(list of initial conversation item maps):event_id(optional client event id)
Validates :transport (:webrtc or :websocket).
Builds and validates session.wake_policy (nil/false, :speech,
[type: :speech, vad_threshold: 0.5], or a raw map).
The JSON request body for POST /v1/live/sessions over WebRTC.
Omits audio.format because WebRTC negotiates media format in SDP.