> For clean Markdown of any page, append `.md` to the page URL. > For a complete documentation index, see https://docs.sarvam.ai/llms.txt. > For full documentation content in one file, see https://docs.sarvam.ai/llms-full.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server. # Best Practices for Speech-to-Text > Connection handling, VAD tuning, and production recommendations for Sarvam AI's Speech-to-Text API. 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](/api/api-guides-tutorials/speech-to-text/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](/api/api-guides-tutorials/speech-to-text/streaming-api#fine-vad-tuning-parameters) for the full parameter list, defaults, and the values used internally when `high_vad_sensitivity=true`. > **Note** > > 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. > Connection handling, VAD tuning, and production recommendations for Sarvam AI's Speech-to-Text API.