EN ▾
Get API key

How to Use DeepSeek API in Cursor: Custom Base URL Setup

Cursor can talk to any OpenAI-compatible endpoint, so you can use a hosted DeepSeek-style API with it by overriding the base URL and adding a custom model name. This guide shows the exact fields to fill in and how to test them.

Updated

Abstract code editor panel connected by a glowing cable to an API server cube

Key points

  • Cursor accepts a custom OpenAI base URL, an API key and a custom model name in its Models settings.
  • Use base URL https://api.deepseekapi.top/v1 and the model ID uncensored.
  • Test the key with curl first, so you know any failure comes from Cursor and not from the key.
  • Cost is pay as you go: $0.15 per 1M input tokens and $0.50 per 1M output tokens.

The short answer

If you want to know how to use deepseek api in cursor, the process is the same for any OpenAI-compatible provider. You open Cursor's model settings, paste an API key into the OpenAI key field, override the OpenAI base URL, and add a model name that Cursor does not know about. Then you pick that model in chat.

One clarification before you start. This site is not the official DeepSeek API. It is a hosted, OpenAI-compatible text API that runs one open-weight model, run by an independent provider and tuned to answer without content refusals for lawful adult use. The model ID is uncensored. If you need the official DeepSeek service, use the vendor's own endpoint and key instead. The settings in Cursor look identical either way: only the three values change.

Cursor fieldValue
OpenAI API KeyYour key from the API key page
Override OpenAI Base URLhttps://api.deepseekapi.top/v1
Custom model nameuncensored

Before you open Cursor: get and test a key

Sign-up is with Google, or with email and password. After that, the API key page has a one-click button that adds $0.50 of trial credit. It is valid for 7 days, needs no card and is limited to one per person. That is enough for a few hundred short coding questions, so you can finish the whole setup before paying anything. The key page walks through the steps.

Now test the key outside Cursor. Cursor's error messages are short, and a typo in the key looks the same as a wrong URL. Run this in a terminal:

curl https://api.deepseekapi.top/v1/chat/completions   -H "Authorization: Bearer YOUR_KEY"   -H "Content-Type: application/json"   -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Write a Python function that reverses a string."}]
  }'

You should get a JSON reply with the function in choices[0].message.content. You can also list models with GET /v1/models, which is a quick way to confirm the key is accepted. If this works, the endpoint side is done and everything left is Cursor configuration.

Configure Cursor step by step

  1. Open Cursor settings and go to the Models section. On most builds you reach it with the gear icon, then Models.
  2. Find the field for your OpenAI API key and paste the key. Cursor may ask you to verify it. Verification can fail with a custom endpoint, since Cursor checks the key against its own list of models. If so, continue with the next steps and judge by whether chat works.
  3. Turn on the option to override the OpenAI base URL and enter https://api.deepseekapi.top/v1. Include the /v1 at the end. Do not add /chat/completions; the client appends that path itself.
  4. Use the add-model control and type uncensored exactly, in lowercase. Enable it in the model list.
  5. Open a chat panel, choose uncensored in the model picker, and send a short prompt.

Menu names change between Cursor releases, so if a label differs from the one above, look for the same three things: key, base URL, custom model. Cursor's own documentation is the place to check the current names.

One setting to watch

Cursor keeps a single OpenAI base URL override. While it is on, every OpenAI-named model you use in Cursor goes to the new address. If you also want to use a different OpenAI-compatible service for something else, switch the override off, or use a separate profile.

What works with a custom endpoint

A custom key is used for the features that call a chat model: the chat panel and inline edits. Those send a standard chat completions request, which is what this API accepts. The service supports streaming over SSE, so responses appear token by token in the chat panel as they do with other providers.

Some Cursor features depend on Cursor's own models and servers, such as its tab completion. Those do not switch to your key. Also, Cursor may route requests through its own backend before they reach your endpoint, so check its documentation if network location or logging matters to you. On our side, prompts are not used for training.

