---
title: "Realtime audio"
description: "Connect to a supported Realtime model over an authenticated WebSocket."
lastUpdated: 2026-10-22
---

Realtime audio uses a WebSocket connection for low-latency audio input and output. Confirm that your key and group have access to a Realtime model before connecting.

Use `wss://infistar.ai/v1/realtime?model=MODEL_ID` internationally or `wss://infistar.cc/v1/realtime?model=MODEL_ID` in mainland China. Replace `MODEL_ID` with the exact available model ID.

```javascript
import WebSocket from 'ws';

const socket = new WebSocket(
  'wss://infistar.ai/v1/realtime?model=MODEL_ID',
  { headers: { Authorization: `Bearer ${process.env.INFISTAR_API_KEY}` } },
);
socket.on('open', () => {
  socket.send(JSON.stringify({
    type: 'session.update',
    session: { modalities: ['text', 'audio'] },
  }));
});
socket.on('message', message => console.log(JSON.parse(message.toString())));
```

This Node.js example uses `ws` to set the authorization header. A browser's native WebSocket constructor cannot directly set that header. Browser applications should authenticate and relay through their own server; do not expose the key in frontend code or an application package.

For 401, check the key and Bearer header. For an unavailable model, recheck the group and model list. For connection failures, check `wss://` and ensure `/v1` appears only once.
