Skip to main content
Trace OpenAI Realtime sessions with Maxim to gain full observability into your real-time voice and text interactions.

Prerequisites

Environment Variables

Initialize Maxim Logger

Wrap OpenAI Realtime Client

Use the wrapOpenAIRealtime function to automatically trace all events in your Realtime session:

Add Custom Session Metadata

You can pass additional metadata to enrich your Realtime sessions with custom names and tags:

Available Metadata Options

The third parameter to wrapOpenAIRealtime accepts the following options:

Basic Usage Example

Here’s a minimal example showing how to set up OpenAI Realtime with Maxim tracing:

Cleanup

Always clean up resources when your session ends:

What Gets Traced

The Maxim wrapper automatically captures:
  • Session lifecycle: Connection, configuration updates, and disconnection
  • Audio events: Input/output audio buffers and transcriptions (if audio modality is enabled)
  • Conversation items: User messages, assistant responses, and function calls
  • Tool calls: Function invocations and their results
  • Errors: Any errors that occur during the session

View traces in the Maxim dashboard

Resources

OpenAI Realtime API

Official OpenAI Realtime documentation

Maxim JS SDK

Maxim TypeScript SDK on npm