Best Practices for Speech-to-Text
Best Practices for Speech-to-Text
A guide to running Speech-to-Text reliably in production, covering WebSocket connection handling and voice activity detection (VAD) tuning.
1. WebSocket Connection Management
Production integrations using the streaming API should handle connection lifecycle explicitly:
- Idle timeout: The WebSocket closes automatically after 60 seconds of inactivity.
- Keep-alive: Send silent (near-zero amplitude) audio chunks periodically, well under the 60 second window, to keep long-running connections open.
2. Voice Activity Detection (VAD) Tuning
For most use cases, the high_vad_sensitivity preset is enough to get faster, more responsive end-of-speech detection. For finer control, the streaming endpoint also exposes individual VAD parameters (positive_speech_threshold, negative_speech_threshold, min_speech_frames, and others).
See the Fine VAD Tuning Parameters reference for the full parameter list, defaults, and the values used internally when high_vad_sensitivity=true.
Start with high_vad_sensitivity=true before reaching for individual VAD
parameters. Only override specific parameters if the preset doesn’t fit your
use case.
3. Log Request IDs
Log and store the request_id returned with every response. Support and debugging requests are resolved fastest when you can supply the request_id for the affected call.