Keeping your API credentials a secret is a well known fact among all developers, but we have seen a fair share of new developers that may not be familiar or do not understand this concept to its full extent.
Every tutorial always cites the fact the you need to use your API key but it always let it for the developer to figure the best way to secure it.
A good start is from taking a look at this guide by OpenAI on best practices: https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety Thanks @sonic raptor for pointing that.
This is a tutorial that will cover the most common occurrence of a grave mistake: packing the API Key on the client side.
No matter what you do, the access to credentials of your OpenAI Account should never be part of the client package. Doing so allows to malicious people to steal your APIKey and cause all sorts of problems to you, ranging from wasting your money to intentionally misusing your account, risking getting you banned.
A lot of people who just want to share their fun creations / side projects don't have a real concern for the usage limits, this is easily solvable by setting a quota on the usage panel: https://beta.openai.com/account/usage
Some may want to go even further in the security and have a well defined whitelist or authentication methods to prevent anyone from ever using your OpenAI access from any methods that are not your account.
For any use case, you can take this as a basic example of how to set up a proxy on Cloudflare for free.
Lets get started!
