Hello @Rao, Vinod (CTR) HHHH
Thanks for reaching out to us, you can find the key by going to your resource in the Azure portal. The Endpoint and Keys can be found in the Resource Management section. Copy your endpoint and access key as you'll need both for authenticating your API calls. You can use either KEY1
or KEY2
. Always having two keys allows you to securely rotate and regenerate keys without causing a service disruption.
Then you need to create and assign persistent environment variables for your key and endpoint before you run the line - openai.api_key = os.getenv("OPENAI_API_KEY") You need to save it to your Environment variables, please open your command line and run below, replace with your key value -
setx OPENAI_API_KEY "REPLACE_WITH_YOUR_KEY_VALUE_HERE"
You can also use PowerShell as below -
[System.Environment]::SetEnvironmentVariable('OPENAI_API_KEY', 'REPLACE_WITH_YOUR_KEY_VALUE_HERE', 'User')
Please let me know if you need more help, we are happy to help you further.
Regards,
Yutong
-Please kindly accept the answer and vote 'Yes' if you feel helpful to support the community, thanks a lot.