OpenAI API key error until restart

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Using my own OpenAI API key, at almost every new prompt I get this error:
“Unable to reach the model provider
We’re having trouble connecting to the model provider. This might be temporary - please try again in a moment.”

However, restarting Cursor fixes the problem until the next prompt when it happens again. So it’s definitely not a problem with the key - it’s a problem with Cursor.

Steps to Reproduce

Input OpenAI API key (do not use custom URL for API endpoint - although this happens either way). Enter and submit a prompt using an OpenAI model.
Restart Cursor and the next prompt will work. Subsequent prompts will put you back in the same error loop until Cursor is restarted again.

Expected Behavior

It should accept the prompt, and respond without issue.

Screenshots / Screen Recordings

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.3.21
VSCode Version: 1.105.1
Commit: 68e0a0385b87408d050869ea543e3778ad53f780
Date: 2026-01-02T23:46:13.381Z (1 day ago)
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?

OpenAI models generally

For AI issues: add Request ID with privacy disabled

Privacy enforced by organization

Does this stop you from using Cursor

No - Cursor works, but with this issue

Update: I had a suspicion and turned off my MCP servers, at which point the issue seemed to go away. So this seems to have something to do with how function/tool definitions are constructed in the OpenAI calls?

Hey, thanks for the report and the great troubleshooting around MCP servers.

You correctly identified the MCP connection. This looks like a known issue where certain MCP servers can conflict with custom API keys: Can only use Composer 1 with Perplexity MCP server

To identify the problematic server, please try:

  • Which MCP servers do you have configured?
  • Disable them one by one to find the one causing it.
  • When the error happens again, please collect:
    • The Request ID from the chat context menu (Copy Request ID)
    • A screenshot from Help > Toggle Developer Tools > Console at the moment the error occurs

Also, can you confirm if this happens with all OpenAI models, or only specific ones?

This info will help us pinpoint which MCP server or configuration is causing the issue with your API key.

Wow thank you for the very quick response.
To answer your question about the OpenAI models, I’ve tried 5.1-codex of various strengths and 5.2 thinking of various strengths (my initial thought was that it was model-specific).

I’ll try to troubleshoot the MCP issue. I’ve noticed that my MCP servers will get flicked on automatically sometimes, so I was offering the agent far too many tools. I’ll turn them on one-by-one over the course of the next few prompts and see what happens.

Here are my MCP definitions (with keys redacted). I’m going to outright remove the Docker MCP toolkit as I haven’t found it very useful. But the github MCP server runs locally in docker (it works fine).

{

    "mcpServers": {

"awslabs.cdk-mcp-server": {

"command": "uvx",

"args": [

"awslabs.cdk-mcp-server@latest"

            ],

"env": {

"FASTMCP_LOG_LEVEL": "ERROR"

            },

"disabled": false,

"autoApprove": []

        },

"context7": {

"command": "npx",

"args": [

"-y",

"@upstash/context7-mcp@latest"

            ]

        },

"github": {

"command": "docker",

"args": [

"run",

"-i",

"--rm",

"-e",

"GITHUB_PERSONAL_ACCESS_TOKEN",

"
"

            ],

"env": {

"GITHUB_PERSONAL_ACCESS_TOKEN": <redacted>

            }

        },

"runpod": {

"command": "npx",

"args": [

"@runpod/mcp-server@latest"

            ],

"env": {

"RUNPOD_API_KEY": <redacted>

            }

        },

"huggingface": {

"url": "
",

"headers": {

"Authorization": <redacted>

            }

        },

"Netlify": {

"command": "npx -y @netlify/mcp",

"env": {},

"args": []

        },

"MCP_DOCKER": {

"command": "docker",

"args": [

"mcp",

"gateway",

"run"

            ]

        }

    }

}
1 Like

After I deleted the Docker MCP Toolkit I was able to turn the MCP servers on one by one and I didn’t run into the issue again. So perhaps that was it. Apologies for bothering you, if so.

I did notice the the problem is much more prevalent if the custom OpenAI domain button is on, but from a search, I believe this is a known issue.

Thanks!