Error Sending Base64 Image Data in API Request to GPT-4-vision Model

You’re using the wrong schema for the image object, instead of

{
“type”: “image”, 
“data”: “iVBORw0KGgoAAAANSUhEUgAA…”
}

Use:

{
"type": "image_url", 
"image_url": 
{
      "url": "data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAA…"
    }
}

When I was implementing GPTV into my own project, I found this to be interesting.
On one hand, the naming structure is confusing. On the other, keeping the same schema regardless of the call maintains polymorphic behavior. Write one GPTV call function and it can easily handle either url or base64 input without any conditional logic.

I think that your naming structure is superior, personally, because it better represents the agnostic behavior of the route. But I’m not sure who to ping to get the conversation started ha.

2 Likes