i need some help regarding my stt error
# ask-ai
c
i need some help regarding my stt error
t
Thanks for reaching out, Subham. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I can help with your STT error. To diagnose it quickly, could you share the following: • The exact error message or screenshot. • Which STT provider you’re using (e.g., Google Cloud, Deepgram, AssemblyAI, or another). • When it happens (during setup, when starting transcription, mid-call, on upload, etc.). • Any relevant logs or code snippets (request/response payloads, SDK calls, or console errors). • The environment (browser or server, OS, SDK version). Once you send those details I’ll suggest targeted troubleshooting steps. Sources: Live Conversations with AI using ChatGPT and WebRTC
c
Copy code
2025-12-29 14:27:17,481 - DEBUG livekit.agents - using transcript io: `AgentSession` -> `TranscriptSynchronizer` -> `RoomIO` {"room": "playground-vMlg-a4p6", "pid": 90954, "job_id": "AJ_chXNWxXLrenp"}
2025-12-29 14:27:18,263 - ERROR livekit.agents - AgentSession is closing due to unrecoverable error
Traceback (most recent call last):
  File "/Users/subhamdas/self-nm/agent-starter-python/.venv/lib/python3.12/site-packages/livekit/agents/stt/stt.py", line 289, in _main_task
    return await self._run()
           ^^^^^^^^^^^^^^^^^
  File "/Users/subhamdas/self-nm/agent-starter-python/.venv/lib/python3.12/site-packages/livekit/plugins/deepgram/stt.py", line 517, in _run
    ws = await self._connect_ws()
         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/subhamdas/self-nm/agent-starter-python/.venv/lib/python3.12/site-packages/livekit/plugins/deepgram/stt.py", line 581, in _connect_ws
    ws = await asyncio.wait_for(
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/subhamdas/.pyenv/versions/3.12.3/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "/Users/subhamdas/self-nm/agent-starter-python/.venv/lib/python3.12/site-packages/aiohttp/client.py", line 1084, in _ws_connect
    raise WSServerHandshakeError(
aiohttp.client_exceptions.WSServerHandshakeError: 402, message='Invalid response status', url='<wss://api.deepgram.com/v1/listen?model=nova-3&punctuate=true&smart_format=true&no_delay=true&interim_results=true&encoding=linear16&vad_events=true&sample_rate=16000&channels=1&endpointing=25&filler_words=true&profanity_filter=false&numerals=false&mip_opt_out=false&language=en-IN>' {"room": "playground-vMlg-a4p6", "pid": 90954, "job_id": "AJ_chXNWxXLrenp"}
2025-12-29 14:27:18,275 - ERROR livekit.agents - Error in _stt_task
Traceback (most recent call last):
  File "/Users/subhamdas/self-nm/agent-starter-python/.venv/lib/python3.12/site-packages/livekit/agents/stt/stt.py", line 408, in __anext__
    val = await self._event_aiter.__anext__()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopAsyncIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/subhamdas/self-nm/agent-starter-python/.venv/lib/python3.12/site-packages/livekit/agents/utils/log.py", line 16, in async_fn_logs
    return await fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/subhamdas/self-nm/agent-starter-python/.venv/lib/python3.12/site-packages/livekit/agents/voice/audio_recognition.py", line 578, in _stt_task
    async for ev in node:
  File "/Users/subhamdas/self-nm/agent-starter-python/.venv/lib/python3.12/site-packages/livekit/agents/voice/agent.py", line 376, in stt_node
    async for event in stream:
  File "/Users/subhamdas/self-nm/agent-starter-python/.venv/lib/python3.12/site-packages/livekit/agents/stt/stt.py", line 411, in __anext__
    raise exc  # noqa: B904
    ^^^^^^^^^
  File "/Users/subhamdas/self-nm/agent-starter-python/.venv/lib/python3.12/site-packages/livekit/agents/stt/stt.py", line 289, in _main_task
    return await self._run()
           ^^^^^^^^^^^^^^^^^
  File "/Users/subhamdas/self-nm/agent-starter-python/.venv/lib/python3.12/site-packages/livekit/plugins/deepgram/stt.py", line 517, in _run
    ws = await self._connect_ws()
         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/subhamdas/self-nm/agent-starter-python/.venv/lib/python3.12/site-packages/livekit/plugins/deepgram/stt.py", line 581, in _connect_ws
    ws = await asyncio.wait_for(
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/subhamdas/.pyenv/versions/3.12.3/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "/Users/subhamdas/self-nm/agent-starter-python/.venv/lib/python3.12/site-packages/aiohttp/client.py", line 1084, in _ws_connect
    raise WSServerHandshakeError(
aiohttp.client_exceptions.WSServerHandshakeError: 402, message='Invalid response status', url='<wss://api.deepgram.com/v1/listen?model=nova-3&punctuate=true&smart_format=true&no_delay=true&interim_results=true&encoding=linear16&vad_events=true&sample_rate=16000&channels=1&endpointing=25&filler_words=true&profanity_filter=false&numerals=false&mip_opt_out=false&language=en-IN>' {"room": "playground-vMlg-a4p6", "pid": 90954, "job_id": "AJ_chXNWxXLrenp"}
2025-12-29 14:27:18,280 - DEBUG livekit.agents - input stream detached
t
Thanks for the logs — I’m looking at the Deepgram WebSocket handshake error (
WSServerHandshakeError: 402
) that caused the agent to close. This error means Deepgram rejected the connection with HTTP 402 (Payment Required), not an authentication or network failure. What you can do next: • Log into your Deepgram Console (https://console.deepgram.com/) and check Billing & Payment Method, account balance, and that your project plan supports the
nova-3
model and the advanced flags you’re using (
smart_format
,
filler_words
, etc.). • Confirm your
DEEPGRAM_API_KEY
is set and that the key has streaming/STT permissions. • Test the WS endpoint directly to reproduce the handshake and confirm 402: ◦ Example with wscat: wscat -H "Authorization: Token YOUR_DEEPGRAM_KEY" -c "wss://api.deepgram.com/v1/listen?model=nova-3&amp;language=en-IN&amp;punctuate=true&amp;smart_format=true" • As a quick diagnostic, try a simplified request (disable advanced flags and/or use
language=en
) to see if it connects. If simplified requests succeed, re-enable features incrementally to identify which one triggers billing enforcement. • Check Deepgram status: https://status.deepgram.com/ If you want, share: • Whether your Deepgram account shows unpaid invoices, low balance, or a trial limitation. • The exact value of the features you’re enabling (copy of the query string is fine). I can then suggest the next specific steps (billing checks vs. config changes). Sources: Deepgram STT plugin guide | LiveKit docs
c
i want to update secrets of my agent
t
Thanks — I can help update your agent secrets. Quick clarification so I give the exact steps: • Are you using LiveKit Cloud or running a self-hosted agent? • How do you currently deploy/manage the agent: with the LiveKit CLI (
lk
) or manually (docker, k8s, systemd)? • Which secret(s) do you want to update (e.g.,
DEEPGRAM_API_KEY
,
OPENAI_API_KEY
)? • Do you prefer to pass secrets inline, from a
.env
file, or mounted as files? Once you tell me those, I’ll give the exact
lk
command or the alternate steps to update and restart your agent. Sources: Agents (Python) | livekit/livekit_composite | DeepWiki | Agent Builder | LiveKit docs