allmodels.ioDocs
API ReferenceOpenAI SDK

OpenAI SDK-compatible realtime transcription and speech-to-speech

GET/oai/realtime

One OpenAI Realtime WebSocket for two uses. Set the OpenAI SDK base URL to https://api.allmodels.io/oai and authenticate with your AllModels API key.

  • Speech-to-speech: omit intent and set model to a speech-to-speech model (gpt-realtime-2.1, gpt-realtime-2.1-mini, gpt-realtime-2, grok-voice-latest, grok-voice-3.0, grok-voice-2.0, grok-voice-think-fast-2.0, eleven_realtime_v1_mini or eleven_realtime_v1_max, each with an optional openai/, grok/ or elevenlabs/ prefix). The provider's own Realtime events pass through unchanged in both directions, except that an ElevenLabs session stays on the model in the URL: a session.model in session.update is replaced with it. OpenAI models bill on tokens, Grok Voice models on session seconds plus text items, ElevenLabs Realtime models on session seconds (prices on the models page). On an OpenAI model, input transcription (session.audio.input.transcription.model) is billed separately as speech-to-text at that transcription model's price. A transcription model without a price is answered with an error event (model_not_priced, param: session.audio.input.transcription.model) and the session.update is not applied; the session stays open. Live models (gpt-live-1, gemini-3.8-live) are refused 400 invalid_model; connect to /oai/live/sessions instead. Walkthrough: Speech to speech.
  • Transcription: set intent=transcription or a transcription model; the rest of this description covers it.

Transcription streams input audio and receives OpenAI realtime transcription events; 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, and it always selects transcription. Omit it for speech-to-speech.

Value in

  • "transcription"
model*string

A speech-to-speech model (see above; selects speech-to-speech when intent is omitted) or a realtime transcription model, preferably using {author}/{modelName}. Required — a missing value is refused 400 missing_required_parameter; the router applies no default model.

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"  }}