New Chat gpt vision with weweb help

Hi I wanted to know how to use the latest api chat gpt? chatgpt vision ect… Because it seems that the option is not available at the moment.

image

use the REST API on weweb.

thank you but how can i connect it to weweb using rest api ? im quit new…

I think you shouldn’t as it would mean making public your API KEY. I will create a product ticket to handle the update and add a new gpt vision model in the available options :slight_smile:

If you do a custom integration please do it in your backend so you can keep your api key private.

Okai thank you alexis ! Dont worry its just for testing, i will not publish the project publicly :slight_smile:

Oh ok, so by following the documentation you can try to put your api key in a REST API action. You need to add the REST API plugin, then you will have the Request action available.

This action allow you to use any API REST, including the one provided by OpenAPI. You will have to follow the documentation shared by @justifi

The documentation show

curl https://api.openai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-4-vision-preview",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "What’s in this image?"
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
            }
          }
        ]
      }
    ],
    "max_tokens": 300
  }'

It means you have to send a POST request to https://api.openai.com/v1/chat/completions with one header and some information in the body.

The header key must be Authorization and the value Bearer $OPENAI_API_KEY where you put your API KEY.

You will have to add 2 fields inside the body.

  • One with the key model and the value gpt-4-vision-preview
  • Another with the key messages and as value an object containing something formatted as in the code.
  • A third optional field (I guess) called max_tokens

Good luck!

1 Like

It worked thank you !

1 Like

Hello Alexis. Do you have a solution for this ? thank you Json open ai api doesn't recognise variables