Custom Key Validation Error in Cursor

Hi, thanks for reporting an issue with Cursor.

Before you report this, we’d appreciate if you can search this forum to see if this issue has already been reported.

If you have done so, please check this box.
on

Describe the Bug

Trying to add a custom key in settings returns “Invalid OpenAI API Key” and this check:

$headers = @{
“Content-Type” = “application/json”
“Authorization” = “Bearer sk-proj-**********”
}

$body = @{
“messages” = @(
@{
“role” = “system”
“content” = “You are a test assistant.”
},
@{
“role” = “user”
“content” = “Testing. Just say hi and nothing else.”
}
)
“model” = “claude-3.5-sonnet”
} | ConvertTo-Json

Invoke-WebRequest -Uri “https://api.openai.com/v1/chat/completions” -Method Post -Headers $headers -Body $body

The request is wrong (uses a claude model). Cursor will not let the user add a key if it cannot validate it.

Steps to Reproduce

Go to settings, enter a valid OpenAI API Key, click verify.

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

Version: 0.44.9
VSCode Version: 1.93.1
Commit: 316e524257c2ea23b755332b0a72c50cf23e1b00
Date: 2024-12-26T21:58:59.149Z
Electron: 30.5.1
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631

Additional Information

n/a

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, try disabling all models that aren’t related to the OpenAI API. That should help. We are working on a fix in the meantime!