// Models · API key guide
DeepSeek API key: how to get one
Create the key in DeepSeek’s own console, then call https://api.deepseek.com with any OpenAI-compatible SDK.
5 stepsofficial docs onlychecked 2026-10-26
01How to get a DeepSeek API key
- Open the DeepSeek Open Platform at platform.deepseek.com and sign up / log in (sign-up options are shown on the page).
- Go to “API keys” (platform.deepseek.com/api_keys) and click “Create new API key”; give it a name.
- Copy the key right away – store it in an environment variable such as DEEPSEEK_API_KEY.
- Check your balance under “Usage / Top up” (or call GET /user/balance). Requests fail when both the topped-up and the gifted balance are 0.
- Call the API with base_url https://api.deepseek.com and model deepseek-flash (or deepseek-v4-pro).
Official key page: https://platform.deepseek.com/api_keys – console labels may change; follow what the official page shows.
02Real-name, phone and credit card requirements
| Real-name / ID verification | The API docs we checked do not state it; the console tells you if verification is needed before topping up – follow the official prompt. |
|---|---|
| Phone number | Not stated in the API docs – use whatever sign-up methods the platform offers. |
| Credit card / payment | No credit card requirement is mentioned; payment methods are listed on the top-up page. |
03Base URL and a minimal call
https://api.deepseek.comhttps://api.deepseek.com/anthropicDEEPSEEK_API_KEY · Example model:deepseek-flashcurl
curl https://api.deepseek.com/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DEEPSEEK_API_KEY" \
-d '{
"model": "deepseek-flash",
"messages": [{"role": "user", "content": "你好"}]
}' Python
# 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="deepseek-flash",
messages=[{"role": "user", "content": "你好"}],
)
print(resp.choices[0].message.content) 04Free quota
All free AI APIs →There is a “gifted balance” mechanism (the balance API returns granted_balance, and the billing rule says the gifted balance is used first), but the terms say free credit is whatever the platform currently announces – no fixed amount is published. Check your own console. See the DeepSeek free-API page for details.
05DeepSeek API prices
All model prices →Off-peak hours are half price (peak = Beijing time Mon–Fri 9:00–12:00 and 14:00–18:00, excluding holidays).
| Model | Input / 1M tokens | Output / 1M tokens | Source |
|---|---|---|---|
DeepSeek V4.1 Flash 1017 (deepseek-flash)deepseek-flash | ¥2 | ¥8 | official · 2026-11-19 |
DeepSeek V4 Pro 0813 (deepseek-v4-pro)deepseek-v4-pro | ¥9 | ¥27 | official · 2026-10-19 |
Standard (non-batch) list prices from our price database; cheapest first, max 8 rows. Prices change – the official page wins.
06Keep your API key safe
- Concurrency limits: Flash 2,500, Pro 500; above that you get HTTP 429 – retry with back-off rather than creating more keys.
- Keep the key in an environment variable or a secrets manager – never hard-code it, never commit it to Git, never paste it into a screenshot, chat or issue.
- Never put a long-lived key in front-end, mobile or desktop client code – anyone can extract it. Call the API from your own server.
- One key per project or environment, so a leak can be revoked without breaking everything else.
- If a key leaks, delete it in the console immediately and create a new one, then check usage and billing.
- Do not buy keys from resellers or “API relays” and do not paste your key into websites you do not trust.
07FAQ
FAQ
Is the DeepSeek API free?
No free tier with a published amount. New accounts may see a gifted balance in the console (shown as granted_balance), but the terms make the free credit subject to what the platform announces. Otherwise it is pay-as-you-go.
What is the DeepSeek API base URL?
https://api.deepseek.com for the OpenAI format, and https://api.deepseek.com/anthropic for the Anthropic format.
Where do I create the DeepSeek API key?
Only at platform.deepseek.com/api_keys after logging in. The key is shown when created – copy it then.
08Official sources
- DeepSeek API 文档 · 首次调用 api-docs.deepseek.com
- DeepSeek 模型 & 价格 api-docs.deepseek.com
- DeepSeek 查询余额 API api-docs.deepseek.com
- DeepSeek 开放平台服务条款 cdn.deepseek.com
All facts checked against these pages on 2026-10-26. If anything differs, the official page wins.