gpt-live-1 Guide: Full-Duplex Voice Through the OpenAI Live API

Posted November 20, 2026 by XSI Technical Team ‐ 6Β min read

OpenAI realtime voice waveform and an online assistant interface
Image: OpenAI Realtime API

gpt-live-1 is OpenAI's full-duplex voice model: it listens and speaks at the same time, users can interrupt at any moment, and the model decides when to stop and when to answer; for reasoning, lookups or tool calls it hands the task to a backend model. It fits voice customer service, phone bots, voice assistants, tutoring and guided tours, where people and machines talk back and forth.

On XSI Router, gpt-live-1 is offered through the official OpenAI Live API: endpoints, request bodies and events match the OpenAI documentation; only the address changes to api.xsirouter.com and the key to your XSI key. The upstream is provided by the platform, so sign up and top up to start, with no OpenAI key of your own.

1. Parameters

ParameterValue
Modelgpt-live-1
WebSocketwss://api.xsirouter.com/v1/live/sessions, first frame session.start
WebRTC session creationPOST https://api.xsirouter.com/v1/live/sessions, JSON body with session and transport
Attach to the session (sideband)wss://api.xsirouter.com/v1/live/sessions/{id}/attach
AuthenticationAuthorization: Bearer <your API key>
Main eventssession.started, session.input_transcript.delta, session.output_transcript.delta, session.output_audio.delta, session.usage.updated, session.closed

General rules:

  • Keep the API key on your server. Never put it in a browser or an app. Browsers use WebRTC, with your backend creating the session.
  • gpt-live-1 supports the Live API only. /v1/chat/completions, /v1/responses and the Realtime API cannot call it.
  • HTTP 201 only means the session was created. Full success means the session starts, the user's speech is transcribed, and you can hear the model's reply.

2. How to call it

Session configuration

FieldDescription
modelRequired, gpt-live-1; cannot be changed after start
instructionsConversation instructions
audio.output.voiceVoice, default marin
audio.formatWebSocket only, for example {"type": "audio/pcm", "rate": 24000}; WebRTC negotiates it in SDP, so do not set it
delegationOptional, client or responses, hands reasoning and tool calls to a backend

WebSocket audio is Base64-encoded PCM: 24 kHz mono 16-bit little-endian by default, without a WAV header. 16 kHz PCM and 8 kHz G.711 ΞΌ-law (audio/pcmu) and A-law (audio/pcma) are also supported.

WebSocket example (Python)

Good for servers, telephone gateways and testing. Use Python 3.9 or later and install the dependency:

pip install websockets

The script reads a 24 kHz, mono, 16-bit WAV file as the user's speech, prints both transcripts, and saves the model's spoken reply as reply.wav:

import asyncio, base64, json, os, wave
import websockets

URL = "wss://api.xsirouter.com/v1/live/sessions"
KEY = os.environ["XSI_API_KEY"]
CHUNK = 4800  # 0.1 s at 24 kHz / 16-bit


async def main(path="question_24k.wav"):
    pcm = wave.open(path).readframes(10**9)
    reply, heard, said = bytearray(), [], []
    started = asyncio.Event()
    async with websockets.connect(
        URL, additional_headers={"Authorization": f"Bearer {KEY}"}
    ) as ws:
        await ws.send(json.dumps({
            "type": "session.start",
            "session": {
                "model": "gpt-live-1",
                "instructions": "You are a concise, friendly voice assistant. Answer in one sentence.",
                "audio": {
                    "format": {"type": "audio/pcm", "rate": 24000},
                    "output": {"voice": "marin"},
                },
            },
        }))

        async def reader():
            async for raw in ws:
                event = json.loads(raw)
                kind = event["type"]
                if kind == "session.started":
                    started.set()
                elif kind == "session.output_audio.delta":
                    reply.extend(base64.b64decode(event["delta"]))
                elif kind == "session.input_transcript.delta":
                    heard.append(event["delta"])
                elif kind == "session.output_transcript.delta":
                    said.append(event["delta"])
                elif kind == "error":
                    print("error:", raw)
                elif kind == "session.closed":
                    print("session closed:", event.get("reason"))
                    return

        task = asyncio.create_task(reader())
        await asyncio.wait_for(started.wait(), 15)
        silence = b"\x00" * CHUNK
        chunks = [pcm[i:i + CHUNK] for i in range(0, len(pcm), CHUNK)]
        # Stream at real-time pace: the question, then 8 s of silence for the answer
        for chunk in chunks + [silence] * 80:
            await ws.send(json.dumps({
                "type": "session.input_audio.append",
                "audio": base64.b64encode(chunk).decode(),
            }))
            await asyncio.sleep(0.1)
        await ws.send(json.dumps({"type": "session.close"}))
        await asyncio.wait_for(task, 15)

    print("user:", "".join(heard))
    print("assistant:", "".join(said))
    with wave.open("reply.wav", "wb") as out:
        out.setnchannels(1)
        out.setsampwidth(2)
        out.setframerate(24000)
        out.writeframes(bytes(reply))


asyncio.run(main())

Run it:

XSI_API_KEY=your_api_key python3 live_ws.py

