DeepSeek for Developers: A Practical API Guide (October 2026)

You inherited a service that still sends deepseek-chat, your team lead wants the bill under control, and you need to know what the current DeepSeek API expects. This guide answers those questions for working developers. DeepSeek for developers in October 2026 means one OpenAI-compatible base URL, two model IDs (deepseek-flash and deepseek-v4-pro), a 1-million-token context, and a stateless POST /chat/completions endpoint that you already know how to call. Below: a quickstart, the parameters that matter, cost math for both models at peak and off-peak rates, and where DeepSeek falls short.
The current DeepSeek API models

DeepSeek’s Models & Pricing page lists two models as of October 2026. deepseek-flash is served by DeepSeek-V4.1-Flash-1017 (released 17 October 2026) and is the only current model with image input. deepseek-v4-pro is served by DeepSeek-V4-Pro-0813 (released 13 August 2026), the official release that superseded the April 2026 DeepSeek V4 preview. Both offer a 1M-token context, up to 384K output tokens, JSON output, tool calls, the Anthropic and Responses API formats, and thinking mode, which is on by default. They differ in price, vision support and concurrency limits (2,500 concurrent requests per account for deepseek-flash, 500 for deepseek-v4-pro, per DeepSeek’s rate-limit page).
If your code still sends deepseek-chat or deepseek-reasoner, it is out of date: those IDs were scheduled for retirement on 2026-07-24 at 15:59 UTC and are no longer listed in the official docs. The legacy names deepseek-v4-flash and deepseek-v4-flash-vision-exp are still accepted, but DeepSeek’s docs say those models are retired and the requests are served by DeepSeek-V4.1-Flash-1017 and billed at the Flash price. Migrating is a change to the model field; the base_url stays the same.
Quickstart: minimal Python and curl
The DeepSeek API is OpenAI-compatible. Chat requests hit POST /chat/completions against base URL https://api.deepseek.com. The OpenAI Python SDK works unchanged — swap the base URL and key, and pass DeepSeek-specific fields such as thinking in extra_body. This example turns thinking off so that temperature takes effect:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("DEEPSEEK_API_KEY"),
base_url="https://api.deepseek.com",
)
resp = client.chat.completions.create(
model="deepseek-flash",
messages=[
{"role": "system", "content": "You are a terse code reviewer."},
{"role": "user", "content": "Review this diff: ..."},
],
temperature=0.0,
max_tokens=2000,
extra_body={"thinking": {"type": "disabled"}},
)
print(resp.choices[0].message.content)
The same call in curl:
curl https://api.deepseek.com/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DEEPSEEK_API_KEY}" \
-d '{
"model": "deepseek-flash",
"messages": [{"role": "user", "content": "ping"}],
"thinking": {"type": "disabled"},
"temperature": 0.0
}'
DeepSeek also supports the Anthropic API format at a separate base URL, https://api.deepseek.com/anthropic, which is useful if you already use the Anthropic SDK or run agent harnesses such as Claude Code. DeepSeek’s API docs carry agent-integration guides for Claude Code, Codex, OpenCode, OpenClaw and others. Its Claude Code guide (checked 27 October 2026) sets ANTHROPIC_BASE_URL to that Anthropic endpoint and ANTHROPIC_AUTH_TOKEN to your DeepSeek API key. See our DeepSeek OpenAI SDK compatibility notes for the supported parameters.
Stateless API: the one thing the docs bury
The API does not remember prior turns. You must resend the full messages array on every request to sustain a conversation. Do not expect it to behave like DeepSeek chat on the web and mobile app: the API is a separate surface, and conversation state lives in your client. New developers who mix up the two surfaces end up debugging a “memory loss bug” that does not exist.
For multi-turn agents, that means you own the history-trimming policy: drop the earliest turns as you near the 1M-token cap, summarise stale tool output, and rely on context caching (covered below) to keep repeated prefixes cheap.
deepseek-flash vs deepseek-v4-pro: which model for which job

