allmodels.ioDocs
API ReferenceOpenAI SDK

OpenAI SDK-compatible realtime transcription

Streams input audio and receives OpenAI realtime transcription events. Set `intent=transcription`; use `/oai/audio/speech` to stream generated speech. Node and Python clients use Bearer authentication. Browser clients can pass `realtime` and `openai-insecure-api-key.<allmodels-key>` as WebSocket subprotocols. Send OpenAI's nested `session.update` before audio. `turn_detection: null`, `server_vad`, and `semantic_vad` translate to portable manual, acoustic, and semantic intent for the selected provider. Unsupported configurations arrive as official OpenAI `error` events. Query-level `provider_options[...]` remains the native override extension. The message-level protocol is documented at [the realtime WebSocket reference](/realtime-reference) (AsyncAPI spec: [/asyncapi.yaml](/asyncapi.yaml)).

GET/oai/realtime

Streams input audio and receives OpenAI realtime transcription events. Set intent=transcription; use /oai/audio/speech to stream generated speech. Node and Python clients use Bearer authentication. Browser clients can pass realtime and openai-insecure-api-key.<allmodels-key> as WebSocket subprotocols. Send OpenAI's nested session.update before audio. turn_detection: null, server_vad, and semantic_vad translate to portable manual, acoustic, and semantic intent for the selected provider. Unsupported configurations arrive as official OpenAI error events. Query-level provider_options[...] remains the native override extension.

The message-level protocol is documented at the realtime WebSocket reference (AsyncAPI spec: /asyncapi.yaml).

Authorization

BearerAuth
AuthorizationBearer <token>

Tenant key supplied as the Authorization Bearer token.

In: header

Query Parameters

intent?"transcription"

Realtime mode. Only transcription is supported.

Value in

  • "transcription"
model?string

Realtime transcription model, preferably using {author}/{modelName}.

provider_order?array<string>

Comma-separated or repeated provider IDs in preferred order. Providers not listed remain eligible.

provider_only?array<string>

Comma-separated or repeated provider IDs. Only these providers may serve the request.

provider_ignore?array<string>

Comma-separated or repeated provider IDs that must not serve the request.

allow_fallbacks?boolean

Set to false to prevent fallback to another provider. Automatic provider retries are not currently supported.

provider_options?||||||||

Provider-specific options in bracket notation, such as provider_options[encoding]=linear16. Provider-native names are accepted only inside this namespace; unknown bare query parameters are rejected.

Header Parameters

Upgrade*string

Must be websocket to perform the protocol upgrade.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

Client
Language
import { once } from "node:events";import { readFile } from "node:fs/promises";import OpenAI from "openai";import { OpenAIRealtimeWebSocket } from "openai/realtime/websocket";const client = new OpenAI({  apiKey: process.env.ALLMODELS_API_KEY,  baseURL: "https://api.allmodels.io/oai"});const realtime = await OpenAIRealtimeWebSocket.create(client, {  model: "openai/gpt-realtime-whisper"});realtime.on("conversation.item.input_audio_transcription.delta", ({ delta }) => console.log(delta));realtime.on("conversation.item.input_audio_transcription.completed", ({ transcript }) => {  console.log(transcript);  realtime.close({ code: 1000, reason: "complete" });});if (realtime.socket.readyState !== 1) await once(realtime.socket, "open");realtime.send({ type: "session.update", session: {  type: "transcription",  audio: { input: { format: { type: "audio/pcm", rate: 24000 }, transcription: { model: "openai/gpt-realtime-whisper", language: "en" }, turn_detection: null } }}});realtime.send({ type: "input_audio_buffer.append", audio: (await readFile("chunk.pcm")).toString("base64") });realtime.send({ type: "input_audio_buffer.commit" });
Empty
{  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}
{  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}
{  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}
{  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}
{  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}
{  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}
{  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}