Cursor Custom API Key Not Working — How to Fix It
If you've added your own OpenAI or Anthropic API key in Cursor's settings but AI features remain broken or unresponsive, you're not alone. This issue typically affects developers who bring their own API credentials to bypass Cursor's subscription or increase model access. The root cause is usually a misconfigured key, missing billing, or a provider mismatch that Cursor cannot silently recover from.
Why does this error happen?
How to fix it
Verify Your Key Has Correct Permissions and Active Billing
Log in to your OpenAI or Anthropic dashboard and confirm the API key is active, not revoked, and linked to an account with a positive credit balance or an active paid plan. For OpenAI, ensure the key has access to the models Cursor uses such as gpt-4o or gpt-4-turbo, as free-tier keys are often restricted. For Anthropic, verify your account is out of the waitlist and has usage limits set above zero.
Remove and Re-Add the Key in Settings > AI
Open Cursor, navigate to Settings > AI, and fully delete the existing API key field before saving. Restart Cursor, then return to the same settings panel and paste your key fresh from your provider's dashboard to avoid any clipboard or copy-paste formatting issues. Save the settings and trigger an AI action such as opening a chat to confirm the key is now being accepted.
Switch Between API Providers to Isolate the Problem
If you're using an OpenAI key and it still fails, temporarily switch to an Anthropic key in Settings > AI, or vice versa, to determine whether the issue is provider-specific or a Cursor configuration problem. If the alternate provider works immediately, the original key itself is the problem rather than Cursor's integration. This step quickly narrows down whether you need to regenerate your key or file a support ticket with your provider.
Check Cursor Logs for the Exact Error Message
Open Cursor's developer logs by going to Help > Toggle Developer Tools and selecting the Console tab, or check the Output panel inside Cursor for AI-related log entries. Look for HTTP status codes such as 401 (invalid key), 403 (permission denied), or 429 (rate limited) which each point to a different fix. Copying the exact error message also makes it much faster to get accurate help from Cursor's community or support channels.
💡 Pro Tip
Always generate a dedicated API key for Cursor rather than reusing a key shared across multiple tools. This way, if Cursor's key stops working you can revoke and regenerate it without disrupting other integrations, and usage logs in your provider dashboard will clearly show Cursor-specific consumption and errors.
Frequently Asked Questions
Does Cursor work with any OpenAI API key, including free-tier keys?
Why does my Anthropic API key work in other tools but not in Cursor?
Will switching to Cursor Pro remove the need for a custom API key?
How do I know if Cursor is actually using my custom key or its own backend?
Quick diagnostic checklist
Before diving into the full fix, run through these quick checks — they resolve the issue in most cases without additional steps:
Common root causes
Understanding why this error occurs helps you prevent it in the future. The most frequent causes are:
- Outdated Cursor version with known bugs
- API key expired or quota exhausted
- Conflicting VS Code extensions interfering with Cursor
- Context window exceeded in large files or codebases
- Network proxy or firewall blocking Cursor API calls
Still not working?
If none of the steps above resolved the issue, the next step is to contact Cursor support directly. When reaching out, include:
- • The exact error message or code you see
- • The steps you already tried from this guide
- • Your account plan and the approximate time the error started
- • Your browser/OS version if it is a web interface issue
About Cursor
Cursor is an AI-powered code editor built on VS Code, developed by Anysphere Inc. It integrates GPT-4 and Claude models directly into the editor for autocomplete, code generation, and natural language chat. Cursor is popular among developers for pair programming and large codebase navigation.
Browse all Cursor error guides →