API Key Trouble

I am getting the following error:

{
message: ‘Incorrect API key provided: “sk-e4IG******************************************gQ”;. You can find your API key at https://beta.openai.com.’,
type: ‘invalid_request_error’,
param: null,
code: ‘invalid_api_key’
}

The key I have is good. The playground works, and I am even able to build finetunes. I was working with this key for hours training a chatbot. Then I took break for a couple of hours and when I came back, nothing was working.

I have tried creating a new key, but it doesn’t help. Any advice?

  • flush cache, shut down the IDE, and try again.
  • Check if the API key is inserted properly via .env vars
  • Check your code flow using debug feature

I’m going to reboot everything and see what happens. But I want to point out that the apikey in that error message is coming from the openai endpoint., and it appears to by my key (asterisks not withstanding.) They key is definitely getting to the server. aaaaaand… no dice :frowning: Still not working.

Gah. See that semicolon after the key? It doesn’t belong there. It’s working again.

1 Like

damn, haha.
Been there lol, I was stuck on an API error for 2 days. It was just one variable :slight_smile:

facing the same on website, did you find the solution?

1 Like

Same issue today. I have tried creating a new account, relogging, deleting cache, almost everything…

I’m having the same issue right now too. Worked when I went to bed last night, no changes in the code…doesn’t work today. Tried creating new API keys, nothing works.

Having the same issue here, re-log and cache clearing did not help.

Certainly there must be something more to this than just clearing cache and restarting browser. I’m having the same issue. The error message with the partial API key does not match the one I generated in my account. I’m running into this issue on the image generation website. Is there any other resolution to getting this to work? i have purchased credits that will expire and I cannot use Dall-E-2.

Thanks.

Same issue here. I put the API in and I get the same error.

Same issue here. Someone find a solution? It is working for my husband’s account but not for mine? We create our account today

Same here! Maybe it is a problem with the API

Same here,
“error”: {
“message”: “Incorrect API key provided: sk-eXBr0***************************************PQrq. You can find your API key at https://beta.openai.com.”,
“type”: “invalid_request_error”,
“param”: null,
“code”: “invalid_api_key”
}

+1, definitely a problem with their API. I minted a brand new key and just used the CURL example from the completion endpoint and got the same error.

$ curl https://api.openai.com/v1/completions   -H "Content-Type: application/json"   -H "Authorization: Bearer $OPENAI_API_KEY"   -d '{
  "model": "text-davinci-003",
  "prompt": "Translate this into 1. French, 2. Spanish and 3. Japanese:\n\nWhat rooms do you have available?\n\n1.",
  "temperature": 0.3,
  "max_tokens": 100,
  "top_p": 1,
  "frequency_penalty": 0,
  "presence_penalty": 0
}'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   538  100   280  100   258   1075    990 --:--:-- --:--:-- --:--:--  2077{
    "error": {
        "message": "Incorrect API key provided: sk-MY7LJ***************************************8qrE. You can find your API key at https://beta.openai.com.",
        "type": "invalid_request_error",
        "param": null,
        "code": "invalid_api_key"
    }
}
2 Likes

I think we’ve only got THREE threads on this now. :wink:

3 Likes

aaaand we are back! Just ran the exact same curl from y’day and it works perfectly now.

OpenAI Status doesn’t show any hiccups y’day though :man_shrugging:

1 Like

same issue here today
I generated the API key and as soon as I used it
It throws an error that:
ChatGPTError: ChatGPT error 401: {
“error”: {
“message”: “Incorrect API key provided: sk-R7aMV***************************************oKYo. You can find your API key at OpenAI API”,
“type”: “invalid_request_error”,
“param”: null,
“code”: “invalid_api_key”
}
}

I used the first key I created and found it was accessible, but the newly generated key was still unavailable

@jayadityanautiyal07 there is no such thing as a “ChatGPT Error”, no clue where you are getting this message from, mind sharing?

1 Like

Logan, I have not used this, and have just become aware of it

However, it is a top hit if you search for ChatGPT API

There may be a level further down as this looks like a node wrapper. I haven’t got the time to have a look right now. Here is a second link

1 Like