Open a WebSocket to wss://api.deepgram.com/v1/listen with query parameters model=nova-3, encoding (e.g. linear16), sample_rate, and channels; authenticate with the Authorization: Token YOUR_DEEPGRAM_API_KEY header.
On connection open, begin streaming raw audio frames as binary WebSocket messages in the encoding and sample rate declared in the URL.
To hold the connection open during silence, send a text-frame KeepAlive message (JSON {"type":"KeepAlive"}) every 3–5 seconds — the server closes with NET-0001 after 10 seconds of inactivity (no audio and no KeepAlive).
Parse incoming text frames: type=Results carries the transcript in channel.alternatives[0].transcript; is_final=true marks a completed utterance.
When done, send a text-frame CloseStream message ({"type":"CloseStream"}) and wait for the server to close the connection cleanly before destroying the socket.
Known gotchas
The 10-second inactivity timeout applies to the STT streaming endpoint; the Agent product uses a different keep-alive interval — do not conflate the two.
KeepAlive must be sent as a text WebSocket frame, not binary; sending binary will cause incorrect handling or connection closure.
Model name nova-3 (or nova-3-{variant}) is required in the URL query string — the server does not assume a default model.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp