When I set my own OpenAI API key in the settings, the agent mode stops working. None of the models (GPT-5 Codex, GPT-5) work.
Moreover, if I switch to the Opus or Sonnet models, they also stop working.
Request IDS:
63ba3b7b-193a-45a4-bab6-7c3ca3d3f2ad gpt-5.1 codex
614f6ca0-4533-4dcc-bae8-d051d552bcd9 opus-4.5
Steps to Reproduce
Insert OpenAI key in settings
Operating System
MacOS
Current Cursor Version (Menu → About Cursor → Copy)
Hey, thanks for the report. This is a known bug: when you enable a custom OpenAI API key, it mistakenly applies to all models, causing other models (Claude, Gemini, etc.) to fail.
Workaround:
Turn off your OpenAI API key toggle when using Claude/Gemini models (Settings > Models > API Keys)
Turn it back on only when using OpenAI models
Quick toggle shortcut: Cmd+Shift+0
Unfortunately, there’s no ETA for a fix yet. The team is tracking this issue
I set OpenAI token and try agent mode with GPT-5.1 Codex model and get error.
Request ID: d6f188ab-53a8-467b-926f-1043a53ce07e
{"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: {\n \"error\": {\n \"message\": \"This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?\",\n \"type\": \"invalid_request_error\",\n \"param\": \"model\",\n \"code\": null\n }\n}\n```","additionalInfo":{},"buttons":[],"planChoices":[]},"isExpected":true}
ConnectError: [invalid_argument] Error
at RZc.$endAiConnectTransportReportError (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:6331:408452)
at KPo._doInvokeHandler (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:6948:21873)
at KPo._invokeHandler (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:6948:21615)
at KPo._receiveRequest (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:6948:20377)
at KPo._receiveOneMessage (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:6948:19194)
at yPt.value (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:6948:17286)
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 Xmt.fire (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:6316:12156)
at MessagePort.<anonymous> (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:8973:18439)
The error you’re seeing This is not a chat model and thus not supported in the v1/chat/completions endpoint indicates that GPT-5.1 Codex requires the /responses API from OpenAI, but Cursor’s BYOK (bring your own key) currently only supports /chat/completions. This affects all GPT-5 models when using custom API keys.
Current situation:
GPT-5/GPT-5.1 Codex work fine with Cursor’s built-in API (no custom key).
When you add your own OpenAI API key, Cursor tries to use /chat/completions, which GPT-5 models don’t support.