コンテンツにスキップ

OpenAIRealtimeWebRTCOptions

このコンテンツはまだ日本語訳がありません。

type OpenAIRealtimeWebRTCOptions = object & OpenAIRealtimeBaseOptions;

The options for the OpenAI Realtime WebRTC transport layer.

optional audioElement?: HTMLAudioElement;

The audio element to use for audio playback. If not provided, a new audio element will be created.

optional baseUrl?: string;

Override of the base URL for the Realtime API

optional changePeerConnection?: (peerConnection) => RTCPeerConnection | Promise<RTCPeerConnection>;

Optional hook invoked with the freshly created peer connection. Returning a different connection will override the one created by the transport layer. This is called right before the offer is created and can be asynchronous.

Parameter Type

peerConnection

RTCPeerConnection

RTCPeerConnection | Promise<RTCPeerConnection>

optional mediaStream?: MediaStream;

The media stream to use for audio input. If not provided, the default microphone will be used.

A stream you pass here stays owned by your application. close() will not stop its tracks, so the stream remains usable for a level meter, a recorder, or a later reconnect. Keep a reference to it and call stop() on its tracks once you are actually done with it, otherwise the microphone stays open after the session ends. A microphone the transport opens for you because this option is omitted is still stopped by close().

optional useInsecureApiKey?: boolean;

Important: Do not use this option unless you know what you are doing.

Whether to use an insecure API key. This has to be set if you are trying to use a regular OpenAI API key instead of a client ephemeral key.

https://platform.openai.com/docs/guides/realtime#creating-an-ephemeral-token