# `Octoroom.Agent.OpenAILive.Protocol`
[🔗](https://github.com/samrat/octoroom/blob/v0.1.0/agents/lib/octoroom/agent/open_ai_live/protocol.ex#L1)

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.

# `audio_input_frame`

# `commentary_append_frame`

# `decode_frame`

Decodes one incoming WebSocket frame into `{:ok, [event]}` or `{:error, reason}`.

# `default_sample_rate`

# `default_transport`

# `default_voice`

# `delegation`

Builds and validates the `session.delegation` object from `:delegation` and
optional agent `tools`.

# `idle_timeout_s`

Validates `idle_timeout_s` (`nil` or an integer in `5..60`).

# `input_audio_mute_frame`

# `input_audio_unmute_frame`

# `instructions_append_frame`

# `model_name`

The model name without any `openai:` prefix.

# `response_create_frame`

# `sample_rate`

Validates a PCM sample rate supported by OpenAI Live (`16_000` or `24_000`).

# `session_close_frame`

# `session_start_frame`

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_000` or `24_000`, default `24_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 in `5..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)

# `session_update_frame`

# `supported_sample_rates`

# `thinking_append_frame`

# `tool_output_frame`

# `transport`

Validates `:transport` (`:webrtc` or `:websocket`).

# `wake_policy`

Builds and validates `session.wake_policy` (`nil`/`false`, `:speech`,
`[type: :speech, vad_threshold: 0.5]`, or a raw map).

# `webrtc_session_request`

The JSON request body for `POST /v1/live/sessions` over WebRTC.

Omits `audio.format` because WebRTC negotiates media format in SDP.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
