Member Junction
    Preparing search index...

    OpenAI implementation of the BaseRealtimeModel primitive, backed by OpenAI's Realtime API over a WebSocket (OpenAIRealtimeWebSocket from the openai SDK, v6.18.0).

    The driver opens a duplex session, configures it (system prompt + tools + optional initial context), and translates the provider's server-event stream into the modality-agnostic IRealtimeSession contract.

    This class is also the shared implementation for OpenAI-Realtime-compatible providers. Compatible providers (e.g. xAI Grok Voice) subclass it, pass their base URL to the constructor, and override OpenAIRealtime.Profile — inheriting the whole protocol implementation and every future GA feature (gated per-provider by the profile) instead of maintaining a clone.

    GA features (gpt-realtime-2 / 2.1 era) are driven from the open RealtimeSessionParams.Config bag with MJ-idiomatic keys, translated to provider-native session fields only when the profile confirms support:

    • reasoningEffort: 'minimal'|'low'|'medium'|'high'|'xhigh'reasoning.effort
    • parallelToolCalls: booleanparallel_tool_calls
    • mcpTools: [{ type:'mcp', server_label, server_url|connector_id, ... }] → appended to session.tools

    Tool results complete the tool-call loop: the returned session implements the Core IRealtimeSession.SendToolResult contract method, which the agent layer calls after executing a tool to feed its result back to the model. See OpenAIRealtimeSession.SendToolResult.

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    • get apiKey(): string

      Only sub-classes can access the API key

      Returns string

    • get SupportsClientDirect(): boolean

      OpenAI supports the client-direct topology: the server mints a short-lived ephemeral client secret that the browser uses to open its OWN connection to OpenAI's Realtime API, while the server still controls the system prompt + tools via the returned SessionConfig.

      Returns boolean

    • get SupportsVideo(): boolean

      Whether this driver's sessions carry a video track in addition to audio — i.e. the model accepts video input (it can "see" the user's camera) and/or emits video output (a talking-head avatar / generated video), in sync with audio.

      Defaults to false (audio-only — today's realtime models). Video-capable drivers (a native multimodal realtime model, or an avatar provider) override this to true. The session's media plane is media-tagged (IRealtimeSession.SendInput takes a RealtimeMediaKind; IRealtimeSession.OnVideoOutput delivers video-out), so a video session reuses the entire realtime contract — only the media frames gain a video kind. Resolution prefers a video-capable model when an agent requests video, and degrades to audio-only otherwise.

      Returns boolean

      true if sessions can carry video; false (audio-only) otherwise.

    Methods

    • Mints the ephemeral client secret via the provider's Realtime client-secrets API (resolved from the SDK client's base URL, so OpenAI-compatible subclasses target their own endpoint). Overridable seam for testing — unit tests return a fake response so no network call is made.

      Parameters

      • body: ClientSecretCreateParams

        The client-secret create request (carries the realtime session config).

      Returns Promise<ClientSecretCreateResponse>

      The client-secret create response (token value + expiry + echoed session).