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.