Using gpt-4-vision-preview
I’m getting a BadRequestError: 400 Invalid image
error when the image url has some encoding. Specifically, I’m using a getDownloadUrl()
from Firebase storage which has some characters encoded (%2F). I can’t replace this with “/” because the URL becomes invalid.
The image URL is currently a 404.
Indeed putting forward slashes in is instead a 400.
However, the “token” in the URL indicates some authentication going on, does it work in a private or different browser? Another site that you can upload from a URL like imgur.com?
With the python library you can get raw response, and then get the text of the request to see what was sent to the API if you are using that library.
You could also send such a URL to your own domain and see from the log if OpenAI is rewriting the %2F to something invalid.
Best is just download yourself and submit to the API as base64. Too much could be blocked just with the request coming from OpenAI’s gpt-bot that respects robots.txt.
[the image url i provided is invalid - just a sample to illustrate the encoding].
My suspicion is that the API has a problem with encoded URL characters. It works as expected if there are now encoded characters, base64 string also works as expected.
My issue is that, for performance reasons, I don’t have the time to re-upload the image elsewhere. I must use the Firebase Storage download url, which as per Firebase documentation, must have have the %2F encoding.