DeepSeek API pricing has three main token categories: input that hits the context cache, input that misses the cache and generated output. On 2026-07-30, V4 Flash cost $0.0028, $0.14 and $0.28 per million tokens respectively; V4 Pro cost $0.003625, $0.435 and $0.87.
Current rate table
| Model | Input: cache hit | Input: cache miss | Output |
|---|---|---|---|
deepseek-v4-flash | $0.0028/M | $0.14/M | $0.28/M |
deepseek-v4-pro | $0.003625/M | $0.435/M | $0.87/M |
“M” means one million tokens. A token is a unit used by the model, not exactly one word. Punctuation, numbers, code and different languages can tokenize differently.
The cost formula
For one request:
cost = hit_tokens / 1,000,000 × hit_rate + miss_tokens / 1,000,000 × miss_rate + output_tokens / 1,000,000 × output_rate
Use the model’s response usage fields rather than estimating token categories after the fact. DeepSeek reports prompt_cache_hit_tokens, prompt_cache_miss_tokens and completion_tokens.
Example: V4 Flash request
Assume a request contains 10,000 cache-hit input tokens, 2,000 cache-miss input tokens and produces 1,500 output tokens.
- Cache hit: 10,000 / 1,000,000 × $0.0028 = $0.000028
- Cache miss: 2,000 / 1,000,000 × $0.14 = $0.00028
- Output: 1,500 / 1,000,000 × $0.28 = $0.00042
- Estimated total: $0.000728
Multiply by request volume and add retries, tool-loop turns and failed calls that still consumed tokens. The cost calculator guide expands this into a monthly model.
How context caching changes price
DeepSeek says disk-based context caching is enabled automatically. Subsequent requests can receive a hit when they reuse a matching persisted prefix. Current rules describe persistence at request boundaries, common-prefix detection and fixed intervals for long content.
Design stable content first: system instructions, reusable reference material and examples. Put request-specific content later. Do not insert timestamps or random IDs near the start if you want prefix reuse. Cache behaviour is an optimisation, not a guarantee.
Thinking and output tokens
Thinking mode can generate reasoning_content before the final answer. The usage object includes reasoning-token detail where applicable. These generated tokens consume output capacity and should be considered in cost and latency budgets.
Do not request maximum reasoning for every classification or extraction task. Use a representative evaluation to decide whether high or max effort improves success enough to justify additional output. In thinking mode, some sampling parameters are ignored according to the official guide.
V4 Flash versus V4 Pro economics
Flash has lower rates and a higher documented concurrency limit. Pro costs more and is positioned for more demanding work. Model price alone does not determine workload cost.
Track cost per accepted result, not cost per call. If Flash produces an acceptable result on 97% of tasks and Pro on 98%, the cheaper model may be preferable. If a complex task needs repeated Flash retries but succeeds once with Pro, Pro can be cheaper overall. This publication makes no universal performance claim.
Token controls that matter
Set a realistic max_tokens value to prevent runaway output and truncation. Remove redundant history, summarise completed turns and avoid repeatedly sending files the task no longer needs. Keep tool schemas concise but precise. Reject unexpectedly large user input before it reaches the API.
Monitor finish reasons. length indicates a cap or context limit was reached; blindly retrying with the same request can double cost without fixing the structure. tool_calls means the application must execute or reject the requested tool, then continue deliberately.
Budget and security controls
Keep keys on the server, rotate exposed credentials and separate development from production. Add per-user quotas, request-size limits, concurrency controls and alerts. Log model, token categories, status and a privacy-safe request identifier.
The official account concurrency limits were 2,500 for Flash and 500 for Pro when checked. A 429 response should trigger bounded exponential backoff with jitter, not an uncontrolled retry storm. Review the API errors guide.
Do taxes, currency and third-party fees apply?
The official table is in US dollars per million tokens. Actual payment handling, taxes, currency conversion or invoice terms can depend on account and jurisdiction. Check the platform checkout and legal terms.
A cloud marketplace or API aggregator can add its own rate, minimum purchase or support fee. Always cite the provider whose invoice you are estimating.
Use the current rates in the cornerstone DeepSeek pricing guide before applying any formula. This article explains the mechanics; the central pricing page is the publication’s re-verification point.
Conclusion
DeepSeek API cost is a three-part calculation, not simply “input plus output.” Separate cache hits from misses, include reasoning and tool turns, and measure accepted results. Store the verified rates centrally and recheck the primary pricing page whenever a model or alias changes.
Common questions
Frequently asked questions
Are spaces counted as tokens?
Tokenisation is model-specific. Use API usage fields or a compatible tokenizer rather than a word-count rule.
Is cache-hit pricing applied to the whole prompt?
No. Only qualifying cached prefix tokens are counted as hits; other prompt tokens are misses.
Are failed requests free?
Do not assume so. Record usage and status returned by the API and reconcile against the account.
Which model is cheaper?
V4 Flash has lower listed token rates. The cheaper model for a workflow depends on quality, retries and review cost.
Evidence
Sources
- Models & Pricing — official external destination
DeepSeek · official API pricing documentation · verified July 30, 2026
- Context Caching — official external destination
DeepSeek · official API documentation · verified July 30, 2026
- Your First API Call — official external destination
DeepSeek · official API documentation · verified July 30, 2026
- Rate Limit & Isolation — official external destination
DeepSeek · official API documentation · verified July 30, 2026
Practical guide