Gpt 4o sometime not able to access image from url

I am sending an image url to the gpt4o(azure openai endpoint). The model is throwing an error

openai.BadRequestError: Error code: 400 - {'error': {'code': 'BadRequest', 'message': 'The provided image url is not accessible.', 'param': None, 'type': None}}

But the same image url is accessible through the given url. And the same request succeed on retrying after 1+ hours. The url is from public storage container in Azure blob.

The value to the message parameter in the chat completion API is as following:

[
        {
            "role": "system",
            "content": [
                {
                    "type": "text",
                    "text": system_prompt,
                }
            ],
        },
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": user_prompt,
                },
                {
                    "type": "image_url",
                    "image_url": {
                        "url": image_url,
                    },
                },
            ],
        },
    ]
1 Like

Welcome @ashrafkhan0997

That’s normal because sometime sites hosting the images block agents like the one OpenAI uses to retrieve image from the URL.

Workaround is to upload base64 encoded image.

3 Likes