Issue with GPT-4o Analyzing Base64 Encoded Images in FlutterFlow/Postman

I’m trying to use gpt-4o to analyze a base64 encoded image, but I’m getting a message saying it’s unable to view or analyze images directly. I’ve tested the api in both flutterflow and postman and encountered the same issue. What should I do?

Welcome to the community!

Have you tried getting it to work in the playground?

https://platform.openai.com/playground/chat?models=gpt-4o

you can even click on the </> button (top right) to generate a curl command for you to make sure you don’t make any accidental mistakes:

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": "system",
      "content": [
        {
          "type": "text",
          "text": "What'\''s in this image?"
        }
      ]
    },
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "What'\''s in this image?"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQAb4... ...3Fhg0KMENUUVIz//Z"
          }
        }
      ]
    },
    {
      "role": "assistant",
      "content": [
        {
          "type": "text",
          "text": "The image shows a small cat wearing a costume that makes it look like a lion. The cat has a mane-like accessory around its head, which gives the impression of a lion'\''s mane. The cat is standing among a field of pink and white flowers, presumably daisies, with a background of greenery. The setting appears to be outdoors, in a garden or park."
        }
      ]
    }
  ],
  "temperature": 1,
  "max_tokens": 256,
  "top_p": 1,
  "frequency_penalty": 0,
  "presence_penalty": 0,
  "response_format": {
    "type": "text"
  }
}'


spoiler

your user message object is malformed
here’s the API reference, but the code from the playground is also good
https://platform.openai.com/docs/api-reference/chat/create