I am doing this short course on my Laptop, I have this Error “OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable”.
How can I get an API_KEY in OpenAI to use Whisper?
Welcome to the community.
In order to run the lab locally, you have to use your own API key
In this line
openai.api_key = os.environ[‘OPENAI_API_KEY’]
I have no idea how to get my OPENAI_API_KEY and add it to my environment variables on my MAC. I think this way the above instruction will work.
How can I see my full API Key in https://help.openai.com/en/articles/4936850-where-do-i-find-my-api-key ?
Summary to date
I have a MAC and Command lines I type
putenv. (it show me all the environment variables on my MAC and it displays me the OPENAI_API_KEY)
On my JupyterLab execute
from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv()) # read local .env file
env = os.environ.copy()
print(env) (it doesn’t display the environment variable OPENAI_API_KEY )
so this instruction is Error
openai.api_key = os.environ[“OPENAI_API_KEY”]
Do you have any ideas to help me or any suggestions?
The dotenv package handle the API keys available on the course envirioment witch is not show on the course platform for security reasons.
Instead of use the dotenv package approach you can hardcoded your API key directly on your notebook.
I use my API key directly in my notebook in openai.api_key and it return this OpenAIError:
OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
Looks like open ai handle the API Key differently.
Well i found this documentation regards de Open AI API Key process
I have followed the next steps:
2) Install the OpenAI Python Library
3)Setup you API key for all projects
4)Making an API request and return this message:
‘You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.’, ‘type’: ‘insufficient_quota’, ‘param’: None, ‘code’: ‘insufficient_quota’}}
I don’t know what I have to do, because:
- I have configured my credit card in the OpenAI account.
- I have configured the Usage Limits
- I don’t have any idea if I have to do something on the Pay as you go section because I was using “Tier free”