Custom API key breaks other models

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When you enable custom OpenAI API key in cursor settings, OpenaAI models using this API key work fine,
But no model from other providers work, Claude, Gemini, Grok etc, they all fail with error that says Unauthorized or Invalid Key of some kind, as if it tried to use OpenAI key for every model there.

This is clearly not expected, instead it should use OpenAI key only for OpenAI model calls and Cursor subscription tokens for other models and tools

Steps to Reproduce

Cursor Settings → Models → Expand API Keys section
Paster OpenAI API Key, Enable the switch near it
Close settings, try asking GPT-5 agent something - it works
Now select any other model (i.e. Gemini 2.5 Pro) and submit request, it will error out with text API key not valid. Please pass a valid API key

Expected Behavior

It should use OpenAI key only for OpenAI model calls and Cursor subscription tokens for other models and tools

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.0.38 (user setup)
VSCode Version: 1.99.3
Commit: 3fa438a81d579067162dd8767025b788454e6f90
Date: 2025-10-29T20:45:40.883Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.26100

Does this stop you from using Cursor

No - Cursor works, but with this issue

Thanks for the report. When you enable your OpenAI API key, it’s mistakenly applied to all models. As a result, subscription models (Claude, Gemini, Grok) return errors.

Temporary workaround: turn off the OpenAI API key toggle when you need subscription models (Claude/Gemini/Grok), and turn it on only for OpenAI models.

Actually after last updates custom OpenAI API key breaks even some of OpenAI models, i.e GPT-5 Codex works, but GPT-5 High does not, it errors out with:

{"type":"error","sequence_number":1,"error":{"type":"invalid_request_error","code":"invalid_parameter","message":"prompt_cache_retention is not supported on this model","param":"prompt_cache_retention"}}

Of course this is not priority issue, because this feature is pretty niche and does not make money for Cursor (kind of the opposite), but this piece of functionality always had some issues (both breaking or not so much)

1 Like

Hey! Is there an estimate of when this can be fixed?

Thanks for waiting. This is a known bug - the team is tracking the prompt_cache_retention issue with GPT-5 High/Fast (see related topic: Issue when using custom OpenAI Key with GPT 5 High Fast).

Unfortunately, there’s no ETA for a fix yet. For now, please use these workarounds:

  • Turn off your OpenAI API key when using Claude/Gemini/Grok. You can use the shortcut Cmd+Shift+0 to quickly toggle the API key on or off
  • Use GPT-5 Codex instead of GPT-5 High when you need your custom OpenAI key

I know this isn’t ideal for your workflow. I’ll flag this thread so the team sees the ongoing impact.

2 Likes