Cross-Origin Resource Sharing (CORS)

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