Retool AI Chatbot with a different API

Hi everyone!!

Is it possible to use the chat with a different API that is not one of OpenAI, Azure, Anthropic or Cohere?? If it is possible, how can I do it?

Thank you!

Hi @Matilde_Sartori,

Yes, it is possible to use the Retool AI Chatbot with a different API that is not one of OpenAI, Azure, Anthropic, or Cohere. To do this, you can use the Retool REST API connector.

The REST API connector allows you to connect Retool to any third-party API. To use the REST API connector with the Retool AI Chatbot, you will need to create a new AI Action query and select the REST API connector as the AI model.

Once you have created the AI Action query, you will need to configure the REST API connector to send requests to your preferred API. To do this, you will need to provide the following information:

  • The URL of the API endpoint that you want to call.
  • The HTTP method that you want to use (GET, POST, PUT, DELETE).
  • The request headers.
  • The request body.

Once you have configured the REST API connector, you can start using the Retool AI Chatbot to generate responses using your preferred API.

Here is an example of how to use the Retool AI Chatbot with the REST API connector:

// Create a new AI Action query
const aiActionQuery = table.addAIActionQuery({
  title: 'My Custom AI Action',
  aiModel: 'REST API Connector',

// Configure the REST API connector
  url: '',
  method: 'GET',
  headers: {
    'Authorization': 'Bearer MY_API_KEY',

// Generate a response using the AI Action query
const response = aiActionQuery.generate({
  prompt: 'What is the weather today?',

// Display the response
  message: response,

This example will generate a response using the Retool AI Chatbot and the API endpoint The API endpoint must return a JSON response, which will be displayed in a notification.

You can use the Retool REST API connector to connect Retool to any third-party API, including APIs that are not specifically designed for chatbots. This gives you the flexibility to use the Retool AI Chatbot with any API that you need.

More info can be found in Retool's documentation: Retool AI platforms and models | Retool Docs

Hope this helps.



1 Like

Thank you very much Patrick!!

I followed what you said but I still have a problem:

I don't understand how i can tell the chatbot that it has to show the message inside "content": that is "¡Hola! ¿Cómo puedo ayudarte hoy?" and not going on with the "...".

Did you manage to solve this seemingly simple problem?? I also do not know how this message gets connected. I looked at the lastmessage and lastresponse, but these do not work either ?

Hi Patrick, How would I connect the responses from my own api, back into the chatbot listitems or table, so it will show on the chatbot screen as a response from the AI api.?

I am also finding it difficult to understand how i get the entered text to send to the API? Meaning the text I enter into textbox. I have looked at lastMessage, but it seems to be constant set to the very first message i sent. not the last. I am now using the to get the last entered value in that array? is this the preferred way ??

Note: I am using a script that i call after entering the search text. the script calls the api, and returns a response