Troubleshooting · Cursor
Cursor Invalid API Key (Anthropic) — Why Verify Fails
Cursor rejects an Anthropic key on verify when the key and the base URL do not belong together, or the override field still points at the default endpoint. The checklist that fixes it.
What you see
Invalid API keyWhy it happens
- The key belongs to a custom endpoint but "Override Anthropic Base URL" is off or empty, so Cursor verifies the key against the default api.anthropic.com — which has never seen it.
- The base URL is set but the key was pasted with whitespace, a missing prefix, or is a different provider's key format entirely.
- The key was revoked or has expired.
- The override URL includes a path suffix, so the verification request goes to a URL the endpoint does not serve.
How to fix it
- Enable the base URL override and set it to the origin that issued the key before pasting the key itself — verification runs against whatever URL is active at that moment.
- Paste the key with no surrounding whitespace and check the prefix matches what your dashboard shows.
- Confirm the key is active in the dashboard of its issuer, then re-verify in Cursor.
Cursor settings that verify against this gateway
Cursor Settings → Models → Anthropic API Key
API Key: sk-pool-•••
Override Anthropic Base URL: https://api.apitoken.saleRelated searches
cursor anthropic api key not workingcursor verify api key failed
FAQ
Why does Cursor say my key is invalid when it works in curl?+
Cursor verifies against the base URL configured at that moment. If the override is off, verification hits api.anthropic.com, which rejects a gateway key. Set the override first, then verify.
Do I need an Anthropic account for a custom Anthropic-compatible key in Cursor?+
No. The Anthropic provider fields accept any Anthropic-compatible endpoint: set the override URL to the issuer and paste that issuer's key.
Which models work after the key verifies?+
The ones the endpoint behind the override serves. List them with GET /v1/models against the same base URL and key.