Why using api key is impossible?

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Where does the bug appear (feature/product)?
Cursor IDE

Describe the Bug
Request failed with status code 400: [{
“error”: {
“code”: 400,
“message”: “Invalid JSON payload received. Unknown name “top_k”: Cannot find field.”,
“status”: “INVALID_ARGUMENT”,
“details”: [
{
@type”: “type.googleapis.com/google.rpc.BadRequest”,
“fieldViolations”: [
{
“description”: “Invalid JSON payload received. Unknown name “top_k”: Cannot find field.”
}
]
}
]
}
}
]

I am cursor ultra user and was using gemini pro 3 all day and this happens now. I know openai top_k format and gemini topK format is different . cursor sening it openai format in gemini and error happens.

Steps to Reproduce

just sayıng hi

Expected Behavior

Answering

Screenshots / Screen Recordings

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.1.7 (Universal)
VSCode Version: 1.105.1
Commit: 3d2e45538bcc4fd7ed28cc113c2110b26a824a00
Date: 2025-11-20T18:51:07.967Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 24.6.0

For AI issues: which model did you use?

Gemini 3 pro preview

Does this stop you from using Cursor

Yes - Cursor is unusable

3 Likes

it looks like a bug. Have the same problem.

Was able to fix it:

  1. remove all other models
  2. make sure only Google API is turned on (everything else is off, like OpenAI api and OpenAI override)
  3. change the model name to a full name: “google/gemini-3-pro-preview”
  4. Makes sure “Max” and “Auto” modes are turned off in the agent selection (in the chat dialog)
2 Likes

@SergioV currently facing the same issue while using the gemini api key from Google ai studio. I made sure everything else is correct , this key was working fine couple of hours ago but not it is not?? also i have generated new key and tried again but got the same issue.

what should i do to resolve this?

1 Like

Confirming this worked! I also toggled each of the switches just in case (OpenAI/Anthropic API/etc.)

Steps above did get the model working but it unfortunately won’t utlilize the Google API key from AI Studio (will charge Cursor tokens).

1 Like

this is working for me now.. but i know its unstable. i am afraid to update cursor now. i realized its happened after i update cursor.

ran into the same issue and this seemed to work - thanks! hope they can fix this soon lol

1 Like

Did you downgrade? Are you using a AI Studio key?

not downgrade just follow instructions of SergioV, but now i am getting overload error..

same issue

Same issue, it’s urgent can confirm

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Request failed with status code 400: [{
“error”: {
“code”: 400,
“message”: “Invalid JSON payload received. Unknown name "top_k": Cannot find field.”,
“status”: “INVALID_ARGUMENT”,
“details”: [
{
@type”: “type.googleapis.com/google.rpc.BadRequest”,
“fieldViolations”: [
{
“description”: “Invalid JSON payload received. Unknown name "top_k": Cannot find field.”
}
]
}
]
}
}
]

i am getting this error from last 5 hours, Not able to use cursor due to this

I am using gemini 3.0 tier 1 api key , which is working fine , i have curled the model and i am getting response from the model. But if i select gemini 3.0 pro , using the ai studio key in the cursor settings, i am getting this error.

Steps to Reproduce

Go to api keys, enable gemini api key, then go to models select gemini 3.0 pro , if you prompt the model you will get this error

Expected Behavior

I think so the top_k parameter is causing this issue.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.0.77
VSCode Version: 1.99.3

For AI issues: which model did you use?

Model Name : Gemini 3.0 Pro

For AI issues: add Request ID with privacy disabled

