Google API Key use is an issue

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

I receive this error message: Request ID: 94fdbbe3-ed28-4eb0-a5b2-4758d999f33a
{“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}
Unauthorized User API key
Invalid API key. Unauthorized User API key
ActionRequiredError: Invalid API key. Unauthorized User API key
at Nk1 (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:35723:27236)
at Eag (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:35723:26381)
at Wk1 (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:35724:7469)
at Mag.run (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:35724:12367)
at async zle.runAgentLoop (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:48116:2927)
at async W$g.streamFromAgentBackend (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:48187:13900)
at async W$g.getAgentStreamResponse (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:48187:22728)
at async hut.submitChatMaybeAbortCurrent (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:35854:1970)

Steps to Reproduce

Go to Google Ai Studio, copy your API key, Back to cursor, under settings, Google API key, paste the key you got from Google. Deselect ‘Override OpenAI Base URL…’ . Go to your chat interface, select any of the Gemini models then make a request, you will receive the error message above.

Expected Behavior

It should process your request and make a suggestion as a response.

Screenshots / Screen Recordings

Operating System

MacOS

Version Information

Version: 3.7.42

For AI issues: which model did you use?

Gemini 3.5 Flash or Gemini 3.1 Pro or Gemini 3 Flash

For AI issues: add Request ID with privacy disabled

Unauthorized User API key Request ID: 94fdbbe3-ed28-4eb0-a5b2-4758d999f33a

Does this stop you from using Cursor

Yes - Cursor is unusable

Hey, thanks for the detailed report with the Request ID. The ERROR_BAD_USER_API_KEY error means Google returned a 401 for your key, so the key is being rejected on Google’s side, not by Cursor. All Gemini models fail, including Gemini 2.5 Flash, which points to a key or config issue rather than a specific model.

Let’s go step by step:

  1. Reset the OpenAI Base URL, even if Override is unchecked. Go to Settings → Models → OpenAI → click Reset to default for Base URL → Save → restart Cursor. A stale custom Base URL is the most common cause of this exact error, even for Gemini. Here’s a thread where this fixed it: Getting "Unauthorized User API key" with Custom Gemini Key - Must I be a Pro User?
  2. If you still get 401, recreate the key at https://aistudio.google.com/apikey, paste it with no leading or trailing spaces, make sure Generative Language API is enabled for that key’s project, and remove any API or HTTP referrer restrictions from the key.

If the key passes Verify but you still get 401 on all Gemini models, reply here and we’ll dig deeper.

Hi, pls help, I’ve tried all the methods from the forum related to date and time, but it still doesn’t work. I also tried logging out of the account, but after logging out, I couldn’t even authorize myself on the site. So, I’ll attach the 401 errors I get when trying to authorize below. I’d like to get some help in advance, thank you. Also, please indicate the email address linked to the Cursor account - [email protected]. User is unauthorized Request ID: 6bf89665-7534-4701-a3f9-f6c1eb8257a8 . 0yjefa_nvup70.js?dpl…aNBoSEx4HSRnfufm6:1 POST https://cursor.com/api/dashboard/get-me 401 (Unauthorized) 0ex8y.5gioay..js?dpl…aNBoSEx4HSRnfufm6:1 GET https://cursor.com/api/auth/me 401 (Unauthorized) 081ktw76gr-v9.js?dpl…aNBoSEx4HSRnfufm6:1 GET https://cursor.com/api/auth/get-login-scope 401 (Unauthorized) 0.4v2ebj-b1_8.js?dpl…aNBoSEx4HSRnfufm6:1 POST https://cursor.com/api/dashboard/get-user-privacy-mode 401 (Unauthorized) 0l9al87d7p~sh.js?dpl…aNBoSEx4HSRnfufm6:1 GET https://cursor.com/api/usage-summary 401 (Unauthorized) 0l9al87d7p~sh.js?dpl…aNBoSEx4HSRnfufm6:1 POST https://cursor.com/api/dashboard/get-p2p-referral-status 401 (Unauthorized) 0ex8y.5gioay..js?dpl…aNBoSEx4HSRnfufm6:1 POST https://cursor.com/api/analytics/track-events 401 (Unauthorized) 0ex8y.5gioay..js?dpl…aNBoSEx4HSRnfufm6:1 Failed to track event: 06stmw9xy6h3c.js?dpl…aNBoSEx4HSRnfufm6:1 POST https://cursor.com/api/dashboard/check-user-api-key-access 401 (Unauthorized) 06stmw9xy6h3c.js?dpl…aNBoSEx4HSRnfufm6:1 Failed to check user API key access 0yjefa_nvup70.js?dpl…aNBoSEx4HSRnfufm6:1 POST https://cursor.com/api/dashboard/get-me 401 (Unauthorized) 0.4v2ebj-b1_8.js?dpl…aNBoSEx4HSRnfufm6:1 POST https://cursor.com/api/dashboard/get-user-privacy-mode 401 (Unauthorized) 0l9al87d7p~sh.js?dpl…aNBoSEx4HSRnfufm6:1 POST https://cursor.com/api/dashboard/get-p2p-referral-status 401 (Unauthorized) 0l9al87d7p~sh.js?dpl…aNBoSEx4HSRnfufm6:1 GET https://cursor.com/api/usage-summary 401 (Unauthorized)

Hey Nikita, this looks like a separate issue from the original BYOK topic, and since you can’t sign in to your account at all, our team should handle it directly.

Thanks for reaching out. Account and billing requests are handled by our team at [email protected]. They’ll be able to look into your specific situation.

Thank you Dean Rie! The solution works after several attempts.