Unauthorized User API key - OpenRouter + Anthropic API Key

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Hi. I am using the latest version of the program.

When I select the Sonnet 4.5 model, I get an “Unauthorized User API key” error. If I enter the path from OpenRouter as “anthropic/claude-sonnet-4.5”, I get an “Unauthorized User API key” error. When I disable the Override OpenAi URL feature, the standard Sonnet 4.5 model starts working.

Steps to Reproduce

  1. Specify the API key from OpenRouter
  2. Enable and specify the OpenRouter URL https://api.openai.com/v1
  3. Enable the Antropic key usage
  4. Select the Sonnet 4.5 model
  5. Get the “Unauthorized User API key” error
  6. Disable the OpenRouter URL
  7. The Sonnet 4.5 model starts working

The anthropic/claude-sonnet-4.5 model with OpenRouter URL enabled does not work.

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.0.77 (system setup)
VSCode Version: 1.99.3
Commit: ba90f2f88e4911312761abab9492c42442117cf0
Date: 2025-11-13T23:10:43.113Z
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.19045

For AI issues: which model did you use?

Sonnet 4.5

For AI issues: add Request ID with privacy disabled

Request ID: f72efa66-5cfa-4256-a53e-89b048ba684d
{“error”:“ERROR_BAD_USER_API_KEY”,“details”:{“title”:“Bad User API key”,“detail”:“Unauthorized User API key”,“isRetryable”:false,“additionalInfo”:{},“buttons”:,“planChoices”:},“isExpected”:true}

Does this stop you from using Cursor

No - Cursor works, but with this issue


No Work Claude 4.5

WorkClaude 4.5

Hey, thanks for the report. OpenRouter is not officially supported in Cursor right now - this is a known limitation. When you enable “Override OpenAI Base URL” with OpenRouter, Cursor sends malformed requests, which is why you see authentication errors.

Supported BYOK providers:

  • OpenAI
  • Anthropic
  • Google
  • Azure OpenAI
  • AWS Bedrock

The team is aware of the OpenRouter issue and is working on proper support for custom OpenAI‑compatible endpoints, but there’s no concrete timeline yet.

For now, the most reliable option is to use a direct Anthropic API connection.

1 Like