I want to consume APIs of OpenAI through my Front End. But I am only concerned about the security issue of using a Secret Key on the Front End. Is there any workaround to secure Secret Key or Is it possible to access the OpenAI through another way from frontend(React js), so that OpenAI will know that valid users are accessing the platform?
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
You should not store your OpenAI key in your client-side JS code. You should make OpenAI calls from a backend server you control. If you aren’t familiar with servers, I’d suggest taking a look at Firebase Cloud Functions or similar services, Google has several tutorials on how to get started. Make sure you also secure your API once you are up and running.
2 Likes