How to store my ChatGPT API Keys securely?

I made a sweet little ChatGPT Widget with Javascript …but don’t want to store my personal OpenAI key in the .js file.

can I use Variables in js files somehow?



@Pakic may I kindly ask you: any ideas, still need help before I can take this live…

Website is

Thanks a lot in advance



It’s not possible in the JavaScript, if you make it that way, everyone will see it.

Only using REST API you can make HTTP requests with secret keys and be safe that no-one will see them.

Hey Stefan @Pakic,

thanks for the answer, good point!

I’ll now try to do just that. What’s the best way to connect my Javascript with the divhunt rest api plugin/module?
I need to figure out how to get information out of the the divhunt system via Javascript.

Are there any previously recorded videos or documentation that come to your mind?

Thank you thank you thank you!!


PS: I love what you and the team built. I have a lot to learn but it went all well, so far.

Hi, also looking forward to getting tutorials on how to use REST API with javascript to send data outside Divhunt securely.
@dejan any documentation we could look at?