https://retellai.com/?utm_source=discord&utm_medium=seo logo
Which API call do I use to update the model of the...
# ❓・ai-evy-support
s
@AI Evy Which API call do I use to update the model of the agent?
a
Thanks for tagging me @sanjay_69738. I'll look through relevant sources and get back to you shortly.
### Answer To update the model of an agent, you use the Update Agent API call [(1) ]() . This is a PATCH request to
/update-agent/{agent_id}
. Here's the JavaScript code example:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const agentResponse = await client.agent.update('16b980523634a6dc504898cda492e939', { agent_name: 'Jarvis' }) ;
console.log(agentResponse.agent_id) ;
The update method allows you to modify various agent properties, including the
response_engine
which contains the model configuration . You can update parameters like
voice_model
,
post_call_analysis_model
, and other agent settings through this single API call .
​ To learn more, see the sources I considered: [[1] Update 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.
s
@AI Evy I don't see the model listed as one of the parameters. I want to update from 4.1 to anthropic
a
Thanks for the follow-up, @sanjay_69738. I'll get back to you soon.
​ To learn more, see the sources I considered: [[1] Update Agent](https://docs.retellai.com/api-references/update-agent) ​
### Answer To update the model used by your agent, you need to update the
response_engine
parameter in the Update Agent API call [(1) ]() . The model is specified within the response engine configuration . Here's how to update the response engine with JavaScript:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const agentResponse = await client.agent.update('16b980523634a6dc504898cda492e939', { agent_name: 'Jarvis' }) ;
console.log(agentResponse.agent_id) ;
The
response_engine
object contains the model configuration and has these options : - `type`: The type of response engine (e.g., "retell-llm") - `llm_id`: The ID of the LLM Response Engine - `version`: Version of the Response Engine To change from one model to another (like from GPT-4.1 to Anthropic) , you would need to create a new Response Engine first with your desired model, then update the agent's
response_engine
parameter to reference the new engine's
llm_id
.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.