# Inference STT WebSocket fails (APIConnectionError) while room connection works

**URL:** <https://community.livekit.io/t/inference-stt-websocket-fails-apiconnectionerror-while-room-connection-works/683>\
**Category:** Agents\
**Tags:** agent-development\
**Created:** [March 26, 2026, 4:51am UTC](https://community.livekit.io/t/inference-stt-websocket-fails-apiconnectionerror-while-room-connection-works/683 "2026-03-26T04:51:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naehyung\_Kim](https://avatars.discourse-cdn.com/v4/letter/n/46a35a/32.png) [@Naehyung\_Kim](https://community.livekit.io/u/Naehyung_Kim)\
**Post date:** [March 26, 2026, 4:51am UTC](https://community.livekit.io/t/inference-stt-websocket-fails-apiconnectionerror-while-room-connection-works/683/1 "2026-03-26T04:51:35Z")

</div>

We’re using @livekit/agents (Node) for a self-hosted agent.

Room connection works fine:

- worker registers successfully
- ctx.connect() succeeds
- participant joins successfully

However, any AgentSession using inference.STT fails right after session start.

Error:  
APIConnectionError: Error connecting to LiveKit WebSocket  
→ retries 3 times  
→ then: failed to recognize speech after 4 attempts

This happens with both:

- deepgram/nova-3
- assemblyai/u3-rt-pro

If we remove STT completely:  
→ session works normally

We also verified:

- DNS resolution for agent-gateway.livekit.cloud works
- HTTPS to [https://agent-gateway.livekit.cloud](https://agent-gateway.livekit.cloud) returns 200
- wscat to wss://agent-gateway.livekit.cloud/v1 returns 401 (expected)

So network/TLS/websocket reachability seems fine.

This looks specific to inference STT websocket/auth path.

Environment:

- @livekit/agents: 1.0.50 (latest)
- Node: 20
- Region: Australia
- Self-hosted agent

Minimal repro:

```ts  
const session = new voice.AgentSession({  
stt: new inference.STT({  
model: ‘deepgram/nova-3’,  
language: ‘en’,  
}),  
});

await session.start({  
room: ctx.room,  
agent: new voice.Agent({  
instructions: ‘Transcribe only.’,  
}),  
});

---

<div class="post-metadata">

**Author:** ![darryncampbell](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/darryncampbell/32/20_2.png) [@darryncampbell](https://community.livekit.io/u/darryncampbell)\
**Post date:** [March 26, 2026, 10:37am UTC](https://community.livekit.io/t/inference-stt-websocket-fails-apiconnectionerror-while-room-connection-works/683/2 "2026-03-26T10:37:26Z")

</div>

![Screenshot 2026-03-26 at 10.33.21](https://us1.discourse-cdn.com/flex001/uploads/livekit2/original/1X/16a76a7be5d154b862c0d9739b9a8b8615b44afd.png)

It seems you have exceeded your free tier limits, you should see this when you log into your project at [cloud.livekit.io](http://cloud.livekit.io) ⬆

You should have received an email about this also, it looks as though you have exceeded the STT connection limit, [Pricing | LiveKit](https://livekit.com/pricing#inference-concurrency)
