BYOK: API Key cannot saved

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

I’m in Cursor Pro+.
Even if I set the API key in the Models tab, it behaves the same as when no API key is set. The API key does not seem to be actually saved; when I move to another screen and return, the API key has been deleted. I have confirmed this issue with OpenAI, Anthropic, and Google.

This article is outdated, and the Save button is not present in the current version.

Steps to Reproduce

Settings > Models > API keys > Enter some API key (with no save button) → It is not actually saved.

Expected Behavior

APi key saved successfully, and use models via BYOK.

Screenshots / Screen Recordings

Operating System

Windows 10/11

Version Information

3.18.25 (system setup) in Windows11
same ver in macOS

For AI issues: which model did you use?

All OpenAi/Claude/Google Models

Does this stop you from using Cursor

Yes - Cursor is unusable

Hey @Senna4646, thanks for the report, and sorry for the confusion here.

Your keys are probably being saved! The API key field is write-only for security, so after you enter a key, the box always goes back to looking empty. The “Secret saved” label above the field (visible in both of your screenshots) confirms that the key is stored, so no separate save button is needed.

Can you confirm what behavior you’re running into that leads you to believe the keys aren’t being stored? A specific error message when you run a request?

Although you mentioned that it is stored internally even if it is not displayed in the Input, the following error occurs with both Anthropic and Google. I have confirmed that the same key works with Vercel AI Gateway and API requests.

Unauthorized User API key

```
Request ID: 66f5e725-26d0-4bc1-8d4e-01c46fc5001b
{“error”:“ERROR_BAD_USER_API_KEY”,“details”:{“title”:“Invalid API key.”,“detail”:“Unauthorized User API key”,“isRetryable”:false,“additionalInfo”:{},“buttons”:,“planChoices”:,“analyticsMetadata”:{“actionRequired”:“config”}},“isExpected”:true}
Invalid API key. Unauthorized User API key
ActionRequiredError: Invalid API key. Unauthorized User API key
at nkf (vscode-file://vscode-app/c:/Program%20Files/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:8031:131265)
at lqs (vscode-file://vscode-app/c:/Program%20Files/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:8031:130104)
at Ekf (vscode-file://vscode-app/c:/Program%20Files/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:8032:13645)
at Object.classify (vscode-file://vscode-app/c:/Program%20Files/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:8032:17843)
at _kf (vscode-file://vscode-app/c:/Program%20Files/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:8032:5924)
at async Sqs.run (vscode-file://vscode-app/c:/Program%20Files/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:8032:17165)
at async vce.runAgentLoop (vscode-file://vscode-app/c:/Program%20Files/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:8132:34413)
at async rRo.streamFromAgentBackend (vscode-file://vscode-app/c:/Program%20Files/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:17489:17224)
at async rRo.getAgentStreamResponse (vscode-file://vscode-app/c:/Program%20Files/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:17489:36143)
at async YIe._submitChatMaybeAbortCurrent (vscode-file://vscode-app/c:/Program%20Files/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:8110:4529)
at async YIe.submitChatMaybeAbortCurrent (vscode-file://vscode-app/c:/Program%20Files/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:8105:67958)
at async hi (vscode-file://vscode-app/c:/Program%20Files/cursor/resources/app/out/vs/workbench/workbench.desktop.main.js:14170:93636)
```

Hey @Senna4646, thanks for sending the Request ID, that helped a lot.

There are two different things going on here.

Google: with your own Google key, Gemini 3.8 Flash requests currently fail with “Unauthorized User API key” even though the key itself is fine. This is on our side and I have raised it with the team. Until it is fixed, either pick another Gemini model with your key (Gemini 3.7 Flash and Gemini 3.1 Pro both work), or turn the Google API Key toggle off so Gemini 3.8 Flash runs on your Pro+ plan, which I can see is working for you now.

Anthropic: the request you shared went to Anthropic with your key attached, and Anthropic itself replied “API key is invalid”. So the key is being stored and sent, but Anthropic is not accepting it. You mentioned the key works through Vercel AI Gateway. If that key was created in Vercel rather than in the Anthropic console, Anthropic will reject it when we send it to them directly. Could you try this:

  1. Go to https://console.anthropic.com and create a new API key (it starts with sk-ant-).
  2. In Cursor Settings > Models > API Keys, paste it into the Anthropic API Key field and make sure the toggle next to it is on.
  3. Open a new chat, pick a Claude model, and send a message.