Skip to content

Type error on session.audio.input.transcription.model with custom development name on Azure's Realtime API #1698

@heguro

Description

@heguro

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.

/**
* 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:

model?:
| (string & {})
| 'gpt-realtime'
| 'gpt-realtime-2025-08-28'

To Reproduce

TS Playground

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions