You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\n\nYou can avoid this error by creating an ephemeral session token:\nhttps://platform.openai.com/docs/api-reference/realtime-sessions\n",
@@ -49,13 +50,24 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
49
50
50
51
client??=newOpenAI({ dangerouslyAllowBrowser });
51
52
53
+
if(hasProvider&&!props?.__resolvedApiKey){
54
+
thrownewError(
55
+
[
56
+
'Cannot open Realtime WebSocket with a function-based apiKey.',
57
+
'Use the .create() method so that the key is resolved before connecting:',
58
+
'await OpenAIRealtimeWebSocket.create(client, { model })',
0 commit comments