https://retellai.com/?utm_source=discord&utm_medium=seo logo
I converted my voice agent into a chat agent
# ❓・ai-evy-support
d
@AI Evy I converted my voice agent into a chat agent. I then used the create chat agent to create an agent, but create chat completion API always returns an error { "status": "error", "message": "Internal Server Error" } I have confirmed that the chat is ongoing from the status board as well through API. Any idea?
a
Thanks for tagging me @delightful_parrot_58955. I'll look through relevant sources and get back to you shortly.
### Answer The "Internal Server Error" you're encountering with the create chat completion API suggests there might be an issue with your request format or agent configuration. Let me walk through the proper implementation. First, ensure you're creating the chat session correctly using the create-chat endpoint [(1) ]() :
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;

const chatResponse = await client.chat.create({ agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD' }) ;
console.log(chatResponse.agent_id) ;
Then, use the returned
chat_id
for the chat completion request [(2) ]() :
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const response = await client.chat.createChatCompletion({
 chat_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
 content: 'hi how are you doing?',
}) ;
console.log(response.messages) ;
Note that when converting a voice agent to a chat agent, certain voice-specific functions like call transfers, DTMF (press digits) , or telephony features are automatically removed during conversion [(3) ]() . This could potentially cause issues if your original voice agent relied on these features. Key things to verify: - Your API key is correctly formatted as "Bearer YOUR_API_KEY" in the Authorization header [(2) ]() - The
chat_id
you're using exists and has "ongoing" status [(4) ]() - The
content
parameter is included in your request (it's required) [(2) ]() If you continue experiencing this error after verifying these elements, I'd recommend checking if there are any remaining voice-specific configurations in your converted agent that might be causing conflicts.
​ To learn more, see the sources I considered: [[1] Create Chat](https://docs.retellai.com/api-references/create-chat) [[2] Create Chat Completion](https://docs.retellai.com/api-references/create-chat-completion) [[3] Create chat agent](https://docs.retellai.com/build/create-chat-agent) [[4] Get Chat](https://docs.retellai.com/api-references/get-chat) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
d
Useful tip - the problem was the voice agent had DTMF nodes that resulted in the error
a
Thanks for the follow-up, @delightful_parrot_58955. I'll get back to you soon.
Thanks for the feedback, glad I was helpful.
### Answer Thank you for sharing that insight! This is exactly what the documentation indicates - DTMF functionality is specific to voice agents and causes compatibility issues when converting to chat agents. DTMF (Dual-Tone Multi-Frequency) input is designed specifically for phone keypad interactions during voice calls [(1) ]() . The agent configuration includes
allow_user_dtmf
and
user_dtmf_options
parameters that control how keypad input is processed [(2) ]() [(3) ]() [(4) ]() :
Copy code
json
"allow_user_dtmf": true,
"user_dtmf_options": {
  "digit_limit": 25,
  "termination_key": "#",
  "timeout_ms": 8000
}
[(2) ]() [(3) ]() Since chat agents don't have phone keypads, these DTMF nodes and configurations become incompatible and can cause internal server errors when the system tries to process them in a chat context [(1) ]() [(5) ]() . When converting voice agents to chat agents, it's important to remove or replace any DTMF-related functionality before the conversion to avoid these errors. Your experience confirms this is a critical step in the conversion process.
​ To learn more, see the sources I considered: [[1] Capture DTMF input from user](https://docs.retellai.com/build/user-dtmf) [[2] Update Agent](https://docs.retellai.com/api-references/update-agent) [[3] Get Agent](https://docs.retellai.com/api-references/get-agent) [[4] Update Agent](https://docs.retellai.com/api-references/update-agent) [[5] DTMF vs. Voice Recognition: When to Use Retell’s DTMF | Retell AI](https://www.retellai.com/blog/dtmf-vs-voice-recognition-when-to-use-retells-dual-tone) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.