WebSocket Parameters

Configure your real-time streaming connection with these query parameters.

Connection URL

WSwss://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

ParameterTypeDescription
api_keystringYour API key for authentication

Optional Parameters

ParameterTypeDefaultDescription
modelstringlucid-agentModel selection: lucid-mono, lucid-multi, lucid-agent, lucid-lite
interim_resultsbooleantrueReceive partial transcriptions while speaking
endpointinginteger300Silence duration (ms) to detect end of utterance
keywordsstring-Comma-separated keywords to boost recognition
languagestringenISO language code (for lucid-mono)
punctuatebooleantrueAdd punctuation to transcripts
smart_formatbooleantrueFormat numbers, dates, currency

Audio Format Requirements

PropertyRequirement
EncodingLinear16 (PCM), FLAC, or Opus
Sample Rate16000 Hz recommended
Channels1 (mono)
Bit Depth16-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"
}));