Hi All - can somebody just please explain what the status is with the URLs returned by the DALLE API “response_format”:“url” when generating an image and why they’re not accessible?
I have good reasons for not wanting to use the b64_json option (which someone else has posted here that this was their workaround for the issue), not least because of the overhead of handling and decoding 4mb strings over the wire. I just want to use the URL and inject it into an img tag on the page and there are many examples of people having successfully done this.
However, it seems that any URL generated is not accessible either when pasted into the address bar or immediately used within an img tag as the error occurs
Has the security status changed for these URLs since people have posted about using them in their img tags and if so what is the solution? Is there any way to use the API key to somehow authenticate with the generated URL or am I just missing something daft?!
The URLs expire (timeout). The last time I checked a few weeks ago, the timeout was around 2 hours, so if you try to use the URLS after that time, they are “gone”.
What I do is to immediately save the image to disk (in a public folder accessible via the web) after I generate an image and then I use “my URL” to the image and not the OpenAI URL.
Hi and thanks a lot for taking the time reply! I was aware of the 2 hour window but to be honest that’s fine for our purposes - we just want to give our website users a bit of inspiration as opposed to making the images downloadable for them. Plus the server overhead of handling potentially 100s of 4mb files is too much currently, so we just wanted to show the image as a “one-off” using the OpenAI-hosted URLs. Other people seem to be able to embed these inside IMG tags and it works fine eg How to Generate Images using React and the Dall-E 2 API – React and OpenAI API Tutorial
It’s not the storage which is the issue but the drain on resources downloading 4mb files. I just need to understand why other people are able to use the OpenAI-hosted URLs even if only temporarily. Thanks.
It’s not a coding issue as the URL is successfully generated…I just need to know why I can’t use it within an IMG tag as other people have done The error on the console is as above - “Server Failed to Authenticate the Request. Make sure the value of Authorization header is formed correctly including the signature” and what the workaround is if any.
Thanks a lot. So just assuming that nobody can help with this and I need to download the image…I’ve just thought that actually how do you do that without needing to pass the API token? As presumably the REST call will only return either b64_json or url so you then need to get the URL via another call - so don’t you hit any public access/security issues?
I have a similar issue. I’m trying to post the image to Instagram but the image cannot be fetched from the URL. Having to download them would add a lot of overhead because I would have to download the image the upload it somewhere to create a public URL and then use that to post to IG.