Agent-style features rely on tool calling. The API supports tool calling with tools, tool_choice and streamed tool_calls, with results returned as role: "tool". Whether a given Cursor mode uses that path with a custom model can differ between versions, so treat it as something to test on a small task before you build a workflow around it.

The context window is 100,000 tokens, prompt plus completion. That is large enough for several files at once, but Cursor decides what to attach, and a big attachment costs input tokens on every message.

Prompts that work well in an editor

A chat model in an editor is only as useful as the context you hand it. A few habits make a visible difference with any model behind a custom endpoint.

  • Attach only the files that matter. Every attached file is input tokens on every turn. Two relevant files beat ten loosely related ones, both for quality and for cost.
  • State the task and the constraint. "Rewrite this function to avoid recursion, keep the signature" works better than "make this better".
  • Ask for a diff-sized answer. If you want a small change, say so. Otherwise the model may rewrite the whole file, and you pay for the output tokens.
  • Start a new chat per task. Old turns are resent. A clean chat is the cheapest context trim there is.

The model is tuned to answer without content refusals for lawful adult use, so security-related coding questions, such as how a known class of vulnerability works in your own code, tend to get a direct answer rather than a warning. It still makes mistakes like any language model. Read the code it gives you and run the tests before you commit anything.

If a long answer stalls, check the limits section below. Two editor windows streaming at once on a trial key will fill both concurrency slots, and the third request waits or returns a 429.

What it costs in an editor

Price is $0.15 per 1M input tokens and $0.50 per 1M output tokens, from prepaid credit. There is no subscription, failed or refused requests are not charged, and credit never expires.

A typical chat turn in an editor has a lot of input (the file you attached plus history) and a short answer. Take 6,000 input tokens and 700 output tokens:

  • Input: 6,000 × $0.15 / 1,000,000 = $0.0009
  • Output: 700 × $0.50 / 1,000,000 = $0.00035
  • Total: $0.00125 per turn

At that size, 100 turns cost $0.125. A long working day of 400 turns costs $0.50. Input dominates the bill once conversations grow, because Cursor resends the history. Starting a fresh chat when you change tasks is the easiest way to keep that number low.

When you want more than the trial, top-ups are any whole amount from $20 to $500, with a bonus of +5% from $50, +10% from $100 and +15% from $200. You can pay by card (Visa, Mastercard, Apple Pay, Google Pay) or with crypto (USDT on TRC20, USDC on Base). Details are on the pricing page.

Troubleshooting

401 or invalid key

The key was pasted with a trailing space, or it belongs to a different site. Re-run the curl test with the same string. If curl works and Cursor does not, paste the key again.

404 or model not found

Usually the base URL is missing /v1 or has an extra path on the end. The model name must be exactly uncensored.

429 responses

A full key allows 8 concurrent requests and 300 requests per minute. The trial key allows 2 concurrent requests and 60 per minute. The error code rate_limited means too many requests per minute and concurrency means too many at once. On temporary overload you also get a 429 with Retry-After: 5. A streamed response holds its slot until the stream ends, so several editor windows streaming at the same time can hit the concurrency limit on a trial key.

The model refuses or goes off topic

The model is tuned to avoid content refusals for lawful adult use, but it is still a language model and it follows your prompt. Give it a clear system instruction and a precise task. The hard limit is that sexual content involving minors is never allowed.

The quickstart docs list the headers returned on each response, including X-Request-Id, which is useful to quote when you contact support.

Questions and answers

Is this the official DeepSeek API?

No. It is an independent, OpenAI-compatible service running one open-weight model with the ID uncensored. It is not the official API of DeepSeek or any other vendor.

Do I need a card to try it in Cursor?

No. New users can claim $0.50 of trial credit with one click on the API key page after sign-up. It lasts 7 days and needs no card.

Why does Cursor say the key could not be verified?

Cursor's verify step may check against its own model list. Test the key with curl, and if that works, try sending a chat message with the custom model selected.

Can I use tool calling and JSON mode from Cursor?

The API supports both, but whether a Cursor feature sends them to a custom model depends on the Cursor version. Test on a small task first.

Your key is one form away

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

Get API key