What are the APIs for image analysis?

Hello Community,

I recently got my hands on ChatGPT-4o and was amazed by its capabilities. It accurately analyzed a stock image.

Since then, I have been wondering how it achieved this! If I want to obtain similar, mostly accurate image analysis results, are there any APIs for the gpt-4o model? Any insights on this topic would be very helpful.

1 Like

Go to openai api reference
/docs/api-reference/chat/create

Inside chat completion endpoint, check the messages and expand it, in User Message, show properties > see content(you need show properties several times…), you can find how to pass image input to your request

1 Like

The feature you’d want to use is called vision. There’s no special End Point for vision but you can use this via chat completion. Here’s an example:

curl https://api.openai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-4o",
    "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
  }'

for more info, check this part of Documentation

2 Likes