https://retellai.com/?utm_source=discord&utm_medium=seo logo
how to go back to GPT 4o model thorugh API
# ❓・ai-evy-support
f
@AI Evy how to go back to GPT 4o model thorugh API
a
Thanks for tagging me @faizaz_50459. I'll look through relevant sources and get back to you shortly.
### Answer To set your agent to use the GPT-4o model via the Retell AI API, you need to specify the correct response engine when creating or updating your agent. In the API, the response engine is set in the agent configuration using the response_engine object, where you provide the llm_id of the model you want. For GPT-4o, you should use the appropriate llm_id for GPT-4o as configured in your environment. Here is an example using the JavaScript SDK to create an agent (the same structure applies for updating) :
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const agentResponse = await client.agent.create({
  response_engine: { llm_id: 'llm_234sdertfsdsfsdf', type: 'retell-llm' },
  voice_id: '11labs-Adrian',
}) ;
console.log(agentResponse.agent_id) ;
[(1) ]() Replace 'llm_234sdertfsdsfsdf' with your specific GPT-4o llm_id. You can find or configure the correct llm_id in your Retell dashboard.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
​ To learn more, see the sources I considered: [[1] Create Agent](https://docs.retellai.com/api-references/create-agent) ​
f
@AI Evy im using conversational flow agent which is already built. where do i make these changes? can you guide setp by step
a
Thanks for the follow-up, @faizaz_50459. I'll get back to you soon.
### Answer To change the model (for example, to GPT-4o) in a conversation flow agent that is already built, you need to update the conversation flow using the API. The model is set in the model_choice field of the conversation flow configuration. Here’s a step-by-step guide: 1. Retrieve your current conversation flow configuration (optional, but recommended to see how it’s structured) using the Get Conversation Flow endpoint [(1) ]() . 2. Update the conversation flow using the Update Conversation Flow endpoint and specify the model you want in the model_choice field. For example, set model_choice.model to "gpt-4o". Example structure for updating via the SDK:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const conversationFlowResponse = await client.conversationFlow.update('conversation_flow_id', {
  // ...other config fields...
  model_choice: {
    type: 'cascading',
    model: 'gpt-4o',
    high_priority: false
  }
}) ;
console.log(conversationFlowResponse.conversation_flow_id) ;
[(2) ]() 3. Replace 'conversation_flow_id' with your actual flow’s ID and ensure other required fields are present. 4. After updating, the agent will use the specified model (e.g., GPT-4o) for future conversations. Refer to the [Update Conversation Flow documentation]() for all configurable fields and more details .
​ To learn more, see the sources I considered: [[1] Get Conversation Flow](https://docs.retellai.com/api-references/get-conversation-flow) [[2] Update Conversation Flow](https://docs.retellai.com/api-references/update-conversation-flow) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
f
@AI Evy i still dont get it, i have built conversation flro by drag and drop nodes and prompts and set function calls. where exactly in that should i go and do these steps
a
Thanks for the follow-up, @faizaz_50459. I'll get back to you soon.
### Answer To change the model (e.g., switch to GPT-4o) for a conversation flow agent you built using the drag-and-drop editor, you need to adjust the model setting in the conversation flow’s configuration—not inside a specific node or prompt. Here’s where to do it: 1. Open the conversation flow in the Retell dashboard editor. 2. Click on the empty canvas background (not on a node) . This brings up the global settings for the conversation flow. 3. In the global settings panel, you’ll find an option to select the model for the entire flow. Set this to your desired model (e.g., GPT-4o) . You can also adjust other settings like voice, language, and prompts here [(1) ]() . If you want to do this programmatically, you set the model in the model_choice field when creating or updating the flow via API or SDK [(2) ]() [(3) ]() . For more details, see the documentation on [configuring global settings]() .
​ To learn more, see the sources I considered: [[1] Step 1: Configure global settings](https://docs.retellai.com/build/conversation-flow/global-setting) [[2] Create Conversation Flow](https://docs.retellai.com/api-references/create-conversation-flow) [[3] Update Conversation Flow](https://docs.retellai.com/api-references/update-conversation-flow) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
f
@AI Evy yes i want to do this programmatically via api and sdk, what should i do
a
Thanks for the follow-up, @faizaz_50459. I'll get back to you soon.
### Answer To programmatically change the model (e.g., to GPT-4o) for your conversation flow agent using the API or SDK, update the conversation flow and set the model_choice field to your preferred model. Here’s how you can do it using the JavaScript SDK:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const conversationFlowResponse = await client.conversationFlow.update('conversation_flow_id', {
  // ...other config fields...
  model_choice: {
    type: 'cascading',
    model: 'gpt-4o',
    high_priority: false
  }
}) ;
console.log(conversationFlowResponse.conversation_flow_id) ;
[(1) ]() Replace 'conversation_flow_id' with your actual flow’s ID and include any other required fields from your current configuration. This will set the model for your conversation flow agent via the API/SDK.
f
@AI Evy my question i where do i do it? where do i edit it?
a
Thanks for the follow-up, @faizaz_50459. I'll get back to you soon.
### Answer To edit the model used by your conversation flow agent programmatically (via API or SDK) , you update the conversation flow by sending an update request with the model_choice field set to your desired model (e.g., "gpt-4o") . You do this outside the visual editor, not inside the drag-and-drop UI. You perform this update in your code or API client. For example, using the JavaScript SDK, you run code like this:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const conversationFlowResponse = await client.conversationFlow.update('conversation_flow_id', {
  // ...other config fields...
  model_choice: {
    type: 'cascading',
    model: 'gpt-4o',
    high_priority: false
  }
}) ;
console.log(conversationFlowResponse.conversation_flow_id) ;
[(1) ]() You replace 'conversation_flow_id' with your actual conversation flow's ID and fill in other required config fields. This update is made via your development environment or wherever you run your API calls—not in the drag-and-drop dashboard UI.
​ To learn more, see the sources I considered: [[1] Update Conversation Flow](https://docs.retellai.com/api-references/update-conversation-flow) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
​ To learn more, see the sources I considered: [[1] Update Conversation Flow](https://docs.retellai.com/api-references/update-conversation-flow) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.