Anthropic (Claude) API Key Not Working in Cursor — Always Returns “Bad User API Key / Unauthorized”

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Bug Description: Anthropic (Claude) API Key Not Working in Cursor

When adding a personal Anthropic Claude API key to Cursor, all Claude model requests fail with the following error:

“Bad User API key / Unauthorized User API key.”

This happens even when the API key is valid, active, and verified to work outside of Cursor using direct API calls. Cursor rejects the key immediately, preventing any Claude-based chat, completion, or agent actions.

The issue occurs regardless of:

  • regenerating new Anthropic API keys
  • restarting Cursor
  • confirming that billing is active
  • verifying that the API key is copied exactly as shown

Cursor’s built-in Claude access still works, but custom Anthropic API keys cannot be used, blocking users from leveraging their paid Anthropic API subscriptions inside Cursor.

This appears to be a Cursor-side validation or integration issue where valid Anthropic keys are incorrectly treated as unauthorized.

Steps to Reproduce

Steps to Reproduce

  1. Open Cursor.

  2. Go to Settings → API Keys.

  3. Enable the toggle: Use my own Anthropic (Claude) key.

  4. Paste a valid Anthropic API key (sk-ant-...) from the Anthropic Console.

  5. Open a new chat and switch the model to Claude 3.5 Sonnet / Claude 3.5 Haiku.

  6. Send any message (e.g., “Hello”).

  7. Cursor immediately returns the error:

    “Bad User API key / Unauthorized User API key.”

  8. Regenerating new keys, restarting Cursor, or re-entering the key produces the exact same error.

Expected Behavior

Expected Behavior

Cursor should:

  • Accept the valid Anthropic key
  • Authenticate properly with Anthropic’s API
  • Allow the user’s own Claude subscription to be used
  • Enable Claude models within Cursor (chat, agents, codegen)

Users should see normal Claude responses—not authentication errors.

Screenshots / Screen Recordings

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.1.49 (user setup)
VSCode Version: 1.105.1
Commit: 21a2ed198584d56a91c0b996d1a09c93f8538440
Date: 2025-12-05T07:49:06.016Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Windows_NT x64 10.0.22621

For AI issues: which model did you use?

Sonnet 4.5, opus 4.5,

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report.

It looks like you’ve hit a known bug with the “Override OpenAI Base URL” toggle, which breaks Anthropic requests and returns “Bad User API key / Unauthorized.” Confirmation and workaround here:

What to try now:

  • Settings → Models → API Keys → turn off Override OpenAI Base URL
  • Make sure it didn’t turn itself back on after a request
  • Restart Cursor, open a new chat, select a Claude model, and try again

If the issue remains, please send:

  • The Request ID from the chat menu at the time of the error
  • A screenshot of Settings → Models → API Keys with the toggles visible
  • The exact error text and a screenshot
  • Console logs from Help → Toggle Developer Tools → Console
  • Confirmation that Override OpenAI Base URL is definitely off

I’ll add your details to the ongoing fix. Let me know if the workaround helps.

Hey! That was really helpful. I’m running into a new error after following your steps. After looking into it more, it seems like the Anthropic key is still being sent to the OpenAI API URL. Here’s the error I’m seeing:

Request ID: 0e63e67e-f32c-454a-8553-a41f829c0db5

{“error”:“ERROR_OPENAI”,“details”:{“title”:“Unable to reach the model provider”,“detail”:"We encountered an issue when using your API key: Provider was unable to process your request\n\nAPI Error:\n\n```\nRequest failed with status code 404: {\“type\”:\“error\”,\“error\”:{\“type\”:\“not_found_error\”,\“message\”:\“model: claude-4.5-sonnet\”

I also restarted and reloaded cursor. If this is a bug, I would this this would be a priority to address. I can’t imagine I am the only having this issue and wanting to use claude without eating up my tokens.

Just wanted to add that this is happening for me as well now too. The original error, and I never had a base URL change or anything.

Specifically, my instance is that I have an OpenAI API key, enabled, I use Cursor Pro +, and I’m trying to use Opus 4.5 through Cursor (thus, my Open AI API key shouldn’t be being used). However, I’m getting an error and thus is breaking. Adding my Request ID down below and my screenshot

Here’s my request ID:Request ID: 1d0d8410-fa9a-4093-89cc-932df1bcf3e2
{“error”:“ERROR_BAD_USER_API_KEY”,“details”:{“title”:“Bad User API key”,“detail”:“Unauthorized User API key”,“isRetryable”:false,“additionalInfo”:{},“buttons”:,“planChoices”:},“isExpected”:true}
ConnectError: [unauthenticated] Error
at _Gc.$endAiConnectTransportReportError (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:12155:455960)
at lBo._doInvokeHandler (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:12807:22831)
at lBo._invokeHandler (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:12807:22573)
at lBo._receiveRequest (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:12807:21335)
at lBo._receiveOneMessage (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:12807:20152)
at $Lt.value (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:12807:18244)
at Ee._deliver (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:49:2962)
at Ee.fire (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:49:3283)
at Cvt.fire (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:12140:12156)
at MessagePort. (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:14806:18433)

I have my pro claude api key. I added it to the anthropic api key field on the cursor model setting page. If I select opus 4.5 model, and run the agent, then I see this error.
My OS is Windows 11 and I am using updated cursor app.