when using `deepgram.STT(model="nova-3", language=...
# ask-ai
f
when using
deepgram.STT(model="nova-3", language="en-US")
indicating base_url (even default), this error occurs: aiohttp.client_exceptions.WSServerHandshakeError: 404, message='Invalid response status',
t
Thanks for reaching out, Taras. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I’d love to help you out! Could you please share the specific base_url you’re using? Also, are you connecting to a custom Deepgram deployment or maybe a different service? Knowing this will help me guide you better. Sources: livekit-plugins/livekit-plugins-cartesia/livekit/plugins/cartesia/stt.py
The error you're seeing indicates that the WebSocket handshake is failing with a 404 status, which usually means the endpoint isn’t being recognized. Let’s go through some steps together to help troubleshoot and hopefully resolve this issue: 1. Verify Your Custom Endpoint Structure: First, please make sure your custom deployment supports the same structure as Deepgram's API. You can test this with these commands:
Copy code
curl -I https://gc-dh-deepgram-dev.drivehealth.ai/v1/listen
Copy code
wscat -c "wss://gc-dh-deepgram-dev.drivehealth.ai/v1/listen?model=nova-3&sample_rate=16000&encoding=linear16" -H "Authorization: Token YOUR_API_KEY"
2. Check API Version Compatibility: Sometimes deployments use different API versions. It’s worth trying both approaches to see which works best:
Copy code
# STT v1 with HTTP base URL
stt_v1 = deepgram.STT(
    base_url="https://gc-dh-deepgram-dev.drivehealth.ai/v1/listen",
    api_key="your-api-key"
)

# STT v2 with WebSocket base URL
from livekit.plugins.deepgram import STTv2
stt_v2 = STTv2(
    base_url="wss://gc-dh-deepgram-dev.drivehealth.ai/v2/listen",
    api_key="your-api-key"
)
3. Test with Minimal Configuration: To isolate the issue, try starting with a minimal setup like this:
Copy code
stt = deepgram.STT(
    base_url="https://gc-dh-deepgram-dev.drivehealth.ai/v1/listen",
    api_key="your-api-key",
    model="nova-3",
    sample_rate=16000,
    interim_results=True
)
4. Enable Debug Logging: Adding logging can help us see exactly what WebSocket URL is being generated. Here’s how you can do that:
Copy code
import logging
logging.basicConfig(level=logging.DEBUG)

stt = deepgram.STT(
    base_url="https://gc-dh-deepgram-dev.drivehealth.ai/v1/listen",
    api_key="your-api-key"
)
5. Verify Query Parameters Support: Make sure your custom deployment supports query parameters like model, sample_rate, and encoding. If you’re still running into issues, it would be really helpful if you could confirm a few things for me: • Is this a self-hosted Deepgram deployment, an enterprise cloud deployment, or a custom proxy? • Can you successfully connect to
wss://gc-dh-deepgram-dev.drivehealth.ai/v1/listen
using a WebSocket client? • Are there any additional error messages in your logs besides the 404? • Does your deployment use
/v1/listen
or perhaps a different path like
/v2/listen
? I’m here to help, so please don’t hesitate to share any more details or questions you have! Sources: examples/voice_agents/error_callback.py