EN ▾
Get API key

cursorapikey.com/Guide

How to Use Cursor API Keys With a Custom Endpoint

Here is how to use cursor api settings with your own endpoint: paste a key, override the OpenAI base URL, and add the model name uncensored. The steps below take about five minutes and include a curl check you can run first.

Updated

Isometric code editor connected by a glowing cable to a server cube, illustrating a custom API endpoint

Key points

  • Cursor lets you override the OpenAI base URL and key, so any OpenAI-compatible endpoint can serve requests.
  • Use the base URL https://api.cursorapikey.com/v1 and the model ID uncensored.
  • Test the key with curl before touching the editor, so you know which side a failure comes from.
  • A 20,000-token prompt with a 1,000-token answer costs $0.0035.

What this guide covers

People who search for how to use cursor api usually mean one of two things. Either they want to call some Cursor service from code, or they want the Cursor editor to send its model requests to an endpoint they choose. This guide is about the second case. This site is an independent hosted API that speaks the OpenAI chat completions protocol, so Cursor can talk to it the same way it talks to any OpenAI-style server.

The model behind it is a single open-weight model, run by an independent provider and tuned to answer without content refusals for lawful adult use. It is not an official Cursor model, and it is not a router across vendors. It handles text only. For coding that is usually enough: you send code and instructions, you get code and explanations back.

You need three things: an API key, the base URL https://api.cursorapikey.com/v1, and the model ID uncensored. Everything else is a matter of finding the right fields in the editor.

Step 1: get a key and check it with curl

Sign up with Google or with email and password, then open the API key page. New accounts can claim $0.50 of trial credit there with one click. It needs no card and stays valid for 7 days. The trial key is limited to 2 concurrent requests and 60 requests per minute, which is enough for a first session in the editor.

Before you open Cursor, confirm the key works. Run this in a terminal, with your key in an environment variable:

export API_KEY="paste-your-key-here"

curl https://api.cursorapikey.com/v1/models \
  -H "Authorization: Bearer $API_KEY"

curl https://api.cursorapikey.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [
      {"role": "user", "content": "Write a Python function that reverses a linked list."}
    ]
  }'

The first call lists the model. The second returns a normal chat completion. If both succeed, any later failure in the editor is a settings problem and not a key problem. That split saves a lot of guessing.

Step 2: set the base URL and key in Cursor

Open Cursor's settings and go to the models section. Menu names and layout change between releases, so treat the labels below as a map and check Cursor's own documentation if something has moved.

  1. Find the field for an OpenAI API key and paste your key from this site.
  2. Enable the option to override the OpenAI base URL and enter https://api.cursorapikey.com/v1. Keep the /v1 at the end and do not add /chat/completions; the client appends the path itself.
  3. Add a custom model and type uncensored exactly, lowercase.
  4. Use the verify or save button if the editor offers one, then select the new model in the chat panel.

Send a short message such as "explain this function" with a file open. A streamed answer means the route works end to end. Cursor sends the request, the endpoint streams tokens back over SSE, and the editor renders them as they arrive.

Two cautions. Some editor features, such as inline tab completion, may run on models that Cursor controls and may ignore your key, so check which features actually use the custom model. And since Cursor may route custom-key traffic through its own servers, read its current documentation if you need to know exactly where your code travels. The quickstart on this site lists the API side of the contract.

Test the same endpoint from code

The easiest way to isolate a problem is to call the endpoint with the official OpenAI SDK. If that works, the endpoint is fine and any remaining issue sits in the editor configuration.

from openai import OpenAI

client = OpenAI(
    api_key="paste-your-key-here",
    base_url="https://api.cursorapikey.com/v1",
)

stream = client.chat.completions.create(
    model="uncensored",
    messages=[
        {"role": "system", "content": "You are a terse senior engineer."},
        {"role": "user", "content": "Refactor this loop into a list comprehension: out = []\nfor x in xs:\n    if x > 0:\n        out.append(x * 2)"},
    ],
    stream=True,
)

