GPT4 Vision error when passing GCP Storage Bucket URL


I am getting a not-so-verbose error saying my image is invalid. My workflow includes uploading images to the GCP storage bucket and using those URLs in the prompt. The png images are public but I’m not sure why OpenAI is not taking them in.

Error: BadRequestError: Error code: 400 - {'error': {'message': 'Invalid image.', 'type': 'invalid_request_error', 'param': None, 'code': None}}

Here is a sample URL that is not working.

client = OpenAI()

response =
            "role": "user",
            "content": [
                {"type": "text", "text": "Describe the image."},
            "type": "image_url",
            "image_url": {
              "url": ""

Hi and welcome to the Developer Forum!

Best way to avoid this kind of issue is to download the image locally and then send it to the API in base64 encoded format. That way you have control over checking the image for validity within your own code and you will be assured of a valid image being sent to the model.

Unfortunately, we’re using Bubble io no/low code tool for the UI with limited code functionality. Are there any permissions that I’m missing for the image? The image URL is public and I couldn’t find anything about why this is failing.

No, it’s just that internet hosting images services can restrict access whenever they wish, I’ve seen more than a few people mention that pointing the bot at remote sites has been problematic. The solution is to host locally and upload in base64. I think that bubble does allow javascript functions to run by making use of the toolbox plugin, perhaps that is an avenue for you to investigate.

Unfortunately, no-code system are often more work than actually coding in python or java.

Agreed that no-code will increase the overall work. The toolbox plugin doesn’t seem to support the libraries (or any libraries for that matter) that will be needed.

PNG was a hit or miss on GCP Cloud storage. Using JPEG solved it. Sample URL with JPEG: