4 ms·
It looks like user@dom**.tld is actually what you set as your key. I can generate the same error by setting OPENAI_API_KEY="this is wrong"; chatblade test op
by ramblerman 4y ago
It looks like user@dom**.tld is actually what you set as your key.
I can generate the same error by setting
OPENAI_API_KEY="this is wrong"; chatblade test
openai.error.AuthenticationError: Incorrect API key provided: this is *rong. You can find your API key at https://platform.openai.com/account/api-keys https://platform.openai.com/account/api-keys.
if you run
echo $OPENAI_API_KEY
you should see your key which starts with sk-......... If not thats where your issue is
- lynx23 4y agoThat is what is strange about it, OPENAI_API_KEY is set correctly, and start with sk- So I wonder where it is getting this email from.
- ramblerman 4y agocan you try: curl https://api.openai.com/v1/completions https://api.openai.com/v1/completions -H "Content-Type: application/json" -H "Authorization: Bearer $OPENAI_API_KEY" -d '{ "model": "text-davinci-003", "prompt": "Say this is a test", "max_tokens": 7, "temperature": 0 }'
- lynx23 4y agoYes, this works. So my api key is valid. But something in chatblade or the python packages it depends on trashes the input I provide, and replaces it with an email address of mine. Sounds weird, but is apparently true.
- ramblerman 4y agoIts not doing anything special that could "trash" the input. In fact no other env variables are read at all. So the fact that you are seeing your email, is a pretty strong indication that it is being set by you somewhere. Where else could it even get it from? An other option is that you passed your email as a parameter mistakingly (which takes precedence over the env variable) But the code is really pretty simple. https://github.com/npiv/chatblade/blob/4ce28739ca7ada161102917ad256d3db61026392/chatblade/cli.py#L17 https://github.com/npiv/chatblade/blob/4ce28739ca7ada1611029...
- lynx23 4y agoI know, I took a look at the code. I even replaced get_openai_key(params) with a hardcoded return "sk-redacted" and still no luck. I guess the bug must be in the openai python package, but I cant find it either. However, rest assured I am not providing this email anywhere manually...
- lynx23 4y agoFound it! I need to set NETRC=/dev/null. It appears the request library is trying to grab auth info from .netrc, and in my case, picks the default entry. Why it is doing that despite an api key being provided is unclear.
- matzf 4y agoThe openapi library seems to use requests incorrectly. > If no authentication method is given with the auth argument, Requests will attempt to get the authentication credentials for the URL’s hostname from the user’s netrc file. The netrc file overrides raw HTTP authentication headers set with headers. Source: https://docs.python-requests.org/en/latest/user/authentication/#netrc-authentication https://docs.python-requests.org/en/latest/user/authenticati...