We are unable to get image understanding to work using the openai api for gemini models.
We are following the docs here OpenAI compatibility | Gemini API | Google AI for Developers
Here is an example prompt:
{
"model": "gemini-2.5-flash-preview-05-20",
"temperature": 0.7,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "what is in the image"
},
{
"type": "image_url",
"image_url": {
"url": "data:image/png;base64,{{base_64_data}}"
}
}
]
}
]
}
The error we get is this
{code: 400, message: 'Unsupported file uri: data:image/png;base64,…ABLPLmMAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAgAE...', status: 'INVALID_ARGUMENT'}
Is this a known issue or are we doing something wrong?
We have tested that it is valid base64 data and we can convert it back into an image.