Using image urls in the chat completion endpoint for vision

I am using image urls as parameters in the chat completion endpoint. The user will input their image and then that gets uploaded to a storage bucket and a url for that image is created. The image url is then used as a parameter in the chat completion endpoint.

I am currenty facing issues when using supabase’s storage bucket to store the image. The image urls are causing an invalid request in the chat completion endpoint.

I think many people are facing this issue so they have had to use base64 encoding instead of urls.

Others on the forum have mentioned that they are facing the same problem when using supabase. I believe the problem is with the Open AI API, but does anyone know if this problem occurs with other storage providers like S3 and firebase? Has anyone had a better experience when using those providers?

1 Like

Are you uploading the image to Supabase and then directly requesting it?

If this is intermittent you can try setting up a backoff.

1 Like

@RonaldGRuckus Yeah I am directly requesting it. I thought that may be an issue so I tried adding a very long delay before the chat completion request is sent, however the error still occurred. So I don’t think that the post processing of the image is likely to be the issue.

Do you know what the best practices are for uploading images and storing it though? Because storing URLs are easy, but I can’t store base64 images. So I don’t want to have to convert the image to base64 for the api parameter and also create an image url for the database. I want the user to be able to interact with old images as well so having different formats will be messy

Yeah, sorry. I was recalling a previous thread like this and it was an intermittent issue.

It should work. Maybe it’s worth trying to debug? Save the URL that’s generated and send an immediate HTTP request to it alongside sending it to OpenAI. Atleast from that point you’ll know what side the issue is coming from.

Agreed. That’s too much work. It should work as you originally intended.

Supabase offers some optimization tools for images to mess around with. They automatically re-format the image into webp for clients so no worries about formatting issues.

1 Like

Ok cool I will try this.

Thanks this is very useful, will go through this :slight_smile: