ExperimentalExperimental
Immediately opens a model or transcription session, or attaches to an existing call.
Pass an existing OpenAI client as the second argument to reuse its endpoint and static credentials. Clients with function-based credentials must use OpenAIRealtimeWS.create; Azure clients should use OpenAIRealtimeWS.azure.
Exactly one model, transcription intent, or call ID, plus ws client settings.
Optional Internal__apiKey?: string | nullCredential captured by an async factory for this connection.
Optional Internal__resolvedApiKey?: booleanIndicates that a function-based credential was resolved by an async factory.
Optionaloptions?: ClientOptionsOptions passed directly to the underlying ws.WebSocket constructor.
Optionalclient: Pick<OpenAI, "apiKey" | "baseURL">
Existing client whose endpoint and API key should be reused.
ExperimentalsocketUnderlying ws.WebSocket instance for connection lifecycle and transport events.
ExperimentalurlSecure Realtime WebSocket URL with its model, transcription intent, or call ID.
Static Readonly ExperimentalazureOpens an Azure deployment or transcription session, or an existing sideband call.
Static Azure API keys are sent in the api-key header; function-based
credentials are resolved first and sent as bearer credentials. The client's
configured deployment is used unless a deployment, transcription intent, or call ID is supplied.
Static Readonly ExperimentalcreateResolves a client's current API credential before opening a Realtime connection.
Use this factory instead of the constructor when the client's apiKey is a function.
Protected_Experimental
Protected_Experimental
Protected_Experimental
Experimental
Optionalmessage: stringExperimental
Closes the WebSocket with status code 1000 and reason OK by default.
Connection-closing failures are delivered to the SDK error event.
Optionalprops: { code: number; reason: string }
WebSocket close status code; defaults to 1000.
WebSocket close reason; defaults to OK.
Experimental
This is similar to .once(), but returns a Promise that resolves the next time
the event is triggered, instead of calling a listener callback.
Events without arguments resolve to undefined, single-argument events resolve
to that argument, and events with multiple arguments resolve to an argument tuple.
A promise for the next event, or a rejection if an error occurs first.
Requesting the error event resolves with the emitted error instead.
Example:
const message = await stream.emitted('message') // rejects if the stream errors
Experimental
Removes the specified listener from the listener array for the event. off() will remove, at most, one instance of a listener from the listener array. If any single listener has been added multiple times to the listener array for the specified event, then off() must be called multiple times to remove each instance.
this, so that calls can be chained
Experimental
Adds the listener function to the end of the listeners array for the event. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of event and listener will result in the listener being added, and called, multiple times.
this, so that calls can be chained
Experimental
Adds a one-time listener function for the event. The next time the event is triggered, this listener is removed and then invoked.
this, so that calls can be chained
Experimental
Serializes and sends a Realtime client event after the WebSocket has opened.
Serialization and transport failures are delivered to the SDK error event.
StaticcreateExperimental
Creates a pre-configured SapOpenAiRealtimeWs client and opens the WebSocket connection to SAP AI Core. Resolves the deployment, fetches a bearer token, and sets the SAP-specific headers automatically.
Options including model deployment, destination, and client type. A plain model name string is accepted as shorthand for { deployment: modelName }.
A promise that resolves to a connected SapOpenAiRealtimeWs instance.
A pre-configured OpenAI Realtime API (speech-to-speech) client for SAP AI Core.
Only
gpt-realtimeis supported. Session configuration must use the GAsession.updateschema (output_modalities, nestedaudio), not the preview schema.Use SapOpenAiRealtimeWs.createClient to create an instance. This class is experimental and may change at any time without prior notice.