I'm trying to use the OpenAI library (https://github.com/orhanerday/open-ai) which uses environment variables for key storage, but when I run it it doesn't seem to be able to find the key.
On my local Windows machine, I ran the following command: setx OPENAI_API_KEY "mykey"
On the Linux web server, I ran the following command: export OPENAI_API_KEY=mykey
Now when I run the following command on the server I see the correct key value printed back to me: printenv OPENAI_API_KEY
In my script I use $open_ai_key = getenv('OPENAI_API_KEY');
but I don't get any value..??
Any information on how to resolve this issue would be greatly appreciated. Thanks!
Thank you for using orhanerday/OpenAI PHP SDK,
Let’s try setting the “OPENAI_API_KEY” environment variable through the control panel
Open System Properties and select Advanced System Settings
Select environment variables...
Select "New..." from the "User Variables" section (top). Add your name/key-value pair, replacing it with your API key.
After running the application, you should get the value.