Request ID: 4bfde241-6aa2-4156-b291-affcfacf0152
{“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 400: [{\n \"error\": {\n \"code\": 400,\n \"message\": \"Invalid JSON payload received. Unknown name \\\"top_k\\\": Cannot find field.\",\n \"status\": \"INVALID_ARGUMENT\",\n \"details\": [\n {\n \"@type\": \"type.googleapis.com/google.rpc.BadRequest\",\n \"fieldViolations\": [\n {\n \"description\": \"Invalid JSON payload received. Unknown name \\\"top_k\\\": Cannot find field.\"\n }\n ]\n }\n ]\n }\n}\n]\n”,“additionalInfo”:{},“buttons”:,“planChoices”:},“isExpected”:true}
ConnectError: [invalid_argument] Error
at QJc.$endAiConnectTransportReportError (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:4989:399336)
at Ywo._doInvokeHandler (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:492:36007)
at Ywo._invokeHandler (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:492:35749)
at Ywo._receiveRequest (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:492:34514)
at Ywo._receiveOneMessage (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:492:33336)
at GDt.value (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:492:31429)
at _e._deliver (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:49:2962)
at _e.fire (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:49:3283)
at ggt.fire (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:4974:12156)
at MessagePort. (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:7498:18439)

Does this stop you from using Cursor

Yes - Cursor is unusable

2 Likes

No it doesn’t solve it at all – this just switches back to the Cursor-provided access. The problem concerns the direct API access.

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

NOTE: I reopen a topic because the other conversation is marked as solved, yet it is NOT solved – the proposed solution only switches back the usage to the Cursor-provided usage, and the Gemini API key remains unusable.
Falsely solved conversation: Cursor activity bar can't be hidden

When I try to use Gemini 3 Pro via Google’s API, I always get this but (for the last 12 hours or so)

Request failed with status code 400: [{
“error”: {
“code”: 400,
“message”: “Invalid JSON payload received. Unknown name “top_k”: Cannot find field.”,
“status”: “INVALID_ARGUMENT”,
“details”: [
{
@type”: “type.googleapis.com/google.rpc.BadRequest”,
“fieldViolations”: [
{
“description”: “Invalid JSON payload received. Unknown name “top_k”: Cannot find field.”
}
]
}
]
}
}
]

Steps to Reproduce

any request sent in agent mode

Expected Behavior

Answering to the request

Screenshots / Screen Recordings

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.0.77 (Universal)
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: Darwin arm64 23.4.0

For AI issues: which model did you use?

Gemini 3 Pro

For AI issues: add Request ID with privacy disabled

Request ID: 90cc7002-9767-4361-a6bf-590504b8d356
{“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 400: [{\n \"error\": {\n \"code\": 400,\n \"message\": \"Invalid JSON payload received. Unknown name \\\"top_k\\\": Cannot find field.\",\n \"status\": \"INVALID_ARGUMENT\",\n \"details\": [\n {\n \"@type\": \"type.googleapis.com/google.rpc.BadRequest\",\n \"fieldViolations\": [\n {\n \"description\": \"Invalid JSON payload received. Unknown name \\\"top_k\\\": Cannot find field.\"\n }\n ]\n }\n ]\n }\n}\n]\n”,“additionalInfo”:{},“buttons”:,“planChoices”:},“isExpected”:true}
ConnectError: [invalid_argument] Error
at QJc.$endAiConnectTransportReportError (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:4989:399336)
at Ywo._doInvokeHandler (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:492:36007)
at Ywo._invokeHandler (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:492:35749)
at Ywo._receiveRequest (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:492:34514)
at Ywo._receiveOneMessage (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:492:33336)
at GDt.value (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:492:31429)
at _e._deliver (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:49:2962)
at _e.fire (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:49:3283)
at ggt.fire (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:4974:12156)
at MessagePort. (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:7498:18439)

Does this stop you from using Cursor

Yes - Cursor is unusable

1 Like

doesn’t work. It turns to using cursur Usage,not User API


User API Key is still 400

2 Likes

it’s not solved! it just uses the cursor access!!

1 Like

Same problem here

1 Like

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Since yesterday, I am unable to use my custom Google API key with Gemini models (specifically Gemini 3). Attempting to generate a response results in an immediate failure.
The error message indicates a structure mismatch in the API request sent by Cursor: ⁠Invalid JSON payload received. Unknown name “top_k”: Cannot find field.
It seems Cursor is sending a ⁠top_k parameter that is no longer accepted or is misplaced in the payload for this specific Google model/endpoint.

Steps to Reproduce

  1. Open Cursor Settings > Models.
  2. Enable “Google API Key” and enter a valid API key.
  3. Select the Gemini 3 model (or the specific Gemini model causing the issue). 4. Open a Chat (Cmd+L) or Composer (Cmd+I).
  4. Send any prompt to the model.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.0.77
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: Darwin arm64 25.1.0

For AI issues: which model did you use?

Gemini 3

For AI issues: add Request ID with privacy disabled

f68c88f3-a8d2-492d-b993-8952a7fa1176

Does this stop you from using Cursor

No - Cursor works, but with this issue

1 Like

@danperks fix this please

4 Likes

wrong referenced bug report, but I do agree with you that this should be fixed

relevant bug report:

it should be fixed cc @condor @deanrie

1 Like

Can someone please look into this. Why are any issues related to BYOK stuff, that cursor doesnt even care to address?

1 Like