Nashex / gpt4-playground

Clone of OpenAI's ChatGPT and Playground environments to enable experimenting with API keys.
https://www.gpt4-playground.com/
MIT License
342 stars 110 forks source link

can ENV use the openai API ? #1

Closed rossman22590 closed 1 year ago

rossman22590 commented 1 year ago

i have my key in env, why wont app us eit?

Nashex commented 1 year ago

Currently, it is set up so that the key is stored on the client side so that was deployable and scalable to the public. However, if you want it to use your env configuration all you would have to do is change this line to pull from the env. You may also want to do some slight refactoring but it should not be more than moving a couple lines.

rossman22590 commented 1 year ago

so change to this? const token = process.env.OPENAI_API_KEY; ??

Nashex commented 1 year ago

Yeah that should work! Just make sure you have pulled down the most recent version.

rossman22590 commented 1 year ago

it worked!