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
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.
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.
Does using your own OpenAI key not allow the Copilot++ code completion? This is probably what I use most often. The chat features are helpful and why I switched to Cursor instead of VSCode + Copilot, but not having code completion is kind of a dealbreaker. So if using an OpenAI key doesn’t allow Copilot++ for some reason, perhaps you should provide at least base Copilot to these users?
edit: I also verified that my openAI key works to generate test completions, btw.
Yes, Copilot++ (and a few other features) requires a custom model so is not available with an api key.
Got it. If you have any plans to support some sort of Copilot-like feature with an API key, that’d be great. (I’ll probably stop using Cursor otherwise, since I think the Copilot completions are what I value most in an LLM-assisted code editor. But I realize this is probably a niche concern since many of your customers are probably using Pro rather than API keys.)