https://retellai.com/?utm_source=discord&utm_medium=seo logo
why does retell stt closes immediately
# 🎖・ask-retell-partners
t
@AI Evy why does retell stt closes immediately
a
Thanks for tagging me @trxgames. I'll look through relevant sources and get back to you shortly.
a
### Answer I don't have specific documentation explaining why the STT (speech-to-text) connection would close immediately. However, based on a similar issue discussed in the community, if you're using a custom LLM with WebSocket connections, disconnections can occur if responses take too long (more than 4–5 seconds) before sending data—Retell closes idle connections. [(1) ]() Potential causes and fixes include: - Enable
auto_reconnect
and respond to Retell's
ping_pong
events to keep the connection alive - Stream partial responses earlier so there's no long silence - Catch send errors and stop writing after the socket closes - Ensure your server supports persistent websockets (not serverless with short timeouts) Could you share more context about your setup? For example: - Are you using a custom LLM or the Retell LLM? - Is this happening on inbound/outbound calls or web calls? - Any error messages you're seeing? This would help narrow down the issue.
​ To learn more, see the sources I considered: [[1] Disconnections in Call](https://discord.com/channels/1186424376300679209/1364985947254685796) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
using custom llm
in what format Retell STT accepts, Retell’s realtime STT expects JSON frames ???
a
Thanks for the follow-up, @trxgames. I'll get back to you soon.
### Answer I don't have specific documentation in the available sources about the exact format Retell's realtime STT expects for incoming frames (whether JSON or raw audio) . The sources I have access to cover custom functions, agent creation, and LLM configuration, but don't detail the WebSocket message format for the STT/custom LLM interface. For the custom LLM WebSocket protocol and message formats, I'd recommend checking: - [Custom LLM WebSocket documentation]() (search for "custom LLM" or "WebSocket") - [Contact Sales]() for direct support - [Retell AI GitHub]() for SDK examples Would you like me to try providing a general answer based on common WebSocket patterns, or do you have any error messages/logs that might help narrow down the issue?
message has been deleted
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
@AI Evy Would you like me to try providing a general answer based on common WebSocket patterns
a
Thanks for the follow-up, @trxgames. I'll get back to you soon.
### Answer ### Answer Actually, I do have documentation on the LLM WebSocket protocol. Here's what Retell expects: Message Format All WebSocket messages are text events where the
data
attribute is a JSON object stringified. [(1) ]() Your Server → Retell Events: When responding to Retell, you send JSON with a
response_type
field. For responses, use:
Copy code
json
{
  "response_id": 0,
  "content": "How may I help you?",
  "content_complete": true,
  "end_call": false
}
[(2) ]() Retell → Your Server Events: Retell sends JSON with an
interaction_type
field (
update_only
,
response_required
,
reminder_required
,
ping_pong
) . [(1) ]() Key Protocol Points: - Your server must send the first message upon WebSocket connection (set content to empty string if you want the user to speak first) [(3) ]() - When
interaction_type
is
response_required
, you must send a response back - You can stream responses or send them in one go (streaming recommended for lower latency) [(1) ]() Example Response Handler:
Copy code
javascript
const res: RetellResponse = {
  response_id: request.response_id,
  content: "I am sorry, can you say that again?",
  content_complete: true,
  end_call: false,
};
ws.send(JSON.stringify(res) ) ;
[(2) ]() Check out the [Node Demo Repository]() or [Python Demo Repository]() for complete examples. [(3) ]()
​ To learn more, see the sources I considered: [[1] LLM WebSocket](https://docs.retellai.com/api-references/llm-websocket) [[2] Setup WebSocket Server](https://docs.retellai.com/integrate-llm/setup-websocket-server) [[3] Custom LLM Overview](https://docs.retellai.com/integrate-llm/overview) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
@AI Evy what does retell stt expects in which format is it in json or any other
a
Thanks for the follow-up, @trxgames. I'll get back to you soon.
### Answer --- I don't have specific documentation in my current sources about the exact format that Retell's STT (speech-to-text) expects for incoming audio data. The sources I have access to cover agent configuration (like
stt_mode
which can be set to
"fast"
or
"accurate"
) [(1) ]() , custom functions, and LLM response formats—but they don't detail the raw audio input format for the STT pipeline itself. For the custom LLM WebSocket integration, **Retell handles the STT internally**—your custom LLM server receives already-transcribed text from Retell (as JSON with the transcript in the payload) , and you send back text responses. You don't send audio directly to Retell's STT in that flow. If you're asking about sending raw audio to Retell, I'd recommend checking: - [LLM WebSocket documentation]() - [Contact Sales]() - [Retell AI GitHub]() Could you clarify your use case? Are you trying to: 1. Send audio directly to Retell's STT? 2. Receive transcriptions in your custom LLM server? 3. Something else? This will help me point you to the right resources.
​ To learn more, see the sources I considered: [[1] Update Voice Agent](https://docs.retellai.com/api-references/update-agent) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
@AI Evy We are sending live call audio directly to Retell’s STT
a
Thanks for the follow-up, @trxgames. I'll get back to you soon.
### Answer I don't have specific documentation in my current sources about sending raw audio directly to Retell's STT service and what format it expects. Based on the available documentation, for web calls using the Retell Web SDK, if you're working with custom audio handling, the SDK mentions PCM audio format. The documentation references conversion functions
convertUnsigned8ToFloat32
and
convertFloat32ToUnsigned8
for PCM audio representation. [(1) ]() However, the typical Retell architecture handles STT internally—you connect via: - Phone calls (SIP/PSTN) : Retell handles the audio and STT - **Web calls**: The Web SDK handles audio capture and STT - **Custom LLM**: You receive already-transcribed text from Retell If you're trying to stream raw audio to Retell's STT outside of these standard flows, that's not a documented use case in my available sources. Could you clarify your setup? 1. Are you using the Web SDK and trying to send custom audio? 2. Are you trying to bypass Retell's phone/web infrastructure entirely? 3. What's the source of your "live call audio"? For direct support on custom audio streaming to STT: - Visit [Contact Sales]() - Visit [) Would you like a general answer about common audio streaming formats for STT systems?
​ To learn more, see the sources I considered: [[1] Connect to web call](https://docs.retellai.com/deploy/web-call) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
@AI Evy chat widget code is not working (function () { const s = document.createElement("script"); s.src = "https://cdn.retellai.com/webchat.js"; s.async = true; s.onload = function () { RetellWebChat.init({ agentId: "YOUR_RETELL_AGENT_ID", title: "OptimoAI Assistant", subtitle: "AI Automation • AI Receptionists • ROI", position: "bottom-right", theme: { primaryColor: "#000000", // Header background accentColor: "#D4AF37", // Buttons, highlights textColor: "#FFFFFF", backgroundColor: "#111111", userBubbleColor: "#D4AF37", agentBubbleColor: "#1A1A1A" }, greeting: "Hi! I’m the OptimoAI Assistant. How can I help automate your business today?" }); }; document.body.appendChild(s); })();
a
Thanks for the follow-up, @trxgames. I'll get back to you soon.
### Answer I don't have specific documentation about the
RetellWebChat
widget configuration in my available sources. The sources I have cover the Retell Web SDK for voice calls (using
retell-client-js-sdk
) , not the chat widget you're referencing. For web voice calls, the documented approach uses:
Copy code
javascript
import { RetellWebClient } from "retell-client-js-sdk";
const retellWebClient = new RetellWebClient() ;
[(1) ]() A few things to check with your chat widget code: 1. Replace the placeholder — You have
agentId: "YOUR_RETELL_AGENT_ID"
which needs to be replaced with your actual agent ID 2. Agent configuration — Ensure your agent is configured for chat mode (not just voice calls) 3. Console errors — Check your browser's developer console for any JavaScript errors when the page loads For the chat widget specifically, I'd recommend: - Check out these potentially useful sources: [Connect to web call]() , [Create Web Call]() - Visit [Contact Sales]() - Visit [) Would you like me to try providing a general answer about debugging embedded widget scripts, or can you share any error messages from your browser console?
​ To learn more, see the sources I considered: [[1] Connect to web call](https://docs.retellai.com/deploy/web-call) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
provide me right chat widget code
a
Thanks for the follow-up, @trxgames. I'll get back to you soon.
### Answer The URL ` is not correct. The correct script source for the Retell Chat Widget is:
Copy code
<https://dashboard.retellai.com/retell-widget.js>
[(1) ]() Here's the correct chat widget code to embed in your HTML
<head>
tag:
Copy code
html
<script
  id="retell-widget"
  src="<https://dashboard.retellai.com/retell-widget.js%22>
  type="module"
  data-public-key="YOUR_RETELL_PUBLIC_KEY"
  data-agent-id="YOUR_CHAT_AGENT_ID"
  data-agent-version="YOUR_AGENT_VERSION"
  data-title="YOUR_CUSTOM_TITLE"
  data-logo-url="YOUR_LOGO_URL"
  data-color="YOUR_CUSTOM_COLOR"
  data-bot-name="YOUR_BOT_NAME"
  data-popup-message="YOUR_POPUP_MESSAGE"
  data-show-ai-popup="true"
  data-show-ai-popup-time="5"
  data-auto-open="false"
></script>
Required attributes: -
data-public-key
- Your Retell public key (get it from Dashboard → Keys → Public Keys) , [(2) ]() -
data-agent-id
- Your chat agent ID [(1) ]() Optional attributes: -
data-agent-version
- Agent version (defaults to latest if unset) -
data-title
- Custom chat window title -
data-logo-url
- URL of your logo image -
data-color
- Hex color code for widget theme (e.g., "#FFA07A") -
data-bot-name
- Bot name for popup messages -
data-popup-message
- Popup message before users open chat -
data-show-ai-popup
- Set to "true" to enable popup messages -
data-auto-open
- Set to "true" to auto-open chat widget on page load Important: You need a Retell Public Key (not an API key) for the chat widget. Create one in Dashboard → Keys → + Add Key → Public Key, and specify your website domain. [(2) ]()
​ To learn more, see the sources I considered: [[1] Retell Website Widget](https://docs.retellai.com/deploy/chat-widget) [[2] Chat Widget, Custom Function Enhancement and more!](https://www.retellai.com/changelog/chat-widget-custom-function-enhancement-and-more) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
@AI Evy there is no response from AI in chat widget
a
Thanks for the follow-up, @trxgames. I'll get back to you soon.
### Answer If your chat widget is loading but not getting AI responses, here are the key things to verify: *1. Ensure you're using a Chat Agent (not a Voice Agent) * The chat widget requires a chat agent ID, not a voice agent ID. [(1) ]() 2. Verify your agent version If you haven't published any new versions, make sure
data-agent-version
is set to
"0"
. [(2) ](

▾

) 3. Check your Public Key configuration Make sure your public key is configured with the correct domain where the widget is embedded. [(1) ]() 4. Correct widget setup Confirm your script looks like this in the
<head>
tag:
Copy code
html
<script
  id="retell-widget"
  src="<https://dashboard.retellai.com/retell-widget.js%22>
  type="module"
  data-public-key="YOUR_RETELL_PUBLIC_KEY"
  data-agent-id="YOUR_CHAT_AGENT_ID"
  data-agent-version="0"
  data-title="YOUR_CUSTOM_TITLE"
></script>
, [(3) ]() 5. Test your agent in the dashboard first Use Manual Chat or AI Simulated Chat in the agent builder to confirm your agent responds correctly before embedding. Troubleshooting steps: - Check your browser's developer console for any JavaScript errors - Verify the agent ID and public key are correct (no typos) - Ensure the domain in your public key settings matches where you're testing If the agent works in the dashboard but not in the widget, the issue is likely with the public key domain configuration or the agent ID. Would you like help verifying any of these specific items?
​ To learn more, see the sources I considered: [[1] Retell Website Widget](https://docs.retellai.com/deploy/chat-widget) [[2] Introducing Retell Chat - Web chat widget](

https://www.youtube.com/watch?v=SByCDIJkRhE▾

) [[3] Retell AI Chat Agent – Real-Time Web Chat Automation Widget | Retell AI](https://www.retellai.com/blog/meet-retell-chat-agents-build-smarter-web-chats) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
tried all ways but still chat widget doesnt give reply @AI Evy
a
Thanks for the follow-up, @trxgames. I'll get back to you soon.
​ To learn more, see the sources I considered: [[1] Chat bot not responding](https://discord.com/channels/1186424376300679209/1384593638499160124) [[2] Public Keys](https://docs.retellai.com/accounts/public-keys) [[3] Discord message from @itstubzy on 2026-01-13](https://discord.com/channels/1186424376300679209/1294891368505937952/1460668540058079365) ​
ted directly in the Retell dashboard?
### Answer If you've verified all the previous suggestions and the chat widget still isn't responding, here are additional troubleshooting steps based on common issues: 1. Domain Whitelisting Issue A common cause is the public key domain mismatch. The error "Public key is not allowed for this domain" occurs when the domain where the widget is embedded doesn't match what's configured in your Retell dashboard. [(1) ]() [(2) ]() - Navigate to Dashboard → Keys → Public Keys - Click on your public key and verify the exact domain is listed - If you're testing locally, add
localhost
to your allowed domains list 2. Path-Based Domain Limitation If your site loads on a subpath (like
website.com/page/
) , you may only be able to whitelist the root domain (
website.com
) . One user reported this exact issue with Google Sites and WordPress sites loading on subpaths. [(1) ]() , [(3) ]() 3. Check Browser Console for Specific Errors Open DevTools (F12) and look for: -
create-chat 401
error → Public key/domain mismatch -
get-chat/undefined
error → Missing or incorrect agent ID, or the widget script loading before config 4. Verify Agent is a Chat Agent Confirm in your Retell dashboard that you're using a chat agent ID, not a voice agent ID. 5. Test Agent in Dashboard First Use the built-in testing in the agent builder to confirm your agent responds before embedding. If you're still stuck, could you share: - The exact error message from your browser console? - What domain you're embedding on vs. what's in your public key settings? - Whether the agent responds when tes
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
Thanks for the follow-up, @trxgames. I'll get back to you soon.
### Answer I see you mentioned receiving an error, but you didn't include the actual error message in your message. Could you please share: 1. The exact error message from your browser's developer console (F12 → Console tab) 2. A screenshot if possible Common errors and their meanings: - "Public key is not allowed for this domain" → Your domain isn't whitelisted in your public key settings [(1) ]() , [(2) ]() -
create-chat 401
error
→ Public key/domain mismatch [(3) ]() -
get-chat/undefined
error
→ Missing or incorrect agent ID, or the widget script loading before configuration is ready Once you share the specific error, I can help you troubleshoot the exact issue.
​ To learn more, see the sources I considered: [[1] Public Keys](https://docs.retellai.com/accounts/public-keys) [[2] Chat bot not responding](https://discord.com/channels/1186424376300679209/1384593638499160124) [[3] Discord message from @itstubzy on 2026-01-13](https://discord.com/channels/1186424376300679209/1294891368505937952/1460668540058079365) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.