Troubleshooting · Cursor
Cursor: Request Failed With Status Code 401 — Custom API Key Fix
A 401 inside Cursor chat means the endpoint answered and rejected the credentials: key and base URL mismatched, key revoked, or account access withdrawn. The fix path.
What you see
Request failed with status code 401Why it happens
- The key verified once but was later revoked or expired — Cursor keeps using it until the endpoint starts answering 401.
- The base URL override was changed after the key was saved, so the saved key now goes to an endpoint that has never seen it.
- The account behind the key was suspended or its access withdrawn.
How to fix it
- Re-check the pair as it exists right now: the override URL and the key must come from the same issuer. Fix whichever side changed.
- Test the exact key against the exact base URL with curl — it removes Cursor from the equation in one step.
- If curl also returns 401, the key itself is dead: check its status in the issuer's dashboard or reissue it.
Reproduce outside Cursor
curl https://router.apitoken.sale/v1/chat/completions \
-H "Authorization: Bearer sk-pool-•••" \
-H "content-type: application/json" \
-d '{"model":"gpt-6.1-terra","messages":[{"role":"user","content":"ping"}]}'Related searches
{"error":{"message":"Invalid or missing API key.","type":"invalid_request_error","param":null,"code":"invalid_api_key"}}cursor 401 custom api key
FAQ
Cursor verified my key earlier — why 401 now?+
Verification is a snapshot. A key revoked afterwards, or a base URL changed afterwards, produces 401s on every later request even though the initial verify passed.
Is this Cursor's bug?+
Almost never. A 401 is the endpoint's answer passed through. Reproduce it with curl: if curl gets 401 too, the credentials are the problem.
What if curl succeeds but Cursor still gets 401?+
Then Cursor is sending different credentials than you think — re-open settings and re-paste the key with the override URL already enabled.