The two model IDs share the same wire protocol and most features. Pick by feature needs and budget. Prices are USD per 1M tokens, peak / off-peak, as of October 2026 (official pricing page):
| Model ID | Served by | Cache-hit input | Cache-miss input | Output | Vision | Concurrency |
|---|---|---|---|---|---|---|
deepseek-flash |
DeepSeek-V4.1-Flash-1017 | $0.006 / $0.003 | $0.30 / $0.15 | $1.20 / $0.60 | Yes | 2,500 |
deepseek-v4-pro |
DeepSeek-V4-Pro-0813 | $0.044 / $0.022 | $1.32 / $0.66 | $3.96 / $1.98 | Not supported | 500 |
Peak hours are 01:00–04:00 and 06:00–10:00 UTC, Monday to Friday, excluding Chinese public holidays; every other hour, including weekends, is billed at the off-peak rate, which is half the peak rate. deepseek-v4-pro costs 3.3× deepseek-flash on output, 4.4× on cache-miss input and about 7.3× on cache-hit input, in both periods.
On capability, DeepSeek’s own numbers do not make the choice for you. DeepSeek’s 10 September 2026 release notes say tests by multiple parties put V4.1-Flash ahead of V4-Pro on performance, cost, speed and total runtime. On the DeepSeek-V4-Pro-0813 model card, DeepSeek reports 87.9 on Terminal Bench 2.1 and 62.7 on DeepSWE, against 85.0 and 58.0 for Opus-4.8 in the same table (DeepSeek-reported; code-agent tasks run with DeepSeek Harness at max effort). The DeepSeek-V4.1-Flash-1017 card reports 77.0 on DeepSWE v1.1 and 42.3 on Terminal-Bench 4.0 — different benchmark versions, so the two cards cannot be compared line by line. For an autonomous coding agent, measure cost per completed task on your own workload rather than the headline per-token rate. DeepSeek for coding goes deeper on the agent setup.
Thinking mode is a parameter, not a model
There is no separate “reasoner” model ID. Both current models support thinking and non-thinking mode, and thinking is the default (effort high). You control it with request parameters:
- Non-thinking — pass
extra_body={"thinking": {"type": "disabled"}}. Use it for latency-sensitive chat, classification and routine codegen. FIM completion (Beta) runs in non-thinking mode only. - Thinking (default) —
reasoning_efforttakes"low","high"(default) or"max". DeepSeek’s 13 August 2026 guidance:lowfor simple tasks,highfor daily agent tasks,maxfor more complex scenarios. The response returnsreasoning_contentalongside the finalcontent. - Tool calls in thinking mode — when a request carries
tools, pass thereasoning_contentof all previous turns back to the API; otherwise it returns a 400 error.
resp = client.chat.completions.create(
model="deepseek-v4-pro",
messages=[{"role": "user", "content": "Plan a zero-downtime DB migration."}],
reasoning_effort="high",
extra_body={"thinking": {"type": "enabled"}},
)
print(resp.choices[0].message.reasoning_content) # reasoning_content
print(resp.choices[0].message.content) # the final answer
Parameters every developer should know
DeepSeek publishes temperature defaults by task type. They apply to non-thinking mode only: in thinking mode (the default) temperature, presence_penalty and frequency_penalty are accepted without error but have no effect.
temperature=0.0— code generation and mathematicstemperature=1.0— data analysis and data cleaningtemperature=1.3— general conversation and translationtemperature=1.5— creative writing
Other parameters worth touching first:
top_p— nucleus sampling, with model-specific behaviour: ondeepseek-flashit only takes effect in thinking mode (effective range 0.95–1.0); ondeepseek-v4-proit is ignored in thinking mode and takes effect in non-thinking mode.max_tokens— output cap. Both models support up to 384K output tokens. Set it high enough that JSON-mode replies are not truncated, and leave room for reasoning tokens in thinking mode.stream=true— server-sent events. With thinking enabled, reasoning content streams alongside final content.response_format={"type": "json_object"}— JSON mode. Designed to return valid JSON, not guaranteed; the prompt should include the word “json” and a small example schema, and you should still handle occasional empty content. See DeepSeek API JSON mode for the full pattern.- Tool calling — OpenAI-compatible function-calling shape, on both models, in thinking and non-thinking mode.
For deeper coverage, DeepSeek API best practices walks through error handling, retries, and idempotency.
Cost math: what 1M calls actually costs
The most common mistake in DeepSeek cost estimates is collapsing input tokens into one bucket. The cache-hit rate only applies to the repeated prefix the provider has already seen; each new user message is a cache miss. The second mistake is ignoring the clock: the same traffic costs half as much off-peak.
Worked example — deepseek-flash. 1,000,000 calls, with a cached 2,000-token system prompt, 200 tokens of fresh user input per call, and 300 tokens of output per call:
PEAK OFF-PEAK
Input, cache hit : 2,000,000,000 tokens × $0.006/M = $12.00 × $0.003/M = $6.00
Input, cache miss : 200,000,000 tokens × $0.30/M = $60.00 × $0.15/M = $30.00
Output : 300,000,000 tokens × $1.20/M = $360.00 × $0.60/M = $180.00
------- -------
Total $432.00 $216.00
Same workload — deepseek-v4-pro.
PEAK OFF-PEAK
Input, cache hit : 2,000,000,000 tokens × $0.044/M = $88.00 × $0.022/M = $44.00
Input, cache miss : 200,000,000 tokens × $1.32/M = $264.00 × $0.66/M = $132.00
Output : 300,000,000 tokens × $3.96/M = $1,188.00 × $1.98/M = $594.00
--------- -------
Total $1,540.00 $770.00
On identical traffic, deepseek-v4-pro costs about 3.6× as much as deepseek-flash ($1,540.00 ÷ $432.00 at peak; $770.00 ÷ $216.00 off-peak). Real traffic usually straddles both periods, so the bill lands between the two totals. To plug in your own token estimates, the DeepSeek pricing calculator handles both models, and the DeepSeek token counter sizes individual prompts. DeepSeek context caching covers what counts as a cacheable prefix.
Workflows where DeepSeek pays off
Five common patterns:
1. Agentic coding via Claude Code or OpenCode
Point Claude Code at DeepSeek’s Anthropic-compatible endpoint and you keep the harness. DeepSeek’s Claude Code guide (checked 27 October 2026) maps Claude Code’s model slots to deepseek-flash; you can set deepseek-v4-pro instead, billed at the Pro price. Note that server-side Search and Fetch calls made through Claude Code are free only until per-request billing starts at 16:00 UTC on 31 October 2026 ($0.75 per 1,000 successful requests, per DeepSeek’s pricing page).
2. Long-context code review
The 1M-token context window means you can pass a large part of a mid-sized repository in a single prompt and ask for review across files. Keep the codebase as a stable prefix so it is billed at the cache-hit rate on repeat calls, and iterate with per-file user messages; the new diff in each request is billed at the cache-miss rate.
3. Local development with VS Code
For inline completions and chat in the editor, DeepSeek’s docs say coding assistants such as GitHub Copilot, Claude Code and OpenCode can use DeepSeek as the backend model directly. deepseek-flash is the cheaper choice for editor traffic. DeepSeek with VS Code walks through the configuration.
4. Retrieval-augmented generation
DeepSeek’s pricing page lists no embedding model, so pair a third-party embedding model with deepseek-flash for generation, and consider deepseek-v4-pro for synthesis steps if it scores better on your evaluation set. DeepSeek RAG tutorial covers a working pipeline using DeepSeek with LangChain.
5. Self-hosted inference
Both current models publish code and weights under MIT on Hugging Face. The files total about 893 GB for DeepSeek-V4-Pro-0813 and about 510 GB for DeepSeek-V4.1-Flash-1017, so either one needs multi-GPU server infrastructure. On Ollama, the deepseek-v4-pro and deepseek-v4.1-flash tags are cloud-only. Install DeepSeek locally and running DeepSeek on Ollama cover the practical setups.
Limitations to plan around
DeepSeek for developers is not a universal answer. Three gaps to plan around:
- Vision on one model only. Image input works on
deepseek-flash(JPEG, PNG, GIF and WebP, asimage_urlblocks); the pricing page lists Vision as not supported ondeepseek-v4-pro. Route image calls to Flash. - Knowledge-heavy tasks. On the DeepSeek-V4-Pro-0813 model card, DeepSeek reports 42.7 on HLE without tools, below Opus-4.8 (49.8) and Fable-5 with fallback (53.3) in the same table (DeepSeek-reported). If your use case depends on accurate real-world knowledge recall rather than code generation, evaluate other providers too.
- Data residency. Conversations against the public API are processed on servers subject to Chinese law. For regulated workloads, self-host the open weights or use a regional provider. DeepSeek privacy covers the trade-offs.
Migration checklist (legacy IDs → deepseek-flash)

