DeepSeek API Key: How to Get One and What It Costs
This guide covers creating a DeepSeek API key, balance-based billing, peak-hour rates and cache reads. The cost examples use stated token assumptions; they are not predictions of your bill.
Last updated: November 10, 2026 · verified against DeepSeek's official pricing page ↗
Step 1 — Create the key
- Go to
platform.deepseek.comand sign up (email or Google account). - Open API keys in the left sidebar.
- Click Create new API key, give it a name, and copy it immediately — DeepSeek shows the full key only once. If you lose it, delete the key and create a new one.
- Store it in an environment variable, never in code or a git repo:
export DEEPSEEK_API_KEY="sk-..."
Step 2 — Add credits (prepaid billing)
DeepSeek deducts usage charges from your topped-up or granted balance. Granted balance is used first when both are available. Check current top-up requirements and any account-specific credits in the official dashboard before paying.
Check your remaining balance and available billing controls in the platform dashboard before using the API in production.
Is the DeepSeek API free? API usage is metered separately from the chat app. Any granted credits depend on your account; do not assume ongoing free API usage. Estimate your token charges in the cost calculator before you commit.
Step 3 — Understand the pricing before you scale
The model you get is deepseek-flash (DeepSeek-V4.1-Flash). Prices below are off-peak rates per 1M tokens, verified November 2026:
| Token type | Off-peak | Peak |
|---|---|---|
| Input (cache miss) | $0.15 | $0.30 |
| Input (cache hit) | $0.003 | $0.006 |
| Output | $0.60 | $1.20 |
Two things surprise new users:
- Peak hours cost 2×. Peak windows are 01:00–04:00 and 06:00–10:00 UTC, Monday–Friday (excluding Chinese public holidays). If half your tokens run in peak windows, your blended bill is about 1.5× the off-peak estimate — see the worked examples.
- Cache hits are ~2% of the normal input price. Repeated system prompts and long static context bill at $0.003/1M instead of $0.15/1M. Design prompts so the static part stays at the front, and measure actual cache hits in your usage data. A repeated prompt does not guarantee a cache hit.
Step 4 — Make your first call
The API speaks the OpenAI schema, so most existing code needs only a base-URL change:
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": "Explain cache-hit pricing in one line."}],
)
print(resp.choices[0].message.content)
The same key also works with third-party apps that accept an OpenAI-compatible endpoint and key — chat frontends, IDE extensions, and agent frameworks. The pattern is always the same: paste the key, set the base URL to https://api.deepseek.com, and select deepseek-flash as the model. Check the app's own docs for where those fields live.
What your first month will cost
Using a common chat workload — 1,000 input + 500 output tokens per request, all off-peak, no cache hits:
| Requests / month | Cost |
|---|---|
| 10,000 | ~$4.50 |
| 100,000 | ~$45 |
| 1,000,000 | ~$450 |
At 100,000 requests per month with the same token counts, Claude Opus 5.5 costs $1,400 at its listed standard rates, excluding other fees. Compare any workload yourself in the calculator — set the cache ratio to match your prompt reuse.
Key hygiene (the part everyone skips)
- One key per environment. Separate keys for dev, staging and production so a leak can be rotated without downtime.
- Never commit keys. Use environment variables or a secrets manager. If a key lands in a public repo, delete it immediately — anyone can find it within minutes and spend your balance.
- Revoke exposed keys promptly. Rotate keys according to your security requirements, and update dependent services.
FAQ
- Do I need a Chinese phone number? Check the official signup flow for requirements in your region; signup methods and eligibility can change.
- Can I pay with a credit card? Top-up payment methods vary by region; check the billing page after signup. Use the methods offered for your account; this guide does not verify payment availability.
- Is
deepseek-reasonerstill a valid model name? Usedeepseek-flashfor the Flash model in this example. Check the official model list before migrating any legacy API name. - What's the context window? 1M tokens, with up to 384K max output.
Estimate your own monthly cost → · DeepSeek pricing deep-dive · Cheapest LLMs for coding