Realtime Streaming (/v1/realtime)
The /v1/realtime endpoint provides standard full-duplex WebSocket audio streaming for live captions and interactive voice agents.
Connection Endpoint
text
ws://localhost:8000/v1/realtime?api_key=sk-oneasr-v1-xxx&model=xasrAudio Input Format
- Sample Rate: 16,000 Hz (16 kHz)
- Channels: 1 (Mono)
- Encoding: 16-bit Signed Integer PCM Little-Endian (
pcm_s16le) - Chunk Duration: 100ms - 200ms per frame (3,200 bytes per chunk)
Message Protocol
Client ➔ Server:
Stream raw binary PCM audio bytes continuously over the WebSocket connection.
Server ➔ Client (JSON Text):
json
{
"type": "transcription",
"text": "Hello world",
"is_final": false,
"start": 0.0,
"end": 1.2
}When an endpoint sentence boundary is detected:
json
{
"type": "transcription",
"text": "Hello world.",
"is_final": true,
"start": 0.0,
"end": 1.8
}