Cursor API key errors — every common failure and the fix

Bringing your own key to Cursor fails in a small number of predictable ways. Almost none of them are about the key being wrong — they are about restart behaviour, doubled paths and expecting the old quota to stop immediately.

In short: Most Cursor own-key failures are not invalid keys. They are: the base URL override only being re-read on a cold start (so a full quit is required), a doubled /v1 producing a 404, and expecting subscription billing to stop when it has not. A request appearing in your gateway usage log is the only reliable proof the override took effect.
You need a key before the code below runs. Create an account, generate a key, and copy the base URL (https://aicomp.ai/v1). Create one free →
Check current rates → Free to sign up · $1 minimum top-up · No prepayment
Confirm the key works first. One command, no SDK, costs nothing:
curl https://aicomp.ai/v1/models \
  -H "Authorization: Bearer sk-your-gateway-key"

A JSON list of model IDs means the key is good. Invalid token means it was copied wrong.

The diagnostic table

SymptomWhat is actually wrongFix
401 invalid API keyKey truncated on paste, or copied from a partially rendered fieldRegenerate, paste into a plain text editor first to confirm the full string, then into Cursor
Still billing the subscriptionOverride not saved, or not re-read yetSave, then fully quit and relaunch — not just close the window
404 on the messages pathDoubled /v1 in the base URLIf the endpoint already ends in /v1, do not add another
Model not foundModel name differs from what this endpoint exposesList models with curl and copy the exact string
Requests hang, no errorProxy or firewall on the endpoint hostTest with curl from the same machine; if curl also hangs it is network-level
Works once, then 429Your own per-model rate limitNot a Cursor bug. Reduce concurrency or spread requests
Tool calls fail silentlyEndpoint does not fully implement tool callingTest tool use explicitly before relying on agent mode
Streaming arrives in one blockEndpoint buffers rather than streamsHarmless — you just lose incremental output

Why the restart matters

When you paste your key, the connection you will later see is not necessarily the one you get — several versions only re-read overrides on a cold start. A request appearing in your gateway usage log is the only reliable proof the change took effect; the absence of a visible error is not proof of anything.

Once it works, watch cost rather than correctness

Your own key means your own bill, and Cursor generates longer prompts than most people realise — it resends file context on every request. Two things move the number more than anything else: keeping unrelated files out of context, and not routing mechanical tasks to the flagship model.

Rates for the models commonly used from Cursor — USD per 1M tokens
ModelGateway rate
in / out per 1M tokens
Official list
in / out per 1M tokens
Diff
claude-sonnet-5$1 / $5$2 / $1050%
claude-haiku-4-5$0.5 / $2.5$1 / $550%
gpt-5.6-luna$0.1 / $0.6$0.2 / $1.250%

Rates checked 2026-09-16. Gateway rates move with upstream promotions — verify the current number in your dashboard before committing to a budget.

Cost note. If a task is mechanical — rename, refactor, formatting — the cheaper tier handles it and the difference compounds over hundreds of requests. When stepping up genuinely matters — architectural decisions, multi-file reasoning — the flagship pays for itself.

Still stuck

Reproduce with curl from the same machine. If curl works and Cursor does not, the problem is in the client configuration — the base URL string, or the restart. If curl fails too, it is the key or the network, and no amount of Cursor configuration will fix it.

FAQ

Why does Cursor still bill my subscription after adding my own key?

Either the override was not saved, or Cursor is still holding the old connection. Fully quit and relaunch — several versions only re-read the setting on a cold start.

The base URL field rejects my endpoint

Check for a trailing slash or a doubled /v1. Try the value you successfully used with curl, since that one is already proven correct.

It works for one request then stops

Usually rate limits on your own account rather than a Cursor problem. Cursor sends traffic faster than interactive use does, which can surface a per-model quota.

Requests hang with no error

Almost always a proxy or firewall on the endpoint host, particularly on corporate networks. Test from the same machine with curl to confirm the endpoint is reachable at all.

Can I use different models for different tasks?

Yes, once the override is active you can select any model the endpoint exposes. Match the model to the task — routing everything to the flagship is the fastest way to make your own key more expensive than the subscription.

Related

Get API access