GPT Live

Connect to GPT Live real-time multimodal & voice API via WebSocket

AIRouter24 adaptation

native

Connect using AIRouter24's WebSocket endpoint wss://api.airouter24.com/v1/live/sessions and a standard API key.

What is GPT Live?

GPT Live (gpt-live-1) is a real-time, low-latency multimodal voice and text model. Over a persistent WebSocket connection, client applications can stream audio and text events bidirectionally and receive instantaneous model speech and structured event streams.

Quickstart

Step 1: Get Your API Key

  1. Sign up or log in at AIRouter24
  2. Go to API Keys and create a key (starts with sk-***)
  3. Set your environment variable:
    export AIROUTER24_API_KEY="sk-***"

Step 2: Install WebSocket Dependencies

npm install ws

Step 3: Connect and Initialize Session

import WebSocket from 'ws';

const apiKey = process.env.AIROUTER24_API_KEY || 'sk-***';

const ws = new WebSocket('wss://api.airouter24.com/v1/live/sessions', {
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
});

ws.on('open', () => {
  console.log('Connected to AIRouter24 Live Gateway');

  // Send session.start to initialize the live session
  ws.send(
    JSON.stringify({
      type: 'session.start',
      event_id: 'event_start',
      session: {
        model: 'gpt-live-1',
        instructions: 'Be concise and ask before taking an external action.',
        audio: { output: { voice: 'marin' } },
        delegation: { type: 'client' },
      },
    }),
  );
});

ws.on('message', (data) => {
  const event = JSON.parse(data.toString());
  console.log('Received event:', event.type, event);
});

ws.on('error', (err) => {
  console.error('WebSocket error:', err);
});

ws.on('close', (code, reason) => {
  console.log(`Connection closed: ${code} - ${reason.toString()}`);
});

Endpoint & Configuration Reference

ParameterDescriptionExample Value
WebSocket URLAIRouter24 Live session endpointwss://api.airouter24.com/v1/live/sessions
AuthorizationBearer token authorization headerBearer sk-***
Model (model)Model identifiergpt-live-1
Voice (voice)Audio output voicemarin, alloy, echo, shimmer, etc.
RateReal-time session billing rate$0.05 / minute

Troubleshooting

  • 401 Unauthorized: Ensure the Authorization header has the form Bearer sk-*** and that your API key is active with sufficient credits.
  • Connection Closed / Timeout: Keep the session active with heartbeat messages or cleanly close connections when idle.
  • Usage & Billing: Real-time session token and duration metrics appear immediately in the AIRouter24 Activity Dashboard.