WebSocket Parameters
Configure your real-time streaming connection with these query parameters.
Connection URL
WS
wss://yourvoic.com:8443/api/v1/stt/realtime/stream?api_key=YOUR_KEY&model=lucid-agent
⚠️ Important: WebSocket connections must use port
8443. The standard port (443) does not support WebSocket connections.
Required Parameters
| Parameter | Type | Description |
|---|---|---|
api_key | string | Your API key for authentication |
Optional Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
model | string | lucid-agent | Model selection: lucid-mono, lucid-multi, lucid-agent, lucid-lite |
interim_results | boolean | true | Receive partial transcriptions while speaking |
endpointing | integer | 300 | Silence duration (ms) to detect end of utterance |
keywords | string | - | Comma-separated keywords to boost recognition |
language | string | en | ISO language code (for lucid-mono) |
punctuate | boolean | true | Add punctuation to transcripts |
smart_format | boolean | true | Format numbers, dates, currency |
Audio Format Requirements
| Property | Requirement |
|---|---|
| Encoding | Linear16 (PCM), FLAC, or Opus |
| Sample Rate | 16000 Hz recommended |
| Channels | 1 (mono) |
| Bit Depth | 16-bit |
Connection Example
// Build connection URL with parameters
const params = new URLSearchParams({
api_key: 'YOUR_API_KEY',
model: 'lucid-agent',
interim_results: 'true',
endpointing: '300',
keywords: 'product,company,technical',
smart_format: 'true'
});
const ws = new WebSocket(`wss://yourvoic.com:8443/api/v1/stt/realtime/stream?${params}`);
Message Types
Incoming Messages
// Transcript message
{
"type": "transcript",
"text": "Hello, how are you?",
"is_final": true,
"confidence": 0.95,
"start": 0.0,
"end": 1.5,
"words": [
{"word": "Hello", "start": 0.0, "end": 0.3},
{"word": "how", "start": 0.4, "end": 0.5},
{"word": "are", "start": 0.6, "end": 0.7},
{"word": "you", "start": 0.8, "end": 1.0}
]
}
// Speech started event
{
"type": "speech_started",
"timestamp": 1234567890.123
}
// Speech ended event
{
"type": "speech_ended",
"timestamp": 1234567891.456
}
// Error message
{
"type": "error",
"message": "Insufficient credits",
"code": "INSUFFICIENT_CREDITS"
}
Outgoing Messages
// Send audio data as binary
ws.send(audioChunk); // ArrayBuffer or Blob
// Send control message
ws.send(JSON.stringify({
type: "close"
}));