The short version
Cursor can talk to any OpenAI-compatible endpoint, and DeepSeek models are a strong, cheap fit for everyday coding. The whole setup is three values: a base URL, an API key, and a model name. This guide walks through each step, then covers the two errors people hit most — 401 Unauthorized and model not found.
You need an API key that can call DeepSeek models. If you can top up on DeepSeek's own platform, use that key with the base URL https://api.deepseek.com. If overseas payment is the blocker, a prepaid pack from a gateway works the same way — the steps below use AiCredits as the example, but the Cursor side is identical for any OpenAI-compatible provider.
Step 1: Get a key
On AiCredits, packs start at $9 and the key is issued instantly after checkout — see pricing and the buy DeepSeek API credits page for what each pack includes. Copy the key from your order page and keep it somewhere private; anyone with the key can spend your balance.
Step 2: Point Cursor at the endpoint
Open Cursor Settings, then the Models tab.
Find the OpenAI API Key section and turn on Override OpenAI Base URL.
Enter the base URL: https://api.aicreditsapi.com/v1
Paste your API key into the OpenAI API Key field.
Click Verify. A green check means Cursor reached the endpoint and your key works.
Step 3: Add the model names
Cursor does not auto-discover models from a custom endpoint, so add them by exact name in the Models list:
| Model name to enter | What it is | Use it for |
|---|---|---|
| deepseek-chat | DeepSeek V4.1 Flash, thinking off | Fast everyday coding, chat, autocomplete-style tasks |
| deepseek-flash | DeepSeek V4.1 Flash with reasoning (deepseek-v4-flash also works) | Debugging and multi-step edits where some reasoning helps |
| deepseek-v4-pro | DeepSeek V4 Pro, deep thinking | Hard refactors, architecture questions, gnarly bugs |
Then pick the model in the Chat or Agent model picker. Start on deepseek-chat — it is the cheapest per token — and switch to deepseek-v4-pro when a problem needs deeper reasoning. Your balance is shared across models, so switching costs nothing extra to set up.
Check it works outside Cursor first (optional but smart)
If Verify fails, test the key directly so you know whether the problem is the key or Cursor's settings. This one-liner calls the same endpoint Cursor uses:
curl https://api.aicreditsapi.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-chat","messages":[{"role":"user","content":"Say hello in one word."}]}'
A JSON reply with a choices array means the key, balance, and model name are all fine. You can also paste the key into our free API Key Health Checker — it reports status and latency without spending tokens.
Fixing the common errors
401 Unauthorized: almost always a key/base-URL mismatch. The base URL must end in /v1 (Cursor appends /chat/completions itself), and the key must belong to the same provider as the base URL. A DeepSeek-official key will not work against a gateway endpoint, and vice versa.
Model not found: the name must match exactly, lowercase, no spaces. Use deepseek-chat, deepseek-flash, or deepseek-v4-pro — not display names like "DeepSeek V4.1 Flash".
402 Insufficient Balance: the key is valid but the balance is empty. Top up, then retry; no Cursor changes needed. Background: DeepSeek 402 and quota errors explained.
429 Too Many Requests: you are hitting rate limits, often from several tools sharing one key. Slow down, or split keys per tool. See handling 429s with multiple keys.
Timeouts on long Agent runs: switch to deepseek-chat for speed, or shorten the context Cursor sends. Reasoning models take longer on the first token.
Cursor tips for DeepSeek models
Use deepseek-chat for Tab-adjacent chat and quick edits; reserve deepseek-v4-pro for Agent runs on hard problems — it costs more per token but reasons much deeper.
If answers feel terse, say so in the prompt. DeepSeek models follow explicit format instructions well ("explain, then give the full file").
Keep one key per machine or tool. When a key leaks or a tool misbehaves, you can rotate just that key instead of breaking everything.
FAQ
Yes. Cursor's custom-endpoint support uses your own API key, and AiCredits packs are prepaid with no subscription. You pay per token from your balance.
https://api.aicreditsapi.com/v1 — with Override OpenAI Base URL turned on. Do not add /chat/completions; Cursor appends that itself.
deepseek-chat for fast everyday work, deepseek-flash when you want reasoning at Flash prices, deepseek-v4-pro for the hardest problems.
Yes — the endpoint is OpenAI-compatible, so the same key and base URL work in Cline, Roo Code, and OpenAI SDK apps. See our Cline setup guide.
That is a payment-layer issue, not a Cursor issue. Our card-declined troubleshooting guide covers the causes and the routes around them.
Next steps
Grab a pack on the pricing section, run the two-minute setup above, and verify with the health checker if anything looks off. For the full payment picture — cards, PayPal, Alipay, WeChat Pay — see how to buy DeepSeek credits.