-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Confirm this is a Node library issue and not an underlying OpenAI API issue
- This is an issue with the Node library
Describe the bug
In Azure's Realtime API, you need to specify a user-defined deployment name for session.audio.input.transcription.model, not a model name.
However, in the GA API, the model property's type is fixed to 'whisper-1' | 'gpt-4o-mini-transcribe' | 'gpt-4o-transcribe' | 'gpt-4o-transcribe-diarize', which causes a type error when specifying an arbitrary deployment name.
| model?: 'whisper-1' | 'gpt-4o-mini-transcribe' | 'gpt-4o-transcribe' | 'gpt-4o-transcribe-diarize'; |
In the previous Preview API types, the type for SessionUpdateEvent.Session.InputAudioTranscription["model"] was string, which allowed for custom names.
openai-node/src/resources/beta/realtime/realtime.ts
Lines 2375 to 2379 in d1c87a3
| /** | |
| * The model to use for transcription, current options are `gpt-4o-transcribe`, | |
| * `gpt-4o-mini-transcribe`, and `whisper-1`. | |
| */ | |
| model?: string; |
It might be better to either change the type to string for the GA API as well or add (string & {}) to the union like here:
openai-node/src/resources/realtime/realtime.ts
Lines 3002 to 3005 in d1c87a3
| model?: | |
| | (string & {}) | |
| | 'gpt-realtime' | |
| | 'gpt-realtime-2025-08-28' |
To Reproduce
Code snippets
import { OpenAI } from "openai";
import { OpenAIRealtimeWS } from "openai/realtime/ws";
const apiKey = "my-api-key";
const openAI = new OpenAI({
apiKey,
baseURL: "wss://[my-endpoint].openai.azure.com/openai/v1/realtime?model=[my-gpt-realtime-develoyment-name]",
});
const realtimeClient = new OpenAIRealtimeWS(
{
model: "my-gpt-realtime-develoyment-name",
options: {
headers: { "api-key": apiKey },
},
},
openAI,
);
realtimeClient.send({
type: "session.update",
session: {
type: "realtime",
output_modalities: ["audio"],
audio: {
input: {
transcription: {
// Type '"my-gpt-4o-transcribe-deployment-name"' is not assignable to type '"gpt-4o-mini-transcribe" | "gpt-4o-transcribe" | "gpt-4o-transcribe-latest" | "whisper-1" | undefined'.
model: "my-gpt-4o-transcribe-deployment-name",
},
},
output: {
voice: "cedar",
},
},
},
});OS
Debian 12 (bookworm)
Node version
Node v22.20.0
Library version
openai v6.8.0