why would i want my openai key in a frontend project for everyone to steal it?
You don't! As mentioned in the README: "Note: Don't expose your API key in public-facing apps. We will be adding a solution for securely using your API key soon." I have ideas how to implement this, but I would like to get some feedback first.
Here's a proof of concept you can copy: https://pipedream.com/new?h=tch_OknfQd
The link makes a new unique API endpoint that proxies your OpenAI API credentials.
It just accepts a "prompt" argument in the HTTP request, but you can modify as needed.
If it does start to be abused, you can add frontend JWTs to check on this backend.