for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

The same thing in Node:

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.API_KEY,
  baseURL: "https://api.cursorapikey.com/v1",
});

const res = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Write a regex that matches ISO 8601 dates." }],
});

console.log(res.choices[0].message.content);

Streaming responses include usage at the end, so you can log exactly how many tokens a request used. Each response also carries an X-Balance-USD header with your remaining credit and an X-Request-Id you can quote if something looks wrong.

What works in a coding workflow

The API supports streaming, JSON mode, and tool calling (tools, tool_choice, streamed tool_calls, and results sent back as role: "tool"). Sampling settings such as temperature, top_p, stop, seed and the penalties are passed through. The context window is 100,000 tokens, shared between the prompt and the completion, and max_tokens is optional.

That 100,000 tokens is a generous budget for code. A source file of a few hundred lines is a few thousand tokens, so you can include several files plus a long instruction and still leave room for the answer. The maximum request body is 8 MB, which you will not reach with text.

Some habits that make a custom model pleasant in an editor:

  • Keep a low temperature for code edits. Values around 0.2 give steadier output; raise it only for brainstorming.
  • Attach only the files that matter. Every token you send is billed as input, and the whole conversation is resent on each turn.
  • Ask for diffs or the changed function, not the whole file, when the file is long. Output tokens cost more than input tokens.
  • Use the model for tasks where refusals get in the way, such as writing exploit proof-of-concepts for your own lab, analysing malware samples you are authorised to study, or generating test data that mimics ugly real-world content. All of it must be lawful.

The one hard limit worth repeating: no sexual content involving minors, under any framing.

Fixing the common errors

SymptomLikely causeFix
401 or "invalid key"Key pasted with a space, or an old keyRe-copy from the key page; test with curl
404 or "model not found"Model name typed differentlyUse uncensored, lowercase, with no suffix
404 on the pathBase URL includes /chat/completionsEnd the base URL at /v1
429 with concurrencyToo many requests at onceWait for streams to finish; a full key allows 8, a trial key 2
429 with rate_limitedMore than 300 requests per minute (60 on trial)Slow down, or retry after a pause
429 with Retry-After: 5Temporary overloadRetry after five seconds

A streamed request holds its concurrency slot until the stream ends. If you start several chats in Cursor and leave them generating, you can hit the concurrency limit on a trial key quickly. Failed or refused requests are not charged, so retrying costs nothing extra.

What a coding session costs

Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens, paid from prepaid credit with no subscription. A typical editor request has a large prompt (your files) and a short answer. Take 20,000 input tokens and 1,000 output tokens:

  • Input: 20,000 x $0.15 / 1,000,000 = $0.0030
  • Output: 1,000 x $0.50 / 1,000,000 = $0.0005
  • Total: $0.0035 per request

At 100 requests in a working day that is $0.35. The $0.50 trial credit covers roughly 140 such requests. After the trial you can top up any whole amount from $20 to $500, with +5% bonus credit from $50, +10% from $100 and +15% from $200. Pay with crypto (USDT on TRC20, USDC on Base). Credit never expires, so a top-up you use slowly is not wasted. The pricing page has the full table, and the page on the Cursor and Copilot alternative explains where this fits next to subscription editors.

Prompts are not used for training.

01

Questions and answers

Does this work with the Cursor agent and tool calling?

The API supports tool calling with tools, tool_choice and streamed tool_calls. Whether a given Cursor feature uses your custom model depends on the editor, so test each feature after setup.

Which model name do I enter?

Enter uncensored, in lowercase. It is the only model ID, and GET /v1/models lists it.

Is this the official Cursor API?

No. It is an independent OpenAI-compatible API in front of one open-weight model. Cursor simply lets you point its OpenAI settings at a different endpoint.

Do I need a card to try it?

No. The $0.50 trial credit is claimed with one click on the API key page after sign-up, needs no card, and is valid for 7 days.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.