Skip to main content

Authentication errors

ErrorCauseFix
HTTP 401Missing or invalid SLNG keyCheck the Authorization: Bearer SLNG_API_KEY header. Verify the key is active in the Dashboard.
WebSocket rejected with 401SLNG key not passed in the handshakePass the key as a header (Authorization: Bearer SLNG_API_KEY) or query parameter (?token=SLNG_API_KEY).
X-Slng-Auth-Source: client_keyBYOK provider key rejected upstreamYour provider key was rejected, not the SLNG key. Check the key with the provider directly.

WebSocket errors

Error codeMeaningWhat to do
auth_errorInvalid or missing SLNG keyCheck your Authorization header.
config_errorInvalid session configurationVerify your init message parameters.
rate_limitToo many concurrent connectionsBack off and retry with exponential delay.
provider_errorUpstream model returned an errorCheck model availability; consider configuring failover models.
backend_connection_failedCould not connect to upstream modelThe model may be temporarily unavailable; retry or use a fallback.

Pronunciation dictionary errors

StatusCodeMeaning
400invalid_pronunciationMalformed object, invalid name, unsupported mode, or dictionary not found
401pronunciation_unauthenticatedMissing or unresolved organization context
409pronunciation_conflictDictionary name already exists in your organization
503pronunciation_unavailablePlatform dependency failure during dictionary resolution
WebSocket pronunciation errors return an error frame:
{
  "type": "error",
  "code": "pronunciation_not_found",
  "message": "Pronunciation dictionary not found: support-pronunciations"
}

Common issues

Connection drops

WebSocket disconnects unexpectedly.
  • Implement reconnection with exponential backoff (1s, 2s, 4s, up to 30s).
  • Send periodic keep-alive messages ({"type": "keepalive"} for STT) to prevent idle timeouts.
  • If behind a corporate proxy, confirm it supports WebSocket upgrades (the Connection: Upgrade header).

Choppy or distorted audio (TTS)

  • Buffer at least 200ms of audio before starting playback.
  • Use the WebAudio API (AudioContext) instead of <audio> elements for gapless chunk playback.
  • Confirm your player’s sample rate matches the sample_rate from your init config.
  • 24kHz linear16 audio requires roughly 384 kbps. Verify your connection can sustain it.

Delayed transcriptions (STT)

  • Send audio in 20-100ms chunks (320-1600 bytes at 16kHz linear16).
  • Confirm encoding and sample_rate in your init config match your actual audio format.
  • For real-time use, prefer Deepgram Nova, which is optimized for streaming latency.

Audio format mismatch

Keep your audio configuration consistent across the pipeline:
{
  "encoding": "linear16",
  "sample_rate": 16000
}
Your audio capture must match: 16-bit samples, 16000 Hz, single channel (mono).

Getting help