Get your key

Cursor AI API Key: Where to Put a Custom Key

A cursor ai api key is whatever key you paste into the editor's model settings, and it can come from any OpenAI-compatible provider when the editor lets you change the base URL. This guide shows where the fields go, how to test the endpoint first and what to check when it fails.

A brass key entering a slot on a floating code editor panel connected to a server cube

Last updated

Summary

  • You need three values: base URL, API key and model name (uncensored).
  • Test the endpoint with curl before you touch the editor settings.
  • Most failures are a wrong path, a missing Bearer header or a wrong model name.
  • The $0.50 trial credit is enough to run a real test session without a card.

The short answer

Editors in the Cursor family need three values to talk to a custom provider: a base URL, an API key and a model name. For this service they are:

  • Base URL: https://api.cursoraiapikey.com/v1
  • API key: the key from the API key page
  • Model name: uncensored

Open the editor settings and find the model section. Cursor has offered a field for an OpenAI API key and an option to override the OpenAI base URL, but menu labels move between versions, so search the settings for "base URL" if you cannot spot them. Paste the URL and the key, add a custom model called uncensored, then use the verify button if your version has one.

This service is independent of Cursor. It is a separate hosted API and it does not replace the editor's own account or plan. You are only pointing the editor's chat at a different OpenAI-compatible server.

Two kinds of keys, two different places

People use the same word for two unrelated things, and mixing them up is the most common reason a setup fails.

The account login

The editor has its own sign-in. That identifies you to the editor's vendor and has nothing to do with a model provider. You do not paste a provider key into the login screen.

The provider key

This is a secret string issued by a company that runs a model. You paste it into the model settings together with a base URL, and the editor sends it in an Authorization: Bearer header with every request. A key from this service works only against this service's base URL, and a key from another provider will not work here.

If you landed here looking for a way to get the editor's own key for free, this is not that. If you want a cheap text model behind the editor's chat panel, read on. The same pattern works for any editor that accepts an OpenAI-compatible endpoint, and the article on replacing a Claude key covers the parallel case for Anthropic-style setups.

Test the endpoint before touching the editor

A two-minute test outside the editor tells you whether the problem is the key or the editor. Create an account, claim the trial on the key page, and run this:

curl https://api.cursoraiapikey.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Reply with the word ok."}]
  }'

You should get a JSON body with a choices array. The response headers include X-Balance-USD, which shows what is left on your credit. The same call in Python with the official SDK:

from openai import OpenAI

client = OpenAI(
    base_url="https://api.cursoraiapikey.com/v1",
    api_key="YOUR_KEY",
)

reply = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Reply with the word ok."}],
)
print(reply.choices[0].message.content)

If both calls work, the key is fine and any later error comes from the editor settings.

Step by step in the editor

  1. Sign up with Google or with email and password, then claim the $0.50 trial credit on the API key page. It needs no card and is valid for 7 days.
  2. Copy the key. Treat it like a password.
  3. In the editor, open Settings and go to the Models section. Names differ between versions, so treat the labels in this list as a guide.
  4. Paste the key into the OpenAI API key field.
  5. Turn on the option to override the OpenAI base URL and enter https://api.cursoraiapikey.com/v1. Keep the /v1 and do not add /chat/completions; the client adds the rest.
  6. Add a custom model with the exact name uncensored.
  7. Select that model in the chat panel and send a short message.

If your version pushes a verify step and it fails while curl works, check that you did not leave a trailing space on the key and that the base URL has no second /v1 at the end.

What will and will not use your key

Setting a custom endpoint does not necessarily change every feature. Editors often run some features, such as inline completion or applying a diff, on models the vendor hosts itself, and those may ignore your key. Chat and agent-style requests are the ones usually sent to the endpoint you configure. The editor's documentation is the authority for your version, so check it before you plan around a specific feature.

Two more things worth checking:

  • Request path. Depending on the version, requests may pass through servers run by the editor's vendor before they reach your endpoint. If so, a base URL on your own laptop will not work, while a public URL like this one will. Read the privacy notes of the editor to see what it stores.
  • Model scope. This service runs one open-weight model, tuned to answer without content refusals for lawful adult use. It is text only. It does not generate images, audio or embeddings, so features that need those will not work through it.

The context window is 100,000 tokens for prompt plus completion, which is plenty for most single-file work and for many multi-file tasks. Very large repository dumps will not fit.

Fixing common errors

SymptomLikely causeFix
401 unauthorizedWrong or revoked key, extra space, key pasted into the wrong fieldRegenerate the key on the key page and paste it again. The old key stops working at once.
404 not foundBase URL missing /v1, or /v1/v1 doubledUse exactly https://api.cursoraiapikey.com/v1.
Model not foundCustom model name typed differentlyThe name is uncensored, all lowercase.
429 with concurrencyToo many requests at once; trial keys allow 2Wait for running requests to finish, or move to a full key, which allows 8.
429 with rate_limitedOver the per-minute limit; 60 on trial, 300 on a full keySlow down; agent loops can burst.
429 with Retry-After: 5Temporary overloadRetry after five seconds.

Agent modes can fire several requests together, and a streamed response keeps its slot until the stream ends. On a trial key that makes the concurrency limit easy to hit. This is normal, not a fault of the key.

What a request costs

Billing is pay as you go at $0.15 per 1M input tokens and $0.50 per 1M output tokens, from prepaid credit. Failed or refused requests are not charged. A typical chat turn in an editor sends the open file and some history, say 20,000 input tokens, and gets back 1,500 tokens of output:

  • Input: 20,000 x $0.15 / 1,000,000 = $0.0030
  • Output: 1,500 x $0.50 / 1,000,000 = $0.00075
  • Total: $0.00375, a little under half a cent

The $0.50 trial credit therefore covers about 133 turns of that size. That is enough for an afternoon of real testing. When you decide to keep going, top-ups run from $20 to $500 in whole amounts, with a bonus of 5% from $50, 10% from $100 and 15% from $200, paid in crypto (USDT on TRC20 or USDC on Base). Credit never expires. The pricing page has the full table and the docs list every supported parameter.

Frequently asked questions

Is this the official Cursor API key?

No. This is an independent hosted API with its own keys. It is not made by or connected to the Cursor vendor, and its key only works with this service's base URL.

Where do I find the base URL setting in Cursor?

Look in Settings under Models for the OpenAI API key section and an option to override the base URL. Labels change between versions, so search the settings for base URL.

Can I keep my existing subscription and add this key?

Usually yes. A custom key only changes where chat requests are sent when you select the custom model. Your account and plan are managed separately by the editor's vendor.

What happens if I lose or leak the key?

Regenerate it on the API key page. The old key stops working immediately. Accounts that have topped up can hold up to 5 keys, label them and revoke any of them.

Get your API key

Sign up, copy the credential, and update your base URL. That is all you need to do.