Cursor

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?

Cursor validates your custom API key at runtime by making a test request to the selected provider's endpoint. If the key lacks the required permissions, has no active billing or credit balance, is scoped to the wrong model tier, or was entered with extra whitespace or truncated characters, the request fails and Cursor's AI features silently degrade or stop working entirely. Additionally, Cursor caches provider settings locally, so even a corrected key may not take effect until the old cached value is cleared by removing and re-adding the key through the Settings UI.

How to fix it

1

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.

2

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.

3

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.

4

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?
Free-tier OpenAI keys typically lack access to GPT-4 class models that Cursor relies on, so AI features will fail or fall back silently. You need a paid OpenAI account with billing enabled and sufficient credits for Cursor's API calls to succeed.
Why does my Anthropic API key work in other tools but not in Cursor?
Cursor may be targeting a specific Claude model version that your Anthropic key tier does not have access to yet. Check your Anthropic console to confirm model access permissions, and ensure you are on a plan that includes the Claude model version Cursor is requesting.
Will switching to Cursor Pro remove the need for a custom API key?
Yes, Cursor Pro includes bundled AI usage powered by Cursor's own infrastructure, so you no longer need to supply or manage your own OpenAI or Anthropic key. This is the simplest way to eliminate API key configuration issues entirely.
How do I know if Cursor is actually using my custom key or its own backend?
If a custom key is saved in Settings > AI, Cursor will route requests through that key and charges will appear in your provider's usage dashboard. You can confirm this by checking your OpenAI or Anthropic billing page for recent API activity after triggering a Cursor AI action.

Skip API key hassles — upgrade to Cursor Pro for built-in AI access with no configuration required.

Related Guides