How to Get a DeepSeek API Key: Console, Balance, Base URL and Rate Limits
TL;DR: Create a DeepSeek API key on platform.deepseek.com and top up a balance; the API accepts both OpenAI and Anthropic formats, so most SDKs only need a new base URL and key.
DeepSeek’s API keys live on its open platform at platform.deepseek.com. The API speaks both the OpenAI and the Anthropic format, so most SDKs only need a new base URL and key.
Estimate your monthly API cost →All guides
Create the key
- Sign in to the DeepSeek open platform:
https://platform.deepseek.com/. - Open the API keys page (
https://platform.deepseek.com/api_keys) and create a key. - Store it as
DEEPSEEK_API_KEY, the variable used in DeepSeek’s examples (Your first API call).
The official FAQ is rendered client-side and we could not read it, so this guide does not state the sign-up requirements (phone, email or real-name), the exact button labels, the key prefix or whether the key is shown only once. The DeepSeek docs we checked do not mention regional restrictions.
Balance and billing
- Charges are deducted from granted balance (赠送余额) first, then from your topped-up balance. The amount and conditions of any granted balance are not stated on the pages we checked (模型 & 价格).
- When the balance runs out the API returns 402; top up at
https://platform.deepseek.com/top_up. DeepSeek asks you to “top up as needed based on actual usage” (错误码). - Prices are in CNY with peak and off-peak periods: off-peak is half price, and peak is 9:00–12:00 and 14:00–18:00 Beijing time on working days.
- The minimum top-up and payment methods are not stated on the pages we checked.
Our LLM cost calculator has an off-peak switch for DeepSeek, so you can compare both rates for your own traffic.
Base URL, auth and models
- OpenAI format:
https://api.deepseek.com - Anthropic format:
https://api.deepseek.com/anthropic - Header:
Authorization: Bearer ${DEEPSEEK_API_KEY} - Models:
deepseek-flash(currently served by DeepSeek-V4.1-Flash-1017) anddeepseek-v4-pro. The old namedeepseek-v4-flashstill works but is mapped to the new model.
Hello world
export DEEPSEEK_API_KEY="paste-your-key-here" # never commit this
curl https://api.deepseek.com/chat/completions \
-H "Authorization: Bearer ${DEEPSEEK_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-flash",
"messages": [{"role": "user", "content": "Say hello in one sentence."}]
}'
# Anthropic-format base URL: https://api.deepseek.com/anthropic
Rate limits and common errors
- Limits are concurrency per account, not per key: 2,500 for
deepseek-flashand 500 fordeepseek-v4-pro. Creating more keys does not raise them (限速与隔离). - 429 — over the concurrency limit. You can request more capacity through a support ticket, at no extra charge.
- 402 — insufficient balance; top up.
- Safety. Put the key in an environment variable, keep it out of Git and out of any code that runs in a browser or mobile app, and replace it if it is ever exposed. The API keys overview has the full checklist.
FAQ
Can I use the OpenAI SDK with DeepSeek?
Yes — set the base URL to https://api.deepseek.com and use your DeepSeek key.
Will a second API key double my rate limit?
No. Concurrency is counted per account, regardless of how many keys you have.
When is DeepSeek cheaper?
Outside peak hours (peak = 9–12 and 14–18 Beijing time on working days), when the price is halved.
Sources
Vendor features and prices were checked against these official pages on 2026-10-20. Products change; if something here no longer matches, the official page is right.
- DeepSeek API Docs — Your first API call
https://api-docs.deepseek.com/ - DeepSeek API 文档 — 模型 & 价格
https://api-docs.deepseek.com/zh-cn/quick_start/pricing - DeepSeek API 文档 — 错误码
https://api-docs.deepseek.com/zh-cn/quick_start/error_codes - DeepSeek API 文档 — 限速与隔离
https://api-docs.deepseek.com/zh-cn/quick_start/rate_limit