allmodels.ioDocs
API ReferenceOpenAI SDK

OpenAI SDK-compatible GPT-Live speech-to-speech

GET/oai/live/sessions

Holds a speech-to-speech conversation over the OpenAI GPT-Live protocol; gpt-live-1 and gemini-3.8-live share its frames. Set the OpenAI SDK base URL to https://api.allmodels.io/oai and authenticate with your AllModels API key.

  • First frame: session.start, a text frame of at most 64 KB sent within 15 seconds.
  • Model: session.model: gpt-live-1 (optional openai/ prefix) or gemini-3.8-live (optional gemini/ prefix).
  • Delegation: client only (delegation absent or {"type":"client"}, store absent or false).
  • Audio: audio/pcm at 24000 (default) or 16000, or audio/pcmu / audio/pcma at 8000, both directions.
  • Voices: set session.audio.output.voice in session.start. gpt-live-1 takes the GPT-Live voices (default marin); gemini-3.8-live takes Gemini's prebuilt voices by name, for example {"audio": {"output": {"voice": "Kore"}}} (default Zephyr).
  • Ending: send session.close, then wait for session.closed.
  • Billing: gpt-live-1 on session seconds; gemini-3.8-live on tokens. See the models page for prices.

Walkthrough and Gemini differences: Speech to speech. Frames and close codes: the realtime WebSocket reference.

Authorization

BearerAuth
AuthorizationBearer <token>

Tenant key supplied as the Authorization Bearer token.

In: header

Header Parameters

Upgrade*string

Must be websocket to perform the protocol upgrade.

Response Body

application/json

application/json

Client
Language
import { readFile, writeFile } from "node:fs/promises";import { setTimeout as sleep } from "node:timers/promises";import OpenAI from "openai";import { LiveWS } from "openai/resources/live/ws";const client = new OpenAI({  apiKey: process.env.ALLMODELS_API_KEY,  baseURL: "https://api.allmodels.io/oai"});const live = new LiveWS(client);const reply = [];let quiet;live.on("session.output_audio.delta", ({ delta }) => reply.push(Buffer.from(delta, "base64")));live.on("session.output_transcript.delta", () => {  // End the session two seconds after the reply's transcript goes quiet.  clearTimeout(quiet);  quiet = setTimeout(() => live.send({ type: "session.close" }), 2000);});live.on("session.closed", async () => {  await writeFile("reply.pcm", Buffer.concat(reply));  live.close();});live.on("error", console.error);live.send({  type: "session.start",  session: {    model: "gpt-live-1", // or "gemini-3.8-live"    audio: { format: { type: "audio/pcm", rate: 24000 }, output: { voice: "marin" } },    delegation: { type: "client" }  }});// Stream 100 ms frames in real time, then two seconds of silence.const audio = Buffer.concat([await readFile("question.pcm"), Buffer.alloc(2 * 24000 * 2)]);for (let offset = 0; offset < audio.length; offset += 4800) {  live.send({ type: "session.input_audio.append", audio: audio.subarray(offset, offset + 4800).toString("base64") });  await sleep(100);}
Empty
{  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}
{  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}