- Inventory every call site that sends
model="deepseek-chat","deepseek-reasoner","deepseek-v4-flash"or"deepseek-v4-flash-vision-exp". - Replace them with
"deepseek-flash"as the default; move specific call sites to"deepseek-v4-pro"only where your own evaluation justifies the higher price. - Thinking is now on by default. Where you relied on
deepseek-chat’s non-thinking behaviour, passextra_body={"thinking": {"type": "disabled"}}; where you useddeepseek-reasoner, keep the default or setreasoning_effort. - Re-tune
max_tokensfor thinking mode — reasoning tokens count as output tokens. - Re-baseline your monthly cost projection against the current peak and off-peak rate card. Compare with peers in our DeepSeek vs ChatGPT writeup if you are in an active vendor review.
For the broader landscape of DeepSeek use cases, see the category hub.
Frequently asked questions
How do I migrate from deepseek-chat to the current models?
Change the model field from deepseek-chat to deepseek-flash (or deepseek-v4-pro). The base_url stays the same, and the OpenAI SDK call shape does not change. deepseek-chat and deepseek-reasoner were scheduled for retirement on 2026-07-24 at 15:59 UTC and are no longer listed in the official docs. Because thinking is now the default, pass {"thinking": {"type": "disabled"}} if you need deepseek-chat’s old non-thinking behaviour. See the DeepSeek API documentation guide for the details.
What is the difference between deepseek-flash and deepseek-v4-pro?
deepseek-flash is served by DeepSeek-V4.1-Flash-1017 and costs $0.30 / $0.15 per 1M cache-miss input tokens and $1.20 / $0.60 per 1M output tokens (peak / off-peak). deepseek-v4-pro is served by DeepSeek-V4-Pro-0813 and costs $1.32 / $0.66 cache-miss input and $3.96 / $1.98 output. Both share the 1M-token context, 384K maximum output, JSON mode, tool calling, streaming and thinking mode; only deepseek-flash accepts images. Flash is the default recommendation for high-volume work. The full breakdown lives in our DeepSeek V4-Pro page and the DeepSeek API pricing guide.
Does the DeepSeek API remember conversation history?
No. The POST /chat/completions endpoint is stateless. You must resend the full messages array on every request; conversation state lives in your client. Context caching makes resending repeated prefixes cheaper, not free — see the DeepSeek context caching guide for the cache-hit pricing.
Can I use the OpenAI Python SDK with DeepSeek?
Yes. The DeepSeek API matches OpenAI’s Chat Completions wire format. Set base_url="https://api.deepseek.com" and your DeepSeek API key, and the OpenAI SDK works without changes to your call sites; DeepSeek-specific fields such as thinking go in extra_body. DeepSeek also supports the Anthropic API format at https://api.deepseek.com/anthropic. DeepSeek OpenAI SDK compatibility covers parameter coverage and known gaps.
Is DeepSeek a good fit for coding agents?
It can be. DeepSeek documents integrations for Claude Code, Codex, OpenCode and other agents, and on its own model cards reports strong agentic-coding scores for both DeepSeek-V4-Pro-0813 and DeepSeek-V4.1-Flash-1017 (DeepSeek-reported). deepseek-flash is the cheaper default for editor-side completions and routine agent steps; evaluate deepseek-v4-pro on your own tasks before paying its higher rates. See DeepSeek Coder vs Copilot for an editor-focused comparison.
Sources & Methodology
Primary sources
- Model cardDeepSeek on Hugging FaceWeights, license, usage notes per modelLast checked: October 27, 2026
- RepositoryDeepSeek-AI on GitHubOpen-weight release details, training/inference notesLast checked: October 27, 2026
- PricingDeepSeek API pricing pagedeepseek-flash / deepseek-v4-pro model versions, peak and off-peak rates, peak-hour rule, 1M context, 384K output, vision on Flash only, Search/Fetch billing startLast checked: October 27, 2026
- Official documentationDeepSeek API docs: Your First API CallOpenAI-format samples, legacy-name routing, agent tools (Claude Code, GitHub Copilot, OpenCode)Last checked: October 27, 2026
- Official documentationDeepSeek Thinking Mode guidethinking default, reasoning_effort, ignored temperature in thinking mode, top_p behaviour, reasoning_content passback with toolsLast checked: October 27, 2026
- Official documentationDeepSeek: Integrate with Claude CodeANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN setup and deepseek-flash defaults (checked 27 Oct 2026)Last checked: October 27, 2026
- Model cardDeepSeek-V4-Pro-0813 model cardDeepSeek-reported HLE, Terminal Bench 2.1 and DeepSWE scores vs Opus-4.8 / Fable-5Last checked: October 27, 2026
- Model cardDeepSeek-V4.1-Flash-1017 model cardDeepSeek-reported DeepSWE v1.1 and Terminal-Bench 4.0 scoresLast checked: October 27, 2026
Methodology
Information in this article was checked against the official DeepSeek documentation, the article's cited primary sources, and the deepseekai.guide pricing dataset on the date shown above. Where third-party numbers are quoted, the originating source is linked inline so the reader can verify and re-check.
Data confidence
High for facts cited inline with primary-source links; medium for context narrative.
Editorial note
AI tooling moves quickly. If you spot an outdated number or a broken link, the contact link in the footer is the fastest way to flag it for the editorial team.
