I have create a API key ,but when I verifing it can’t work and feedback a error:Failed to fetch error.
info:(status code 0)
TypeError: Failed to fetch
curl https://api.openai.com/v1/chat/completions -H “Content-Type: application/json” -H “Authorization: Bearer sk-proj-XXXXX” -d “{ "messages": [ { "role": "system", "content": "You are a test assistant." }, { "role": "user", "content": "Testing. Just say hi and nothing else." } ], "model": "gpt-4o-mini" }”
How can I fix it
2 Likes
Hey, sorry you’re having issues getting your API key working!
Does the curl command suggested by Cursor work when you run it in your own terminal?
alyapin
4
Hello!
I have the same issue, curl command response is 200.
Hi,
Did you find a solution to this problem? I’m facing the same issue
Thanks!
Hey, try clearing the cache or reinstalling Cursor, as everything works fine on a clean installation. I’ve checked.