Member Junction
    Preparing search index...

    Driver class for OpenAI GPT-Live 1 full-duplex realtime models.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    DriverFacts: Readonly<RealtimeDriverFacts> = {}

    GPT-Live's session ceiling is not documented in-repo, so it stays unknown.

    SupportsDynamicToolSet: true

    Whether this driver subclass supports dynamic, multi-tool sets projected into the realtime session (e.g. direct action invocation on realtime co-agents).

    Static capability descriptor read before a session instance exists. Default: absent / false. Subclasses that support dynamic toolsets declare public static readonly SupportsDynamicToolSet = true;.

    Accessors

    • get apiKey(): string

      Only sub-classes can access the API key

      Returns string

    • get CallDurationSeconds(): number

      Readonly getter returning the model driver's connection duration in seconds.

      Returns number

    • get DefaultCallDurationSeconds(): number

      Static driver default for a single connection's duration in seconds (for example, 600 on GeminiRealtime and GeminiEnterpriseRealtime, 3600 on OpenAIRealtime and OpenAILiveRealtime, 7200 on xAIRealtime). Defaults to DriverFacts.ProviderMaxSessionSeconds.

      Returns number

    • get ReconnectBufferSeconds(): number

      Buffer in seconds before CallDurationSeconds at which the framework initiates a proactive reconnect. Defaults to DEFAULT_REALTIME_RECONNECT_BUFFER_SECONDS (10s).

      Returns number

    • get RuntimeCallDurationSeconds(): number

      Dynamic runtime override hook on the model driver (returns undefined unless overridden by a subclass).

      Returns number

    • get SupportedVoices(): RealtimeVoiceOption[]

      Static fallback list of provider-native voices supported by this driver when metadata personas are not present or sparse.

      NOTE: Database metadata (MJ: AI Personas + AI Model Personas) is authoritative where configured. At runtime, GetRealtimeModelVoices unions metadata personas with this driver fallback list so that newly uncatalogued provider voices remain selectable while catalogued personas carry curated names/descriptions.

      Returns RealtimeVoiceOption[]

      The supported voice ids (id + human label), or [] when none are declared.

    • get SupportsClientDirect(): boolean

      Whether this driver can mint an ephemeral, server-scoped client credential for a client-direct realtime session (the browser opens its own provider socket).

      Returns boolean

    • get TrustsNativeResumption(): boolean

      Whether this driver supports and trusts the provider's native session resumption on the active endpoint when a handle is present. Subclasses override as needed (e.g., true on server-side GeminiRealtime, GeminiEnterpriseRealtime, and xAIRealtime; false on OpenAIRealtime).

      Returns boolean

    Methods

    • Returns the smallest candidate that is a positive integer; see ClampSessionSecondsValue. The rule "the caller's bag wins only if smaller" lives there, once: pass the provider cap and the bag cap together.

      Parameters

      • ...candidates: readonly number[]

      Returns number

    • Resolves whether native resumption is trusted for a client-direct session minted by this driver, given the transport ('direct' vs 'relay'). Subclasses override when client-direct trust differs from server-bridged trust (e.g., GeminiRealtime is true on server v1beta keys but false on browser-direct v1alpha ephemeral tokens).

      Parameters

      Returns boolean

    • Exchanges a client WebRTC offer SDP for an answer SDP via OpenAI's POST /v1/live/sessions, using the server's project API key.

      In the OpenAI Live WebRTC topology, the browser never contacts api.openai.com directly; the trusted application server exchanges the offer for an answer and starts the session. Note: creating a WebRTC session pre-bills 15 seconds of voice duration.

      Parameters

      • offerSdp: string

        The local SDP offer generated by the browser.

      • OptionalsessionConfig: Record<string, unknown>

        The session configuration to initialize the session with.

      Returns Promise<{ answerSdp: string; prebillSeconds: number; sessionId: string }>

      The answer SDP, provider session ID, and the 15-second pre-bill accounting.

    • HTTP POST seam for /v1/live/sessions (unit tests override this to mock the HTTP call).

      Parameters

      • payload: unknown

      Returns Promise<{ id: string; transport: { sdp: string; type: string } }>

    • Reconnect hook for server-hosted IRealtimeSession instances created by StartSession. Called by BaseRealtimeSession's duration timer (CallDurationSeconds - ReconnectBufferSeconds) or on unexpected transport close when resumable. Concrete provider drivers override this method.

      Parameters

      Returns Promise<void>

    • Resolves the browser-facing URL of MJAPI's WebRTC SDP broker for one ticket: <MJAPI origin>/realtime/sdp-exchange?ticket=<id>.

      The origin comes from the shared ResolveRealtimeProxyBaseHttpUrl (@memberjunction/ai), so this driver finds MJAPI the way the relay and proxy drivers do: an explicit Config.proxyBaseUrl, else this driver's own Config.brokerBaseUrl, then MJAPI_PUBLIC_URL, then GRAPHQL_BASE_URL + GRAPHQL_PORT. With nothing set that is http://localhost:4000, MJAPI's default port. Only the origin is kept, because MJAPI serves the broker at its root, not under the GraphQL path.

      Parameters

      Returns string

    • Resolves the effective single-connection duration in seconds from an open config bag (connectionMaxSeconds), narrowing this.CallDurationSeconds via ResolveRealtimeTiming.

      Parameters

      • Optionalconfig: Record<string, unknown>

      Returns number

    • Resolves the effective reconnect buffer in seconds from an open config bag (reconnectBufferSeconds), falling back to this.ReconnectBufferSeconds.

      Parameters

      • Optionalconfig: Record<string, unknown>

      Returns number

    • Resolves whether native session resumption is trusted for a session from an open config bag (trustNativeResumption), falling back to defaultTrust (or this.TrustsNativeResumption).

      Parameters

      • Optionalconfig: Record<string, unknown>
      • OptionaldefaultTrust: boolean

      Returns boolean

    • Whether this driver's sessions can render a live avatar for the model, on the endpoint the driver serves.

      Defaults to false: a driver whose models render no avatar says nothing more, and may ignore an avatar request. A driver that renders one for some models (Gemini Enterprise) overrides it. The client-session service reads it to tell a call or a meeting that asked for an avatar "this voice model can't show an avatar" (RealtimeAvatarUnavailableReason 'endpoint'), whichever driver serves it.

      Parameters

      • _model: string

        The provider's API name for the model.

      Returns boolean

      true when sessions on this model can render a live avatar; false otherwise.

    • Compiles the delegation policy block informing GPT-Live about available backend tools in browser-direct / standalone sessions where spoken holding phrases must NOT be used.

      Note: This policy is only appended for standalone / bare-tool sessions that lack co-agent companion framing. On co-agent sessions (where hasToolFraming: true or invoke-target-agent is present), the companion prompt itself defines tool guidance (BuildRealtimeAgentFraming), so this block is omitted to prevent contradictory instructions and holding phrase stalls.

      Parameters

      Returns string