Cross-Origin Resource Sharing (CORS)

Hello is there an easy way to solve a Cross-Origin Resource Sharing (CORS)" error? Any advice would be greatly appreciated.

2 Likes

i’m also trying to work through a cors issue. what exactly are you trying to do, and what action in particular is triggering the error?

I’m simply trying to get a simple form to interface with the API. I’m using JavaScript. I am looking for information on how to configure the server or another method completely to interface with the API that doesn’t have to deal with the CORs issue.

Same think here. Looking forward for a solution

The only way I know of to get around the COR issue right now is to use a rely or proxy server to make the final request. So your code refers to a local host on a different port (5000 seems a common choice) and the service running on that port makes the request with the API key for you.

I know that you can turn off COR at the server end, but OpenAI will probably not do that.

Here is some info on why you get the error

And here is a potential fix

and another example

1 Like

In case anybody else comes to this thread on Google to see if OpenAI supports CORS, the answer is that yes, OpenAI does seem to support CORS now. Or at least the https://api.openai.com/v1/chat/completions endpoint does.