From cba118579208471bf4a9597e262f7e386f81401e Mon Sep 17 00:00:00 2001 From: yakigac <10434946+yakigac@users.noreply.github.com> Date: Sun, 6 Oct 2024 19:24:34 +0900 Subject: [PATCH 1/2] Use it with Azure OpenAI --- lib/api.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/api.js b/lib/api.js index e522263..718ee4e 100644 --- a/lib/api.js +++ b/lib/api.js @@ -113,13 +113,14 @@ export class RealtimeAPI extends RealtimeEventHandler { const wsModule = await import(/* webpackIgnore: true */ moduleName); const WebSocket = wsModule.default; const ws = new WebSocket( - 'wss://api.openai.com/v1/realtime?model=gpt-4o-realtime-preview-2024-10-01', + `${this.url}`, [], { finishRequest: (request) => { // Auth request.setHeader('Authorization', `Bearer ${this.apiKey}`); request.setHeader('OpenAI-Beta', 'realtime=v1'); + request.setHeader("api-key", this.apiKey); request.end(); }, }, From 4249b7d759d8ae8b5aa66b6f727301d87cee30d6 Mon Sep 17 00:00:00 2001 From: yakigac <10434946+yakigac@users.noreply.github.com> Date: Mon, 4 Nov 2024 15:14:30 +0900 Subject: [PATCH 2/2] Update lib/api.js Co-authored-by: Sunil Pai --- lib/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/api.js b/lib/api.js index 718ee4e..6eb1aab 100644 --- a/lib/api.js +++ b/lib/api.js @@ -113,7 +113,7 @@ export class RealtimeAPI extends RealtimeEventHandler { const wsModule = await import(/* webpackIgnore: true */ moduleName); const WebSocket = wsModule.default; const ws = new WebSocket( - `${this.url}`, + `${this.url}${model ? `?model=${model}` : ''}`, [], { finishRequest: (request) => {