Nemoden / gogpt

ChatGPT CLI
MIT License
54 stars 2 forks source link

API key from environment variable [enhancement] #5

Open gsmitheidw opened 1 year ago

gsmitheidw commented 1 year ago

I have exported my API key in bash as OPENAI_API_KEY="sk***"

Alternatively, you can provide a token using environment variable OPENAPI_API_KEY. How to set it depends on your shell, i.e. 

- for bash shell, add export OPENAPI_API_KEY=<your-api-key> to your ~/.bash_profile

It might be nice to support OPENAI_API_KEY name as that is the default set out by openai. This in particular for those who already have the openai package on their system for other purposes. Workaround is easy though:

export OPENAPI_API_KEY=$OPENAI_API_KEY

Nemoden commented 1 year ago

@gsmitheidw ouch! Thank you for this. This is a typo. It meant to be openAI, not openAPI. Thank you for picking this up, will be fixed in the next release!