Key points:

  • The first message after connecting must be session.start. Send audio only after session.started arrives.
  • Stream audio at roughly real-time pace. A full-duplex model listens over time, so pushing a whole recording at once gives unpredictable results.
  • To finish, send session.close and wait for session.closed before disconnecting, so you receive the final usage.

WebRTC example (browser + Node.js backend)

For web pages and apps. The browser creates an SDP offer and passes it to your backend; the backend calls POST /v1/live/sessions with the key and returns the answer SDP to the browser. Audio flows over WebRTC media tracks and events over the oai-events data channel.

Backend server.mjs (Node.js 22+, npm install express@5):

import express from "express";

const app = express();
app.use(express.text({ type: "application/sdp", limit: "1mb" }));
app.use(express.static("public"));

app.post("/session", async (req, res) => {
  // In production, check the user's login, rate limits and Origin here
  const upstream = await fetch("https://api.xsirouter.com/v1/live/sessions", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.XSI_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      session: {
        model: "gpt-live-1",
        instructions: "You are a concise, friendly voice assistant.",
        audio: { output: { voice: "marin" } },
      },
      transport: { type: "webrtc", sdp: req.body },
    }),
  });
  const data = await upstream.json();
  if (!upstream.ok) return res.status(upstream.status).json(data);
  res.json({ sessionId: data.session.id, sdp: data.transport.sdp });
});

app.listen(3000, "127.0.0.1", () => console.log("Open http://localhost:3000"));

Script for public/index.html (needs HTTPS or localhost and a user click):

async function startCall() {
  const pc = new RTCPeerConnection();
  const player = new Audio();
  player.autoplay = true;
  pc.ontrack = (event) => { player.srcObject = event.streams[0]; };

  const mic = await navigator.mediaDevices.getUserMedia({ audio: true });
  mic.getTracks().forEach((track) => pc.addTrack(track, mic));

  // Create the data channel before createOffer
  const events = pc.createDataChannel("oai-events");
  events.onmessage = ({ data }) => {
    const event = JSON.parse(data);
    if (event.type === "session.input_transcript.delta") console.log("me:", event.delta);
    if (event.type === "session.output_transcript.delta") console.log("assistant:", event.delta);
    if (event.type === "session.closed") {
      pc.close();
      mic.getTracks().forEach((track) => track.stop());
    }
  };

  await pc.setLocalDescription(await pc.createOffer());
  await new Promise((resolve) => {
    if (pc.iceGatheringState === "complete") return resolve();
    pc.addEventListener("icegatheringstatechange", () => {
      if (pc.iceGatheringState === "complete") resolve();
    });
    setTimeout(resolve, 3000);
  });

  const response = await fetch("/session", {
    method: "POST",
    headers: { "Content-Type": "application/sdp" },
    body: pc.localDescription.sdp,
  });
  const { sdp } = await response.json();
  await pc.setRemoteDescription({ type: "answer", sdp });

  // Hang up: send session.close, then release the connection and microphone on session.closed
  return () => events.send(JSON.stringify({ type: "session.close" }));
}

With WebRTC, do not send session.start or session.input_audio.append on the data channel: the HTTP request itself starts the session, and all audio goes over the media tracks.

Verification

On November 20, 2026 we verified both WebSocket and WebRTC through api.xsirouter.com with a synthesized English question:

WebSocketWebRTC
Sessionsession.started receivedHTTP 201, WebRTC connected, session.started on the data channel
User transcriptQuestion recognized correctlyQuestion recognized correctly
Model replyTranscript and audio output normalTranscript and remote audio track normal
Endsession.closed, reason close_requestedSame

The WebSocket check used the Python script above; the WebRTC check used a Python aiortc client, and the Node.js and browser code above follow the same flow, so please verify it in your own browser before deploying. Delegation, Chinese speech and interruptions were outside this check.

3. Common errors

ErrorCauseFix
HTTP 401Invalid key, or the key does not belong to this API siteCheck the Authorization header and the key
400 Public Live sessions require gpt-live-1session.model is not gpt-live-1Set the model to gpt-live-1
400 Live sessions do not accept query parameters; put the model in session.startThe WebSocket URL has query parametersRemove them and put the model in session.start
400 Live requires transport.type=webrtc and transport.sdpThe WebRTC body has no transportSend transport.type and the browser's transport.sdp as in the example
Insufficient balance or quotaNot topped up, or the quota is used upTop up in the console

See Errors for more status codes and WebSocket and Realtime APIs for the API rules.

4. Billing

  • Billed by session duration: a WebRTC session counts 15 seconds from successful creation and is then deducted by accumulated duration; WebSocket is billed by the seconds the upstream reports.
  • Tokens and tool fees of delegated backend models are billed separately.
  • See the models page for the price.

5. Get started

  1. Sign up with your email at manage.xsirouter.com and activate the account; the page shows your API key.
  2. Top up in the console.
  3. Replace XSI_API_KEY in the examples with your key, run the WebSocket script once for a voice round trip, then integrate it into your own app.

The upstream OpenAI key is provided by the platform, so you do not need an OpenAI project or Live access of your own. For enterprise integration and private deployment, see Enterprise.

References