# Cross-Origin Resource Sharing (CORS)

**URL:** <https://community.openai.com/t/cross-origin-resource-sharing-cors/28905>\
**Category:** API\
**Created:** [January 2, 2023, 12:47am UTC](https://community.openai.com/t/cross-origin-resource-sharing-cors/28905 "2023-01-02T00:47:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jefflevy1970](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/jefflevy1970/32/16110_2.png) [@jefflevy1970](https://community.openai.com/u/jefflevy1970)\
**Post date:** [January 2, 2023, 12:47am UTC](https://community.openai.com/t/cross-origin-resource-sharing-cors/28905/1 "2023-01-02T00:47:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yanson](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/yanson/32/7634_2.png) [@yanson](https://community.openai.com/u/yanson)\
**Post date:** [January 2, 2023, 3:46am UTC](https://community.openai.com/t/cross-origin-resource-sharing-cors/28905/2 "2023-01-02T03:46:22Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jefflevy1970](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/jefflevy1970/32/16110_2.png) [@jefflevy1970](https://community.openai.com/u/jefflevy1970)\
**Post date:** [January 2, 2023, 4:33am UTC](https://community.openai.com/t/cross-origin-resource-sharing-cors/28905/3 "2023-01-02T04:33:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ilya.pukhov](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ilya.pukhov/32/17628_2.png) [@ilya.pukhov](https://community.openai.com/u/ilya.pukhov)\
**Post date:** [January 8, 2023, 6:26pm UTC](https://community.openai.com/t/cross-origin-resource-sharing-cors/28905/4 "2023-01-08T18:26:06Z")

</div>

Same think here. Looking forward for a solution

---

<div class="post-metadata">

**Author:** ![raymonddavey](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/raymonddavey/32/14125_2.png) [@raymonddavey](https://community.openai.com/u/raymonddavey)\
**Post date:** [January 8, 2023, 7:31pm UTC](https://community.openai.com/t/cross-origin-resource-sharing-cors/28905/5 "2023-01-08T19:31:50Z")

</div>

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

> **[Fetch: Cross-Origin Requests](https://javascript.info/fetch-crossorigin)**

And here is a potential fix

> **[How to Make a Fetch Proxy in Javascript to Avoid CORS Errors with APIs](https://kennethscoggins.medium.com/how-to-make-a-fetch-proxy-in-javascript-to-avoid-cors-errors-with-apis-2b93c4ed0e78)**
>
> How many times have you gotten all excited about a new API only to discover that when you try to get the data all you seem to end up with…

and another example

> **[A Simple Cors Proxy for Javascript applications](https://medium.com/nodejsmadeeasy/a-simple-cors-proxy-for-javascript-applications-9b36a8d39c51)**
>
> Sometimes there are use cases when we have to call third party services (APIs) where cors are not allowed or be enabled only for…

---

<div class="post-metadata">

**Author:** ![joliss](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@joliss](https://community.openai.com/u/joliss)\
**Post date:** [January 17, 2024, 9:09pm UTC](https://community.openai.com/t/cross-origin-resource-sharing-cors/28905/6 "2024-01-17T21:09:04Z")

</div>

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](https://api.openai.com/v1/chat/completions) endpoint does.

---

<div class="post-metadata">

**Author:** ![anon22939549](https://avatars.discourse-cdn.com/v4/letter/a/f14d63/32.png) [@anon22939549](https://community.openai.com/u/anon22939549)\
**Post date:** [January 18, 2024, 2:55am UTC](https://community.openai.com/t/cross-origin-resource-sharing-cors/28905/7 "2024-01-18T02:55:23Z")

</div>


