DeepSeek API pricing in 2026 is per million tokens, split by cache state. deepseek-v4-flash costs $0.14/1M input on a cache miss, $0.0028/1M on a cache hit, and $0.28/1M output. deepseek-v4-pro costs $0.435/1M input and $0.87/1M output. Both models expose a 1M-token context behind an OpenAI-compatible endpoint at api.deepseek.com. The legacy deepseek-chat and deepseek-reasoner aliases deprecate 2026/07/24.
DeepSeek API pricing in 2026 is per million tokens: deepseek-v4-flash costs $0.14/1M input (cache miss) and $0.28/1M output, while deepseek-v4-pro costs $0.435/1M input and $0.87/1M output. Both models expose a 1M-token context. To call it, point any OpenAI SDK at base_url https://api.deepseek.com, set your DeepSeek key, and pass deepseek-v4-flash or deepseek-v4-pro as the model.
The DeepSeek API in One Paragraph
DeepSeek is an AI lab that ships open-weight Mixture-of-Experts models and a hosted API to call them. The API endpoint is api.deepseek.com and it speaks the OpenAI wire format, so any OpenAI SDK works after you change the base URL and model name. Two models are live: deepseek-v4-flash for cost-sensitive workloads and deepseek-v4-pro for higher capability.
Both API models carry a 1M-token context window. Pricing is per million tokens and split by whether the input prefix is a cache hit or a cache miss. A cache hit (a repeated system prompt or few-shot block already in DeepSeek's context cache) is priced 50x lower than a cache miss on flash.
The open-weight side is where the architecture lives. DeepSeek-V3.2-Exp is 685B total MoE parameters under an MIT license, and DeepSeek-R1 is 671B total with 37B activated. These weights are downloadable for self-hosting, which is the main reason DeepSeek shows up in cost comparisons against closed APIs.
The deepseek-chat and deepseek-reasoner model names are legacy aliases of deepseek-v4-flash (non-thinking and thinking modes). They deprecate on 2026/07/24 at 15:59 UTC per DeepSeek's pricing page. Migrate calls to deepseek-v4-flash before that date and toggle thinking in the request rather than switching model names.
DeepSeek Models and Pricing
The table below lists the DeepSeek API models with context, per-1M input pricing (cache miss), per-1M output pricing, and notes. All figures are from DeepSeek's pricing page as of July 2026.
| Model | Context | Input (cache miss) | Output | Notes |
|---|---|---|---|---|
| deepseek-v4-flash | 1M | $0.14 | $0.28 | Cost tier. Cache hit input $0.0028. |
| deepseek-v4-pro | 1M | $0.435 | $0.87 | Capability tier. Cache hit input $0.003625. |
| deepseek-chat (legacy) | 1M | $0.14 | $0.28 | Non-thinking alias of flash. Deprecates 2026/07/24. |
| deepseek-reasoner (legacy) | 1M | $0.14 | $0.28 | Thinking alias of flash. Deprecates 2026/07/24. |
deepseek-v4-flash is the default for most work. At $0.14/1M input and $0.28/1M output it is one of the cheapest 1M-context models with frontier-adjacent coding scores. deepseek-v4-pro costs roughly 3.1x the input and 3.1x the output of flash and is the choice when flash misses on harder reasoning.
deepseek-chat and deepseek-reasoner are not separate models. They are the non-thinking and thinking modes of deepseek-v4-flash, exposed under distinct names for compatibility. After the 2026/07/24 deprecation, you call deepseek-v4-flash and set thinking through the request body.
Cache Hit vs Cache Miss Pricing
DeepSeek prices input tokens differently depending on whether the prefix is already in its context cache. A cache hit means a leading chunk of your prompt (system instructions, few-shot examples, a long document you keep re-sending) matches a recently processed prefix. DeepSeek charges the cache-hit rate for those tokens and the cache-miss rate for the rest.
| Model | Input (cache hit) | Input (cache miss) | Hit vs miss ratio |
|---|---|---|---|
| deepseek-v4-flash | $0.0028 | $0.14 | 50x cheaper on hit |
| deepseek-v4-pro | $0.003625 | $0.435 | 120x cheaper on hit |
The practical effect is large for agent workloads. A coding agent re-sends the same system prompt and tool definitions on every turn. Those tokens land as cache hits, so the marginal input cost of each turn drops toward the cache-hit rate. Structure prompts so the stable prefix comes first and the per-request content comes last to maximize cache hits.
The tradeoff: cache behavior is not guaranteed across every request, and pricing assumes a recently seen prefix. Cold prefixes, frequently changing system prompts, and one-shot calls pay the full cache-miss rate. Do not budget your whole input at the cache-hit price.
deepseek-chat vs deepseek-reasoner
deepseek-chat answers directly. deepseek-reasoner emits a chain-of-thought before the answer, which raises accuracy on math and multi-step coding at the cost of more output tokens and higher latency. Both are modes of the same underlying deepseek-v4-flash model and both legacy names retire on 2026/07/24.
deepseek-chat (non-thinking)
Direct answers, fewer output tokens, lower latency. Use for edits, formatting, summarization, and straightforward generation where the answer does not need a reasoning trace.
deepseek-reasoner (thinking)
Emits a reasoning trace before the answer. Higher accuracy on AIME-style math and multi-step debugging, but more output tokens and slower. Use for hard reasoning where the extra cost pays off.
Because reasoner produces more output tokens, its effective cost per answer is higher even at the same $0.28/1M output rate. Reserve thinking mode for prompts where a chain-of-thought measurably improves the result, and route easy prompts to non-thinking. A router that classifies difficulty handles this split automatically.
Context Window and Architecture
The hosted API models expose a 1M-token context window. The open-weight checkpoints behind the line expose smaller windows: DeepSeek-V3.2-Exp supports 163,840 tokens (160K) and DeepSeek-R1 supports 128K. If you self-host the weights, plan around the checkpoint window, not the 1M API figure.
| Checkpoint | Total params | Context | License | Released |
|---|---|---|---|---|
| DeepSeek-V3.2-Exp | 685B (MoE) | 163,840 (160K) | MIT | Nov 17, 2025 |
| DeepSeek-R1 | 671B / 37B active | 128K | MIT | Jan 22, 2025 |
DeepSeek-V3.2-Exp introduces DeepSeek Sparse Attention (DSA), a sparse attention mechanism for long-context training and inference efficiency, per its Hugging Face model card. Sparse attention is what makes a 160K-token window practical on a 685B-parameter MoE without the quadratic cost of dense attention at that length.
DeepSeek-R1 is a Mixture-of-Experts model with 671B total parameters and 37B activated per token. Only the activated experts run on each forward pass, so inference cost tracks the 37B active count rather than the 671B total. Both checkpoints are MIT-licensed, which permits commercial use and self-hosting.
For a broader treatment of how context length affects cost and quality, see LLM context windows.
Benchmarks
Published scores place DeepSeek-V3.2-Exp in the top open tier for coding and reasoning. The table reports model-card figures. Treat cross-model comparisons cautiously, since harness and prompt differences move scores by several points.
| Benchmark | DeepSeek-V3.2-Exp | DeepSeek-R1 |
|---|---|---|
| SWE-bench Verified | 67.8 | 49.2 |
| LiveCodeBench | 74.1 | n/a |
| AIME (2025 / 2024) | 89.3 (2025) | 79.8 (2024) |
| MMLU-Pro / MMLU | 85.0 (Pro) | 90.8 (MMLU) |
| Codeforces rating | 2121 | 2029 |
| GPQA-Diamond | 79.9 | n/a |
The SWE-bench Verified jump from 49.2 (R1) to 67.8 (V3.2-Exp) is the headline for coding agents: a 18.6-point gain on real GitHub issue resolution between the January 2025 reasoning checkpoint and the November 2025 release. DeepSeek-R1 still posts strong pure-math numbers, with 97.3 on MATH-500 and 79.8 on AIME 2024.
For how these scores stack against other open models, see the best open-source coding model in 2026.
OpenAI-Compatible Calls
The DeepSeek API is a drop-in for the OpenAI SDK. Change base_url to https://api.deepseek.com, set your DeepSeek key, and pass deepseek-v4-flash or deepseek-v4-pro as the model. Streaming, function calling, and the message array work as they do against OpenAI.
Call the DeepSeek API with the OpenAI Python SDK
from openai import OpenAI
client = OpenAI(
api_key="YOUR_DEEPSEEK_API_KEY",
base_url="https://api.deepseek.com", # OpenAI-compatible endpoint
)
resp = client.chat.completions.create(
model="deepseek-v4-flash", # or "deepseek-v4-pro"
messages=[
{"role": "system", "content": "You are a senior Python engineer."},
{"role": "user", "content": "Write a retry decorator with exponential backoff."},
],
)
print(resp.choices[0].message.content)The same shape works from cURL. Set the Authorization header to your key and POST the OpenAI-style body to the chat completions path.
Call the DeepSeek API with cURL
curl https://api.deepseek.com/chat/completions \
-H "Authorization: Bearer YOUR_DEEPSEEK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-flash",
"messages": [
{"role": "user", "content": "Explain MoE routing in two sentences."}
]
}'Because the contract is OpenAI-shaped, a single OpenAI-compatible client can target DeepSeek, OpenAI, or an LLM router by swapping the base URL. Any OpenAI-compatible endpoint follows the same format, so the call changes only the host and model name.
How DeepSeek Pricing Compares
DeepSeek's value is the combination of a 1M-token context and per-1M prices well under most hosted frontier APIs. The table below sets deepseek-v4-flash and deepseek-v4-pro against two other open-weight APIs from the same facts pack to anchor the range. Closed-model comparisons are omitted where verified numbers were not available.
| Model | Input | Output | Context |
|---|---|---|---|
| deepseek-v4-flash | $0.14 | $0.28 | 1M |
| deepseek-v4-pro | $0.435 | $0.87 | 1M |
| MiniMax-M2 | $0.30 | $1.20 | ~196K |
| GLM-4.6 | $0.60 | $2.20 | 200K |
On output price, deepseek-v4-flash at $0.28/1M undercuts MiniMax-M2 ($1.20/1M) and GLM-4.6 ($2.20/1M) by 4x to 8x, while carrying a larger 1M-token context. deepseek-v4-pro at $0.87/1M output still sits below both. The cache-hit input rate ($0.0028/1M on flash) widens the gap further on repeated-prefix workloads.
The tradeoff is operational, not headline price. A single-provider API means a single point of rate limits, region, and capacity. Routing across providers through one endpoint hedges that. See LLM cost optimization for the full set of levers (caching, routing, batching, model tiering).
DeepSeek on the Official API vs on Morph
The official DeepSeek API is not the only way to call a DeepSeek model over the OpenAI wire format. Morph serves a fast DeepSeek variant, DeepSeek V4 Flash (morph-dsv4flash), on custom inference kernels behind the same OpenAI-compatible contract. You change the base URL to https://api.morphllm.com/v1 and the model name to morph-dsv4flash; the request and response shapes are unchanged.
Morph's hosted DeepSeek V4 Flash carries a 1M-token context and prices at $0.139/1M input and $0.278/1M output, with no separate cache-hit tier to reason about. The two paths differ in what they optimize: DeepSeek's own API exposes a cache-hit rate that rewards repeated prefixes, while Morph runs a single flat rate on kernels tuned for throughput. Pick by workload shape, not headline price alone.
| Path | Model name | Input (per 1M) | Output (per 1M) | Context |
|---|---|---|---|---|
| DeepSeek API | deepseek-v4-flash | $0.14 (miss) / $0.0028 (hit) | $0.28 | 1M |
| Morph API | morph-dsv4flash | $0.139 (flat) | $0.278 | 1M |
When your prompt has a large stable prefix that hits DeepSeek's context cache on most turns, the official API's $0.0028/1M cache-hit input rate wins on marginal cost. When prefixes churn, calls are one-shot, or you want one endpoint that also fronts other open-weight models, Morph's flat $0.139/$0.278 is the simpler line to budget. Both are OpenAI-compatible, so switching between them is a base-URL and model-name change.
Morph serves DeepSeek V4 Flash alongside other open-weight models (GLM-5.2, Qwen 3.5, MiniMax M3) through one key. See fast general coding models for the full lineup, DeepSeek V4 for the open-weight architecture, and Morph pricing for per-token rates across every model.
Getting an API Key
Create a DeepSeek platform account, open the API keys section, and generate a key. Set it as the api_key in the OpenAI SDK or as an Authorization Bearer header, then point base_url at https://api.deepseek.com. Billing is usage-based at the per-1M-token prices above, metered on input (split by cache state) and output.
Frequently Asked Questions
How much does the DeepSeek API cost?
deepseek-v4-flash costs $0.14/1M input on a cache miss, $0.0028/1M on a cache hit, and $0.28/1M output. deepseek-v4-pro costs $0.435/1M input (cache miss), $0.003625/1M (cache hit), and $0.87/1M output. Both have a 1M-token context. Prices are from DeepSeek's pricing page as of July 2026.
What is the difference between deepseek-chat and deepseek-reasoner?
deepseek-chat is non-thinking (direct answer) mode and deepseek-reasoner is thinking (chain-of-thought) mode of deepseek-v4-flash. Both are legacy aliases that deprecate on 2026/07/24 at 15:59 UTC. After that you call deepseek-v4-flash and toggle thinking in the request.
What is the DeepSeek context window?
The deepseek-v4-flash and deepseek-v4-pro API models both expose a 1M-token context window. The open-weight checkpoints are smaller: DeepSeek-V3.2-Exp supports 163,840 tokens (160K) and DeepSeek-R1 supports 128K.
Is the DeepSeek API OpenAI-compatible?
Yes. Point the OpenAI SDK at base_url https://api.deepseek.com, set your DeepSeek key, and call client.chat.completions.create with model deepseek-v4-flash or deepseek-v4-pro. No code changes beyond the base URL and model name.
DeepSeek V4 vs R1: which should I use?
deepseek-v4-flash and deepseek-v4-pro are the current API models with a 1M context and split cache pricing. DeepSeek-R1 (671B total, 37B activated, 128K context, 49.2 on SWE-bench Verified) is the earlier January 2025 reasoning checkpoint. V4 supersedes R1 for new builds; R1 weights stay available under MIT for self-hosting.
How do I get a DeepSeek API key?
Create a DeepSeek platform account, generate a key in the API keys section, set it as the api_key in the OpenAI SDK, and point base_url at https://api.deepseek.com. Billing is usage-based per the prices above.
Related Resources
- DeepSeek V4 Flash on Morph: Specs and Pricing
- DeepSeek V4: Specs, Context, and Benchmarks
- Fast General Coding Models on Morph
- Morph API Pricing
- What Is an LLM Router? Automatic Model Routing
- LLM Cost Optimization
- LLM API Comparison
- LLM Context Windows Explained
- Best Open-Source Coding Model 2026
- Anthropic API Pricing
- LLM Cost Calculator
