Hacker News new | ask | show | jobs
by anonzzzies 1187 days ago
Thanks, it is good :) You don’t need the serverside though; you can just call openai apis straight from the client. Makes things easier!
2 comments

It seems to support both? First it tries to load the key from a environment variable, and if it cannot, it'll ask for it client-side.

None the less, if you're building a project for others, you most likely don't want the secret key to be public, which it'd be if you embed it in the client-side code.

> It seems to support both?

Ah, only saw the api one!

If you call the openai API's straight from the FrontEnd, you are likely leaking your api keys to visitors who can then use your api keys (and api key limits) for their own purposes.
Nah, you ask them to enter their own; if you use yours, then yes, only use backend. In this case, the author is not using his, you have to bring your own, so frontend is fine.