My OpenAI API Key isn't working in Cursor?

My OpenAI Key isn’t working in Cursor?

Please make sure that your API key was an OpenAI API key generated from here.

Then, please verify that your API key is properly funded. To test this, you can run this curl command, replacing YOUR_API_KEY_HERE:

curl https://api.openai.com/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_API_KEY_HERE" -d '{
  "messages": [
    {
      "role": "system",
      "content": "You are a test assistant."
    },
    {
      "role": "user",
      "content": "Testing. Just say hi and nothing else."
    }
  ],
  "model": "gpt-3.5-turbo"
}'

To test that you have access to GPT-4, you can run this command:

curl https://api.openai.com/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_API_KEY_HERE" -d '{
  "messages": [
    {
      "role": "system",
      "content": "You are a test assistant."
    },
    {
      "role": "user",
      "content": "Testing. Just say hi and nothing else."
    }
  ],
  "model": "gpt-4"
}'

If you’re trying to use GPT-4 with an API key and are having issues, make sure to try this:

This doesn’t work for me, is there any way to overwrite this setting somewhere? I am trying to use GPT-4 with my own API key

Same issue here.

Same here…


Just in case…After adding your token make sure you press return or click the → button
I didn’t do that the first time and my OpenAI key wasn’t added
The second time I added it ‘correctly’ and I got the “using key” option

1 Like

I’ve already tried that. Nothing works. On the other hand, the CURL command gives me the same error. However, my API key is generated at this address: OpenAI Platform

Your error is right there => “You exceeded your current quota, please check your plan and billing details.”

You probably don’t have any active credits in your OpenAI account.

1 Like

I thought I’d read that it was possible and sufficient.

So I should pay in addition to my chatGPT subscription to get credits to use the openAI API?

Yes. The ChatGPT+ subscription and OpenAI API credits are two different things.

1 Like