OpenAI: GPT Realtime 2.1
OpenAI realtime reasoning model for speech-to-speech conversations with configurable reasoning effort, instruction following and tool use.
Providers
Different providers can host the same model. Choose one provider when you need a fixed backend, or let routing select among them.
Supported languages
No reviewed language list for this model yet.
Features
Bidirectional realtime speech-to-speech over WebSocket or WebRTC.
speech_to_speech
Accepts text input and returns text output alongside audio.
text_input_output
Accepts image input in the conversation.
image_input
Server-side voice activity detection (server_vad) or semantic turn detection (semantic_vad).
turn_taking
Function calling during the conversation.
tool_use
Optional transcription of input audio by a separate transcription model.
input_transcription
Reasoning effort is configurable per session.
reasoning_effort
Code
Realtime speech-to-speech with the OpenAI SDK
Sends question.pcm (24 kHz 16-bit mono PCM) as one turn over the OpenAI Realtime protocol and saves the spoken reply to reply.pcm.
import { once } from "node:events";
import { readFile, writeFile } from "node:fs/promises";
import OpenAI from "openai";
import { OpenAIRealtimeWS } from "openai/realtime/ws";
const client = new OpenAI({
apiKey: process.env.ALLMODELS_API_KEY,
baseURL: "https://api.allmodels.io/oai"
});
const realtime = new OpenAIRealtimeWS({ model: "gpt-realtime-2.1" }, client);
const reply = [];
realtime.on("response.output_audio.delta", ({ delta }) => reply.push(Buffer.from(delta, "base64")));
realtime.on("response.done", async () => {
await writeFile("reply.pcm", Buffer.concat(reply));
realtime.close();
});
realtime.on("error", console.error);
if (realtime.socket.readyState !== 1) await once(realtime.socket, "open");
const format = { type: "audio/pcm", rate: 24000 };
realtime.send({
type: "session.update",
session: {
type: "realtime",
output_modalities: ["audio"],
audio: { input: { format, turn_detection: null }, output: { format, voice: "marin" } }
}
});
realtime.send({ type: "input_audio_buffer.append", audio: (await readFile("question.pcm")).toString("base64") });
realtime.send({ type: "input_audio_buffer.commit" });
realtime.send({ type: "response.create" });
