Create the key
Use the official DeepSeek platform to create an API key. Do not paste it into a browser tool, repository, issue, or client-side bundle.
Open the official platformDeepSeek API · independent guide
A practical, non-official guide to DeepSeek API pricing, cache-aware token costs, OpenAI and Anthropic compatibility, API key setup, and the V4 Flash versus Pro decision.
Keyword research: “deepseek api” US 14.8K volume, 62% KD, $3.02 CPC; “deepseek api pricing” US 2.9K volume, 38% KD, $3.44 CPC. These are supplied market snapshots, not official DeepSeek metrics. Google Trends pricing exact-term interest was approximately 0, so this page does not call it a stable upward trend.
DeepSeek API pricing
DeepSeek bills input and output tokens separately. Cache hit is materially cheaper than cache miss; the calculator below lets you model the difference without making a live API request.
| Model | Cache-hit input | Cache-miss input | Output | Concurrency | Good starting fit |
|---|---|---|---|---|---|
| deepseek-v4-flashDeepSeek-V4-Flash · 1M context · max 384K output | $0.0028/M | $0.14/M | $0.28/M | 2,500 | High-throughput coding, routing, and everyday agent calls |
| deepseek-v4-proDeepSeek-V4-Pro · 1M context · max 384K output | $0.003625/M | $0.435/M | $0.87/M | 500 | Harder reasoning, larger refactors, and quality-first tasks |
Official Models & Pricing · The official page says product prices may vary. The current rate card does not list a separate peak-hour surcharge; peak demand can still affect latency, concurrency, or availability.
Token cost calculator
Compatible request formats
curl https://api.deepseek.com/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DEEPSEEK_API_KEY" \
-d '{
"model": "deepseek-v4-pro",
"messages": [{"role":"user","content":"Review this function for edge cases."}],
"thinking": {"type":"enabled"},
"reasoning_effort": "high",
"stream": false
}'DeepSeek API key setup
Use the official DeepSeek platform to create an API key. Do not paste it into a browser tool, repository, issue, or client-side bundle.
Open the official platformSet DEEPSEEK_API_KEY in your local secret manager or deployment environment. Rotate it if it appears in logs or commits.
Use deepseek-v4-flash or deepseek-v4-pro. The old deepseek-chat and deepseek-reasoner aliases are listed for deprecation at the official cutover date.
Record model, input/output token usage, cache state, latency, HTTP status, and retries. Avoid logging prompts that contain secrets.
Operational notes
“Is DeepSeek API free?” depends on credits, promotions, and account state. The API is metered; verify balance and current terms before production use.
Pin a current model ID and read the changelog. Compatibility aliases may map to a mode today and be removed later.
Do not assume a cache hit. Estimate both hit and miss paths, then compare with returned usage and billing records.
Continue the workflow
FAQ
The reviewed official rate card lists V4 Flash at $0.0028 per 1M cache-hit input tokens, $0.14 per 1M cache-miss input tokens, and $0.28 per 1M output tokens. V4 Pro lists $0.003625, $0.435, and $0.87 respectively. Prices may change, so check the official pricing page before budgeting.
The API is metered. Credits, promotions, balance, and account terms can change; do not assume the API is permanently free. Use the official platform and pricing page for current account details.
The official snapshot lists both with 1M context and up to 384K output. Flash has lower token rates and a higher listed concurrency limit; Pro costs more and is positioned for harder reasoning. Actual quality and latency depend on your task and route.
Yes. The official docs list https://api.deepseek.com for OpenAI-compatible requests and https://api.deepseek.com/anthropic for Anthropic-compatible requests. Configure the base URL and server-side key, then use a current DeepSeek model ID.
The current official quickstart lists those aliases for deprecation on July 24, 2026 at 15:59 UTC and maps them to V4 Flash modes. Pin deepseek-v4-flash or deepseek-v4-pro and check the changelog instead of building new integrations around old aliases.
No. It calculates input and output token costs locally from the reviewed official rate card. It does not accept or transmit API keys and cannot predict exact billing without the API response usage fields.