Traceback (most recent call last): File "C:\User...
# ask-ai
d
Traceback (most recent call last): File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\aiohttp\client.py", line 760, in _request resp = await handler(req) ^^^^^^^^^^^^^^^^^^ File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\aiohttp\client.py", line 715, in _connect_and_send_request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ req, traces=traces, timeout=real_timeout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\aiohttp\connector.py", line 596, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\aiohttp\connector.py", line 1112, in _create_connection _, proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\aiohttp\connector.py", line 1432, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<7 lines>... ) ^ File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\aiohttp\connector.py", line 1179, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs, sock=sock) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python313\Lib\asyncio\base_events.py", line 1193, in create_connection transport, protocol = await self._create_connection_transport( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<2 lines>... ssl_shutdown_timeout=ssl_shutdown_timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python313\Lib\asyncio\base_events.py", line 1226, in _create_connection_transport await waiter asyncio.exceptions.CancelledError The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\livekit\plugins\deepgram\tts.py", line 216, in _run async with self._session.post( ~~~~~~~~~~~~~~~~~~^ _to_deepgram_url(config, self._base_url, websocket=False), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... timeout=self._conn_options.timeout, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as res: ^ File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\aiohttp\client.py", line 1469, in aenter self._resp: _RetType = await self._coro ^^^^^^^^^^^^^^^^ File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\aiohttp\client.py", line 612, in _request with timer: ^^^^^ File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\aiohttp\helpers.py", line 685, in exit raise asyncio.TimeoutError from exc_val TimeoutError The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\livekit\agents\tts\tts.py", line 201, in _main_task return await self._run() ^^^^^^^^^^^^^^^^^ File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\livekit\plugins\deepgram\tts.py", line 248, in _run raise APITimeoutError() from e livekit.agents._exceptions.APITimeoutError: Request timed out. 2025-09-06 140124,515 - ERROR livekit.agents.pipeline - Error in _recognize_task Traceback (most recent call last): File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\livekit\agents\utils\log.py", line 16, in async_fn_logs return await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\livekit\agents\pipeline\human_input.py", line 158, in _recognize_task await asyncio.gather(*tasks) File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\livekit\agents\pipeline\human_input.py", line 144, in _stt_stream_co async for ev in stt_stream: ...<5 lines>... self.emit("interim_transcript", ev) File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\livekit\agents\stt\stt.py", line 321, in anext raise exc from None File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\livekit\agents\stt\stt.py", line 219, in _main_task return await self._run() ^^^^^^^^^^^^^^^^^ File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\livekit\plugins\deepgram\stt.py", line 549, in _run ws = await self._connect_ws() ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Lenovo\Documents\ai-backend\venv\Lib\site-packages\livekit\plugins\deepgram\stt.py", line 606, in _connect_ws ws = await asyncio.wait_for( ^^^^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Python313\Lib\asyncio\tasks.py", line 506, in wait_for async with timeouts.timeout(timeout): ~~~~~~~~~~~~~~~~^^^^^^^^^ File "C:\Python313\Lib\asyncio\timeouts.py", line 116, in aexit raise TimeoutError from exc_val TimeoutError
t
Thanks for reaching out, Giriraj. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! The error you're seeing,
livekit.agents._exceptions.APITimeoutError
, usually pops up because of network or setup hiccups with the Deepgram TTS/STT integration. No worries though—here are some friendly troubleshooting tips to help you out: • Double-check your API Key and Connection: Make sure your
DEEPGRAM_API_KEY
is spot on and that the Deepgram API is reachable from your setup. • Tweak Timeout Settings: You can adjust the connection timeout via
APIConnectOptions
, but keep in mind the total request timeout for non-streaming calls is capped at 30 seconds. • Try Streaming Mode for Longer Audio: If your audio is longer, switching to streaming mode can help you avoid that 30-second timeout. • Look Into Your Infrastructure: Using AWS burstable instances like
t3
or
t4g
? Sometimes CPU throttling there can slow things down. If that sounds like your setup, consider moving to non-burstable instances like
c5
or
m5
. • Check WebSocket Connections: Make sure WebSocket traffic isn’t being blocked and that you can access the Deepgram WebSocket URL without issues. If you want, I’m here to help you walk through any of these steps—whether it’s checking your deployment environment or tweaking some settings. Just let me know! Sources: livekit-plugins/livekit-plugins-neuphonic/livekit/plugins/neuphonic/tts.py | plugins/deepgram/src/stt.ts | Troubleshooting Latency and Timeout Errors with Turn Detection on AWS