# `Codex.Realtime.ModelEvents`
[🔗](https://github.com/nshkrdotcom/codex_sdk/blob/v0.18.1/lib/codex/realtime/model_events.ex#L1)

Low-level events from the realtime model transport layer.

These events are emitted by the WebSocket connection and represent
raw model communication. They are typically wrapped in session events
before being exposed to application code.

# `connection_status`

```elixir
@type connection_status() :: :connecting | :connected | :disconnected
```

# `t`

```elixir
@type t() ::
  Codex.Realtime.ModelEvents.ConnectionStatusEvent.t()
  | Codex.Realtime.ModelEvents.ErrorEvent.t()
  | Codex.Realtime.ModelEvents.ToolCallEvent.t()
  | Codex.Realtime.ModelEvents.AudioEvent.t()
  | Codex.Realtime.ModelEvents.AudioDoneEvent.t()
  | Codex.Realtime.ModelEvents.AudioInterruptedEvent.t()
  | Codex.Realtime.ModelEvents.TranscriptDeltaEvent.t()
  | Codex.Realtime.ModelEvents.ItemUpdatedEvent.t()
  | Codex.Realtime.ModelEvents.ItemDeletedEvent.t()
  | Codex.Realtime.ModelEvents.TurnStartedEvent.t()
  | Codex.Realtime.ModelEvents.TurnEndedEvent.t()
  | Codex.Realtime.ModelEvents.InputAudioTranscriptionCompletedEvent.t()
  | Codex.Realtime.ModelEvents.InputAudioTimeoutTriggeredEvent.t()
  | Codex.Realtime.ModelEvents.OtherEvent.t()
  | Codex.Realtime.ModelEvents.ExceptionEvent.t()
  | Codex.Realtime.ModelEvents.RawServerEvent.t()
```

# `audio`

```elixir
@spec audio(keyword()) :: Codex.Realtime.ModelEvents.AudioEvent.t()
```

Create an audio event.

# `audio_done`

```elixir
@spec audio_done(keyword()) :: Codex.Realtime.ModelEvents.AudioDoneEvent.t()
```

Create an audio done event.

# `audio_interrupted`

```elixir
@spec audio_interrupted(keyword()) ::
  Codex.Realtime.ModelEvents.AudioInterruptedEvent.t()
```

Create an audio interrupted event.

# `connection_status`

```elixir
@spec connection_status(connection_status()) ::
  Codex.Realtime.ModelEvents.ConnectionStatusEvent.t()
```

Create a connection status event.

# `error`

```elixir
@spec error(term()) :: Codex.Realtime.ModelEvents.ErrorEvent.t()
```

Create an error event.

# `exception`

```elixir
@spec exception(Exception.t(), String.t() | nil) ::
  Codex.Realtime.ModelEvents.ExceptionEvent.t()
```

Create an exception event.

# `from_json`

```elixir
@spec from_json(map()) :: {:ok, t()} | {:error, term()}
```

Parse model event from JSON.

# `input_audio_transcription_completed`

```elixir
@spec input_audio_transcription_completed(keyword()) ::
  Codex.Realtime.ModelEvents.InputAudioTranscriptionCompletedEvent.t()
```

Create an input audio transcription completed event.

# `item_deleted`

```elixir
@spec item_deleted(String.t()) :: Codex.Realtime.ModelEvents.ItemDeletedEvent.t()
```

Create an item deleted event.

# `item_updated`

```elixir
@spec item_updated(Codex.Realtime.Items.item()) ::
  Codex.Realtime.ModelEvents.ItemUpdatedEvent.t()
```

Create an item updated event.

# `other`

```elixir
@spec other(term()) :: Codex.Realtime.ModelEvents.OtherEvent.t()
```

Create an other event.

# `raw_server_event`

```elixir
@spec raw_server_event(term()) :: Codex.Realtime.ModelEvents.RawServerEvent.t()
```

Create a raw server event.

# `tool_call`

```elixir
@spec tool_call(keyword()) :: Codex.Realtime.ModelEvents.ToolCallEvent.t()
```

Create a tool call event.

# `transcript_delta`

```elixir
@spec transcript_delta(keyword()) ::
  Codex.Realtime.ModelEvents.TranscriptDeltaEvent.t()
```

Create a transcript delta event.

# `turn_ended`

```elixir
@spec turn_ended() :: Codex.Realtime.ModelEvents.TurnEndedEvent.t()
```

Create a turn ended event.

# `turn_started`

```elixir
@spec turn_started() :: Codex.Realtime.ModelEvents.TurnStartedEvent.t()
```

Create a turn started event.

---

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