Estimate DeepSeek API cost by separating cached input, uncached input and output tokens, multiplying each by the verified rate, then adding retries and tool-loop turns. Every example below is an estimate using rates checked on 2026-07-30, not a quote or billing guarantee.
Step 1: choose the model and rates
| Model | Cache hit | Cache miss | Output |
|---|---|---|---|
| V4 Flash | $0.0028/M | $0.14/M | $0.28/M |
| V4 Pro | $0.003625/M | $0.435/M | $0.87/M |
Source: official DeepSeek pricing — official external destination, verified 2026-07-30. Replace these values whenever the central pricing record changes.
Step 2: measure a representative request
Do not start with a guess based only on word count. Run a small authorised pilot and record the usage object: prompt cache hits, prompt cache misses and completion tokens. Include ordinary requests, long conversations, errors, tool calls and thinking-mode tasks.
Use a median for typical cost and a high percentile for budget protection. Averages can hide a small number of huge prompts. Remove or hash prompt content in cost logs if it contains sensitive data.
Step 3: calculate one request
Use:
request_cost = hit/1,000,000 × hit_rate + miss/1,000,000 × miss_rate + output/1,000,000 × output_rate
Example for V4 Pro: 40,000 hit tokens, 5,000 miss tokens and 3,000 output tokens.
- Hit: 0.04 × $0.003625 = $0.000145
- Miss: 0.005 × $0.435 = $0.002175
- Output: 0.003 × $0.87 = $0.00261
- Estimated request: $0.00493
Keep more decimal places during calculation; round only for presentation.
Step 4: project monthly traffic
If the application expects 500,000 requests at $0.00493 each, the base model estimate is $2,465. Add growth, retries and unusual requests separately rather than hiding them in one multiplier.
For example:
- base requests: $2,465
- 4% retry and tool-loop overhead: $98.60
- 15% traffic contingency: $384.54 on the combined subtotal
- planning estimate: about $2,948
This does not include taxes, third-party infrastructure, storage, engineering or support.
Model cache behaviour explicitly
DeepSeek caching works on matching persisted prefixes. Estimate at least three scenarios: low, expected and high cache-hit rate. Do not apply the cache price to all input just because prompts share a system message.
Track actual hit tokens from production. Stable reference material at the beginning can improve reuse, while changing timestamps, request IDs or user-specific content near the start can break a match. Read the context-caching guide before restructuring prompts.
Include thinking and tools
Thinking mode may generate reasoning tokens before final content. Tool workflows make multiple model calls: request a tool, submit the tool result and ask for completion. Each turn has input and output.
Estimate the entire task, not the visible final answer. Set a maximum number of agent turns and tool invocations. If a task exceeds the limit, stop with an error that a person can inspect rather than continuing indefinitely.
Account for failures
Authentication and validation errors may be caught before meaningful generation, while timeouts or server interruptions can occur after work begins. Do not assume every failed request has zero usage. Record returned usage where available and reconcile balance.
Use bounded retries only for transient failures. A 400 or 422 usually requires changing the request; repeating it wastes time. A 402 requires balance. A 429 needs pacing and backoff. The API error guide maps each case.
Compare cost per successful task
Run the same evaluation set through V4 Flash and V4 Pro. For each, record accepted result rate, review time, tokens and retries. Compute:
cost_per_accepted_task = total_model_cost / accepted_tasks
Add human review cost for business decisions. A model with a lower token rate can still be more expensive when corrections dominate.
Set operational safeguards
Enforce maximum input and output sizes, per-user daily limits and account alerts. Reject file types or tasks outside the product scope. Keep development keys separate and limit who can increase balance.
Create dashboards for requests, token categories, cost, model, status, latency and accepted-result rate. A sudden output-token increase can signal a prompt regression, looping agent or abuse.
Spreadsheet-ready columns
A cost sheet needs: date, model, requests, hit tokens, miss tokens, output tokens, the three rates, base cost, retry cost, contingency and notes. Store rates in one lookup table rather than copying them into every formula.
The full pricing source and verification date should appear beside the table. This makes later updates auditable and prevents mixed V3 and V4 prices.
Before copying an example rate into a budget, compare it with the centrally verified DeepSeek pricing guide. The formula is reusable; the numbers are dated inputs.
Conclusion
A reliable DeepSeek cost estimate is a workload model, not a single price multiplied by words. Measure real token categories, include reasoning and tool turns, compare cost per accepted result and maintain headroom. Recalculate whenever rates, models or prompts change.
Common questions
Frequently asked questions
How many words are one million tokens?
There is no fixed conversion. Language, code and punctuation change tokenisation. Use usage data.
Should I assume a 100% cache hit?
No. Build low, expected and high scenarios from measured prefix reuse.
Are examples on this page quotes?
No. They are estimates using a dated official rate table.
How often should I update the estimate?
Review after model or pricing changes, significant prompt changes and at least monthly for active workloads.
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