@Henrique Souza It seems like you are encountering a CORS error when trying to access the OpenAI API. This error occurs because the API is hosted on a different domain than your web application, and the browser is blocking the request due to security reasons.
To resolve this issue, you can either use a proxy server to make the API request on behalf of your web application, or you can configure the API server to allow requests from your domain.
In your code, you can add the following header to allow requests from your domain:
headers.append("Access-Control-Allow-Origin", "*");
This header will allow requests from any domain, but you can also specify a specific domain if you prefer.
If you are using a proxy server, you can configure your fetch request to use the proxy server instead of directly accessing the API.