On this page
- DeepSeek Chat vs. the DeepSeek API
- Step 1: Get an API Key on the DeepSeek Platform
- Step 2: The DeepSeek API Address and Model Names
- Step 3: Call the DeepSeek API with curl, Python and Node.js
- Using DeepSeek Through Zivv: One Key for Every Model
- Using DeepSeek in Claude Code and Cursor
- Common Errors: 401, 402, 404
- FAQ
This guide is for developers getting a DeepSeek API key for the first time, wondering what to put in the base URL field, or wiring DeepSeek into their own code, Claude Code or Cursor. It covers, in order: getting a key on the official platform, the API address and model names, curl / Python / Node.js examples, using DeepSeek through Zivv, configuring coding tools, and the usual 401, 402 and 404 errors.
DeepSeek Chat vs. the DeepSeek API
DeepSeek has two front doors, and people looking for an API key often walk through the wrong one:
- Web chat and mobile app: talk to DeepSeek directly; no API key involved
- DeepSeek Platform (the API): for developers calling the model from code or third-party tools, billed per token, with its own top-up and API keys
Everything about "integrating DeepSeek" refers to the second. Both routes below are OpenAI-compatible, so the code is nearly identical:
| Aspect | DeepSeek Platform (official) | Through Zivv |
|---|---|---|
| Where the key comes from | API keys page on the DeepSeek Platform | API keys page in the Zivv console |
| Base URL | https://api.deepseek.com | https://zivv.pro/v1 (https://zivv.pro for the Anthropic protocol) |
| Model names | Per the official model list | Model Hub ids such as deepseek-v4-1-flash-261017 |
| Models available | DeepSeek | DeepSeek plus Claude, GPT, Gemini, Qwen, GLM and more |
| Upstream | DeepSeek itself | DeepSeek model service on Volcengine and Alibaba Cloud Bailian |
| Billing | Top up on the DeepSeek Platform | Zivv account balance, pay per use |
If you only need DeepSeek and want new official features the day they ship, go direct. If your project mixes several model vendors and you would rather not juggle separate sign-ups, balances and invoices, a gateway like Zivv is simpler. Switching later means changing three values.
Step 1: Get an API Key on the DeepSeek Platform
- Go to the DeepSeek Platform at
https://platform.deepseek.com, sign up and log in - Add funds first. The API is billed per token and returns 402 when your balance runs out. Pricing, payment methods and any free credit are whatever the site currently says
- Open the API keys page (
https://platform.deepseek.com/api_keys), create a new key and give it a name that says what it is for, such as "local dev" or "production" - Copy it immediately. Keys start with
sk-and are usually shown in full only once, at creation; if you lose one, delete it and create another - Store the key in an environment variable, never in source code or a Git repository
export DEEPSEEK_API_KEY=sk-your-deepseek-keyUse one key per project and environment. If one leaks, you revoke just that key without breaking anything else.
Step 2: The DeepSeek API Address and Model Names
The DeepSeek API base URL is:
https://api.deepseek.comWhat to know:
- It follows the OpenAI API format; chat goes to
POST https://api.deepseek.com/chat/completions - The official docs note that
https://api.deepseek.com/v1also works for OpenAI compatibility, and that this v1 has nothing to do with the model version - The docs also provide an Anthropic-compatible address,
https://api.deepseek.com/anthropic, for tools such as Claude Code that speak the Anthropic protocol; check the docs for the current details - Model names have changed across releases (earlier versions used deepseek-chat and deepseek-reasoner), so copying from an old tutorial is the most common way to get them wrong. The model list in the official DeepSeek API docs is the source of truth
The most reliable approach is to ask the API which models your key can use:
curl https://api.deepseek.com/models \
-H "Authorization: Bearer $DEEPSEEK_API_KEY"Each id in the data array is a valid value for the model parameter. The same call also validates the key: a 401 here means the key is the problem, so there is no point debugging code yet.
Step 3: Call the DeepSeek API with curl, Python and Node.js
In the examples below, use a model id from the previous step.
curl:
curl https://api.deepseek.com/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DEEPSEEK_API_KEY" \
-d '{
"model": "<model id from step 2>",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Introduce yourself in one sentence."}
],
"stream": false
}'Python (OpenAI SDK): install it with pip install openai.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["DEEPSEEK_API_KEY"],
base_url="https://api.deepseek.com",
)
resp = client.chat.completions.create(
model="<model id from step 2>",
messages=[{"role": "user", "content": "Introduce yourself in one sentence."}],
)
print(resp.choices[0].message.content)Node.js (OpenAI SDK): install it with npm install openai, and save the file as .mjs or set "type": "module" in package.json so top-level await works.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.deepseek.com",
apiKey: process.env.DEEPSEEK_API_KEY,
});
const resp = await client.chat.completions.create({
model: "<model id from step 2>",
messages: [{ role: "user", content: "Introduce yourself in one sentence." }],
});
console.log(resp.choices[0].message.content);Streaming, multi-turn chat and tool calls work exactly as they do with OpenAI; see the Python quickstart, the Node.js quickstart and the SSE streaming guide. If you are moving existing OpenAI code, the OpenAI-compatible migration checklist lists what to check.
Using DeepSeek Through Zivv: One Key for Every Model
When a project needs DeepSeek alongside Claude, GPT or Gemini, separate accounts, balances and keys for each vendor add up quickly. Zivv covers them with one key and one balance; its DeepSeek models are served by Volcengine and Alibaba Cloud Bailian.
Create a Key
- Sign up for Zivv and top up; usage is billed as you go
- On the API keys page of the console, create a key in a group that includes DeepSeek (Volc DeepSeek or Bailian DeepSeek). To reach DeepSeek, Claude and GPT with a single key, set the routing mode to smart routing and select several groups
- The Claude MAX group only contains Claude models, so a key in that group cannot call DeepSeek
DeepSeek Models Available Today
These are the DeepSeek models in the Model Hub at the time of writing; the live list is authoritative:
| Model id | Series | Group (upstream) | Notes |
|---|---|---|---|
| deepseek-v4-1-flash-261017 | V4.1 Flash | Volc DeepSeek (Volcengine) | Recommended; hybrid reasoning, stronger agentic coding and long-horizon execution, low cost |
| deepseek-v4-1-flash-260910 | V4.1 Flash | Volc DeepSeek | Earlier 260910 release |
| deepseek-v4.1-flash-1017 | V4.1 Flash | Bailian DeepSeek (Alibaba Cloud Bailian) | The 1017 release on Bailian |
| deepseek-v4-pro-ga-260813 | V4 Pro | Volc DeepSeek | Recommended; complex reasoning and coding |
| deepseek-v4-pro-0813 | V4 Pro | Bailian DeepSeek Pro 0813 | The 0813 release on Bailian |
| deepseek-v4-pro | V4 Pro | Bailian DeepSeek | Id without a date suffix |
| deepseek-v4-flash-ga-260731 | V4 Flash | Volc DeepSeek | Cost-efficient hybrid reasoning |
| deepseek-v4-flash-0731 | V4 Flash | Bailian DeepSeek | The 0731 release on Bailian |
All of them have a 1M-token context, accept the OpenAI Chat, OpenAI Responses and Anthropic protocols, and support tool calls and structured output. V4.1 Flash on Volcengine also supports web search, with reasoning effort selectable as low, high, max or none. Some versions carry off-peak pricing, which is cheaper outside busy hours; tick "Off-peak pricing only" in the Model Hub to find them. Each model page has the exact capabilities and prices, and the DeepSeek, Qwen and GLM guide covers relative pricing between Flash and Pro and how to combine them with other Chinese models.
Ids with a date suffix are pinned versions whose behavior does not shift when the upstream updates, which is what you want in production. To see which models your own key can call:
curl https://zivv.pro/v1/models \
-H "Authorization: Bearer $ZIVV_API_KEY"Calling It from Code
Compared with the official API, only base_url, api_key and model change:
import os
from openai import OpenAI
client = OpenAI(base_url="https://zivv.pro/v1", api_key=os.environ["ZIVV_API_KEY"])
resp = client.chat.completions.create(
model="deepseek-v4-1-flash-261017",
messages=[{"role": "user", "content": "Introduce yourself in one sentence."}],
)
print(resp.choices[0].message.content)The curl version:
curl https://zivv.pro/v1/chat/completions \
-H "Authorization: Bearer $ZIVV_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-pro-ga-260813",
"messages": [{"role": "user", "content": "Explain what an idempotent API is."}]
}'Every response carries an X-Request-ID header; pass it to /v1/generation to see the model that served the request, its tokens and its cost, and the Usage logs page in the console shows the same per request. To verify a relay's models yourself, run the checks in how to test whether a model is downgraded.
Keys and model names do not cross over: an official DeepSeek key against the Zivv URL, or a Zivv key against the official URL, returns 401, and an official model name on Zivv (or a Zivv id on the official API) comes back as a model error.
Using DeepSeek in Claude Code and Cursor
Claude Code
Claude Code speaks the Anthropic protocol. Through Zivv, set these environment variables:
export ANTHROPIC_BASE_URL=https://zivv.pro
export ANTHROPIC_AUTH_TOKEN=sk-your-zivv-key
export ANTHROPIC_MODEL=deepseek-v4-pro-ga-260813
export ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek-v4-1-flash-261017
claudeANTHROPIC_DEFAULT_HAIKU_MODEL sets the model Claude Code uses for lightweight background tasks; pointing it at DeepSeek as well stops those requests from looking for a Claude model. Note that ANTHROPIC_BASE_URL is just the domain, with no /v1.
To go direct to DeepSeek instead, set ANTHROPIC_BASE_URL to the Anthropic-compatible address from the official docs, ANTHROPIC_AUTH_TOKEN to your DeepSeek key, and the model names to what the docs list. The full Claude Code setup is in the Claude Code API setup guide, and the trade-offs of running Claude Code on Chinese models are in the DeepSeek, Qwen and GLM guide.
Cursor
Cursor uses the OpenAI-compatible protocol: in the model settings under Cursor Settings, enter an OpenAI API key, enable Override OpenAI Base URL, and add model names manually with Add model.
- Through Zivv: base URL
https://zivv.pro/v1, then add an id such as deepseek-v4-1-flash-261017 - Direct: the official base URL, then a model name from the official docs
Do not append /chat/completions to the base URL, and match the model id character for character. Step-by-step setup and Verify troubleshooting are in Cursor custom API setup. Cherry Studio and Cline work the same way; see the Cherry Studio guide and the Cline guide.
Common Errors: 401, 402, 404
| Error | Usual cause | Fix |
|---|---|---|
| 401 | Wrong or truncated key, stray whitespace, or a key and base URL from different providers | Copy the key again and test it with the /models call above; make sure key and URL come from the same platform |
| 402 | Insufficient balance (DeepSeek's error code docs define 402 this way) | Top up; on Zivv, also distinguish balance from key budgets and quotas |
| 404 / unknown model | Misspelled model name, a model name from another platform, or a base URL with a missing or extra path | List current ids with /models; an OpenAI-format base URL stops at /v1 or the domain |
| 429 | Too many requests or too much concurrency | Lower concurrency and retry with backoff |
Zivv returns 403 model 'xxx' has no pricing configured | The name is not in Zivv's catalog, typically an official DeepSeek model name used on Zivv | Copy the exact id from /v1/models or the Model Hub |
Zivv returns 400 model "xxx" is not available, please use a different model | The key's group has no channel serving that DeepSeek model | Use a group that includes DeepSeek, or a smart routing key |
Depending on the platform, a bad model name can come back as 400 or 404, so read the error body rather than the status code alone. Detailed walkthroughs: 401 Unauthorized, 402 insufficient balance, 404 model not found and 429 rate limits; permission errors such as a key-level model allowlist are covered in 403 permission denied.
FAQ
Where do I get a DeepSeek API key?
Sign up and log in at the DeepSeek Platform, platform.deepseek.com, then create a key on the API keys page. Keys start with sk- and are usually shown in full only at creation, so copy yours right away. Your account needs a balance before calls succeed, otherwise the API returns 402. A web chat or app account does not give you an API key.
What is the DeepSeek API base URL?
The official base URL is https://api.deepseek.com. It is OpenAI-compatible, with chat at /chat/completions, and the docs note that https://api.deepseek.com/v1 also works, where v1 does not refer to a model version. Tools that speak the Anthropic protocol can use the Anthropic-compatible address from the official docs. Through Zivv, use https://zivv.pro/v1 for the OpenAI format and https://zivv.pro for the Anthropic format.
Which DeepSeek model name should I use?
Official model names have changed across releases, so names from older tutorials may no longer work. The reliable way is to call https://api.deepseek.com/models with your key; the returned ids are the names you can use. On Zivv, use the Model Hub ids, such as deepseek-v4-1-flash-261017 or deepseek-v4-pro-ga-260813. Model names from one platform do not work on the other.
Can I use my official DeepSeek key on Zivv?
No. Each platform only accepts its own keys: an official key works with the official base URL, and a Zivv key, created in the Zivv console, works with https://zivv.pro/v1. Mixing them returns 401.
Is DeepSeek through Zivv the same model as the official API?
Zivv's DeepSeek models are served by two upstreams, Volcengine and Alibaba Cloud Bailian, and their ids carry version numbers that differ from DeepSeek's own naming. If you need behavior identical to the official API, or new official features on day one, go direct. If one key for many vendors, a single balance and per-request usage records matter more, Zivv is the more convenient route.