DeepSeek Prompt Templates: A Copy-Paste Library for V4-Pro and V4.1-Flash

Copy-paste DeepSeek prompt templates for deepseek-flash and deepseek-v4-pro: coding, JSON, reasoning, RAG, with thinking-mode, caching and cost tips.

Tools·April 25, 2026·By DS Guide Editorial
Title card for DeepSeek Prompt Templates: twelve copy-paste templates across five task types, plus a library of 23 prompt skeletons, free to copy and adapt.

A one-line request such as “write a marketing email” leaves the model to guess audience, tone and format. A template supplies them. This page collects twelve prompt templates built around what DeepSeek’s API documentation says (checked 22 October 2026) about message roles, thinking mode, JSON Output and context caching. They are short and structured and follow that documentation’s parameter guidance, including the fact that temperature only matters when thinking is disabled.

Below you will find our interactive library of 23 prompt skeletons, then twelve copy-paste templates organised by task (extraction, code, reasoning, writing and agentic tool use), written for DeepSeek’s current API models, deepseek-flash (DeepSeek-V4.1-Flash-1017) and deepseek-v4-pro (DeepSeek-V4-Pro-0813), as listed on the official pricing page on 22 October 2026.

Why prompt templates matter on DeepSeek V4-Pro and V4.1-Flash

Two API features matter. First, thinking is a request setting, not a separate model. The legacy names deepseek-chat and deepseek-reasoner were retired after 15:59 UTC on 24 July 2026; until then they routed to deepseek-v4-flash in non-thinking and thinking mode. That name is still accepted but retired, and served by DeepSeek-V4.1-Flash-1017 at the Flash price. Both current models think by default (effort “high”); turn thinking off with extra_body={"thinking": {"type": "disabled"}}. The same prompt can produce different outputs in the two modes.

Second, both models have a 1M-token context window and a maximum output of 384K tokens (pricing page, 22 October 2026), so templates can carry more examples; long prompts cost less when their stable part comes first, where the context cache can reuse it.

For background, see DeepSeek V4-Pro and our DeepSeek V4-Flash page (V4-Flash itself was retired on 10 September 2026). For prompt theory rather than ready-made templates, start with DeepSeek prompt engineering.

Screenshot of the deepseekai.guide prompt templates library, captured 22 October 2026, showing the search box, category filters and template cards.
Interactive tool

DeepSeek Prompt Templates Library

23 prompt skeletons with clearly separated sections. Search, filter by category, copy, fill the {placeholders}, send.

Code review (file-level)
Code
<role> Senior engineer reviewing a pull request for production code. </role> <task> Review the file below and surface defects: bugs, race conditions, security issues, perf problems, unclear naming. </task> <file> {paste your file here} </file> <output_format> Numbered list. For each item: file:line — issue — recommended fix. Skip nits. </output_format>
review pr quality
Bug repro from a stack trace
Code
<role> Debugger. </role> <context> Language / framework: {language} Observed error: {paste stack trace} Relevant code: {paste suspect file or function} </context> <task> 1. Identify the root cause in one sentence. 2. Provide a minimal repro (5–10 lines). 3. Show the fix as a unified diff. </task>
debug stack-trace repro
Refactor for readability
Code
<task> Refactor the function below for readability without changing behaviour. </task> <rules> - Keep public signatures identical. - Prefer early returns over deep nesting. - Add inline comments only where the WHY is non-obvious. - Output the refactored function only — no explanation. </rules> <code> {paste function} </code>
refactor readability
Test generation (table-driven)
Code
<task> Write table-driven tests for the function below. </task> <requirements> - Cover happy path, edge cases (empty, null, max, min, unicode), and 1–2 failure modes. - Use the project's existing test framework: {framework}. - Each case has: name, input, expected, expected_error. </requirements> <function> {paste function} </function>
tests table-driven
Generate a clean commit message
Code
<task> Write a commit message for the diff below. </task> <rules> - Subject line ≤ 50 chars, imperative mood. - Body lines wrap at 72 chars. - Explain the WHY, not the WHAT — the diff already shows the WHAT. - No trailers (no "Signed-off-by", no "Co-authored"). </rules> <diff> {paste diff} </diff>
commit git changelog
Explain a SQL query
Code
<task> Explain what the SQL query below does, in plain English, and identify any performance concerns. </task> <query> {paste SQL} </query> <output_format> 1. One-sentence summary. 2. Step-by-step walkthrough of the joins and filters. 3. Performance notes — full scans, missing indexes, cartesian risk. </output_format>
sql explain db
Article outline → draft
Writing
<role> Writer for a software engineering audience. </role> <task> Expand the outline below into a draft article. Conversational but technical. ~1200 words. </task> <outline> {paste outline} </outline> <voice> - No marketing language. - Concrete examples over abstract claims. - Short paragraphs. Subheads every 200–300 words. </voice>
outline draft article
Summarise a long doc (3 layers)
Writing
<task> Summarise the document below. </task> <requirements> - Three layers: (1) one-sentence TL;DR, (2) 5-bullet executive summary, (3) section-by-section summary. - Preserve specific numbers and named entities. - Flag anything ambiguous as [unclear]. </requirements> <document> {paste document} </document>
summary tldr document
Translate (matching register)
Writing
<task> Translate the source below into {target_language}. </task> <rules> - Preserve register (technical, formal, casual — match what the source is). - Keep proper nouns and code untouched. - Where a phrase doesn't translate cleanly, render it naturally and footnote with [literal: …]. </rules> <source> {paste source} </source>
translate localise
Draft a professional email reply
Writing
<task> Draft a reply to the email below. </task> <original> {paste email} </original> <my_position> {what I want to convey} </my_position> <rules> - Match the tone of the original. - Address every direct question. - Keep ≤ 150 words. - No emojis, no exclamation marks unless the original used them. </rules>
email reply professional
Polish without changing meaning
Writing
<task> Rewrite the text below to be clearer, more direct, and shorter — without changing any meaning, claim, or fact. </task> <rules> - Cut filler. Combine sentences only when clarity holds. - Active voice unless passive is required. - Don't paraphrase technical terms. - Output the rewrite only — no explanation. </rules> <text> {paste text} </text>
rewrite tone polish
Step-by-step problem solving
Reasoning
<task> Solve the problem below. </task> <problem> {paste problem} </problem> <format> 1. Restate the problem in your own words. 2. List unknowns and givens. 3. Sketch an approach. 4. Work it through, step by step. 5. State the final answer plainly. 6. Sanity-check by plugging the answer back into the problem. </format>
cot problem-solving
Decision tree (pick one)
Reasoning
<task> Help me decide between options below. Don't restate; recommend. </task> <options> - Option A: {describe} - Option B: {describe} - Option C: {describe} </options> <criteria_in_priority_order> 1. {first} 2. {second} 3. {third} </criteria_in_priority_order> <output_format> One paragraph: which option, then why in terms of the criteria. End with one risk and how to mitigate it. </output_format>
decision pick recommend
Steel-man and red-team an idea
Reasoning
<task> For the idea below, write the strongest possible case FOR it (steel-man), then the strongest case AGAINST it (red-team). </task> <idea> {paste idea or proposal} </idea> <rules> - Each side gets ~5 distinct arguments. - Don't hedge. Make each argument as forcefully as a true believer would. - End with: which side I'd believe more, and why. </rules>
critique red-team steelman
Structured extraction from text
Data
<task> Extract structured information from the input. </task> <schema> { "people": [{"name": str, "role": str, "company": str | null}], "dates": [{"date": str (ISO), "event": str}], "amounts":[{"value": number, "unit": str, "context": str}] } </schema> <rules> - Output strict JSON only — no prose, no code fences. - Use null for missing fields. - ISO 8601 for dates. </rules> <input> {paste text} </input>
extract json structured
Classification with explanations
Data
<task> Classify each item below into one of: {label_a}, {label_b}, {label_c}, other. </task> <rules> - Output JSON: [{"id": str, "label": str, "confidence": float 0-1, "reason": str}]. - "reason" must be ≤ 15 words. - Use "other" rather than guessing. </rules> <items> {paste items} </items>
classify labels confidence
SQL from English
Data
<task> Write a single SQL query that answers the question. </task> <schema> {paste CREATE TABLE statements or DBML} </schema> <question> {your question} </question> <rules> - Use only the tables/columns in <schema>. - Comment any non-obvious join. - No explanation outside the query. </rules>
sql nl2sql query
Clean and normalise messy CSV
Data
<task> Clean the CSV below: normalise dates to ISO 8601, trim whitespace, fix obvious typos, deduplicate rows by {key_column}, and flag suspicious values. </task> <rules> - Output the cleaned CSV. - Append a separate ## Issues section listing every change you made and any rows you flagged. </rules> <csv> {paste CSV} </csv>
csv clean transform
Tool-using agent system prompt
Agents
<role> A careful agent that uses tools when needed and reasons aloud before acting. </role> <tools_available> {list each tool name + one-line description} </tools_available> <process> 1. Read the user's goal carefully. 2. Think out loud (1–3 sentences) about what information you need. 3. Call a tool when you don't already know the answer. Never invent tool results. 4. After each tool result, decide: another tool, or final answer. 5. Give a clear, sourced final answer. </process> <rules> - One tool call per turn. - Cite tool results in the final answer ("according to the {tool_name} call …"). </rules>
tool-call system planner
Function-calling system prompt
Agents
<role> You call functions when the user's request needs external data or actions. </role> <rules> - Always prefer calling a function over guessing. - Match arguments exactly to the function schema. - After receiving a tool_result, reason briefly, then either call another function or produce the final answer. - If no function fits, ask the user a clarifying question — don't hallucinate one. </rules>
function-call schema
Describe a UI screenshot
Vision
<task> Describe the UI in the attached image as if to someone who can't see it. </task> <format> 1. One-sentence overview (what kind of screen). 2. Layout: regions / panels / their relationship. 3. Notable controls and their state (enabled / disabled / selected). 4. Visible text content (preserve exactly). 5. Anything that looks broken or inconsistent. </format>
screenshot ui describe
Extract data from a chart image
Vision
<task> Read the chart in the attached image and return its data as a table. </task> <rules> - Output Markdown table with one row per data point. - Note the chart type, axis labels, and units. - For unlabelled values, estimate to within ±5% and flag as [estimated]. - If the chart is unreadable, say so plainly. </rules>
chart extract data
Grounded answer with citations
RAG
<role> Answer questions only using the provided source documents. Cite by [doc_id]. </role> <rules> - If the answer isn't in the sources, say "I don't have that information in the provided sources." - Every factual claim ends with one or more [doc_id] citations. - Don't mix in outside knowledge. </rules> <sources> {paste retrieved chunks, each prefixed with [doc_id]} </sources> <question> {user question} </question>
rag grounded citations

Each template separates its sections with XML-style tags. Replace every {placeholder} before sending. In thinking mode — the default on DeepSeek's current models — temperature has no effect.

The tool above, the DeepSeek Prompt Templates Library, holds 23 prompt skeletons you can search by title, body or tag and filter by category (Code 6, Writing 5, Reasoning 3, Data 4, Agents 2, Vision 2, RAG 1). Each separates its sections with XML-style tags, marks what you fill in as {placeholders} and has a Copy button. Its footnote notes that in thinking mode — the default on DeepSeek’s current models — temperature has no effect. The two Vision templates need deepseek-flash, because deepseek-v4-pro does not accept images. The twelve templates below are separate and use no XML-style tags.

The four-block template structure

The longer templates here follow a four-block layout, which keeps stable content at the front of the prompt, where DeepSeek’s context cache can reuse it; a cache hit needs a full match of a stored prefix (Context Caching guide).

  1. System block — role, constraints, output format. Stable across calls.
  2. Reference block — schemas, examples, retrieved documents. Mostly stable.
  3. Task block — what to do this turn. Changes per call.
  4. User input — the volatile content (a question, a file, a row).

Blocks 1 and 2 belong in the system message or the front of the first user message. Blocks 3 and 4 go in the latest user message.

Temperature settings to pair with each template

DeepSeek’s Temperature Parameter page (last modified 17 April 2026, before V4; checked 22 October 2026) gives a default of 1.0 and the values below. They apply only with thinking disabled: in thinking mode, the default, temperature is ignored without an error.

Task type Temperature (thinking disabled) Notes
Code generation, maths 0.0 DeepSeek’s suggested value for coding/maths
Data extraction, cleaning 1.0 DeepSeek’s suggested value for data cleaning/analysis; also the default
General Q&A, translation 1.3 DeepSeek’s suggested value for general conversation and translation
Creative writing, poetry 1.5 DeepSeek’s suggested value for creative writing/poetry

The Temperature Parameter page is no longer linked from the docs navigation. On deepseek-flash, temperature works only with thinking off and top_p only with thinking on (0.95–1.0), so they never act together. On deepseek-v4-pro both act only in non-thinking mode (Thinking Mode guide), where the API reference recommends changing one or the other, not both; its generic top_p note matches Flash.

Template 1 — Structured extraction (JSON mode)

For typed output, do as DeepSeek’s JSON Output guide instructs: set response_format={"type": "json_object"}, set max_tokens high enough to avoid truncation, and include the word “json” plus a small example schema in the prompt.

System:
You are a structured-data extractor. Return only valid JSON matching the schema.
Do not include prose. If a field is unknown, return null.

Schema (example):
{
  "company": "Acme Inc",
  "amount_usd": 12500.00,
  "invoice_date": "2026-04-12",
  "line_items": [{"sku": "A-1", "qty": 2, "price": 19.99}]
}

User:
Extract a json record from the email below. Use the schema above.

[paste email]

The API reference says JSON Output guarantees valid JSON, but the guide warns that the API may occasionally return empty content, and output is cut off if max_tokens is reached (finish_reason “length”). Our advice: keep a parser fallback and a retry (see our DeepSeek API JSON mode guide). Suggested setup: deepseek-flash, thinking disabled, temperature 1.0 (DeepSeek’s data cleaning/analysis value).

Template 2 — Code generation with constraints

Tell the model the language, the runtime, the libraries you allow, and the failure modes you do not want. With thinking disabled, DeepSeek’s suggested temperature for code is 0.0; with thinking on (the default), temperature is ignored.

System:
You are a senior Python engineer. Write Python 3.12 code only.
Allowed libs: stdlib, httpx, pydantic. No requests, no global state.
Return one fenced code block plus a 3-line explanation.

User:
Write a function fetch_invoices(api_key: str, since: date) -> list[Invoice]
that pages /v1/invoices?since=... and returns a list of Pydantic Invoice
models with id, amount_cents, currency, paid_at fields.

For multi-file refactors, keep thinking on and consider reasoning_effort="max"; deepseek-flash remains the sensible default (see the FAQ on Flash vs Pro). See also DeepSeek for coding.

Template 3 — Reasoning with thinking mode

Thinking mode is a parameter, not a model, and it is on by default with effort “high”. To set it explicitly with the OpenAI Python SDK, pass reasoning_effort="high" and extra_body={"thinking": {"type": "enabled"}}. Efforts are low, high and max; DeepSeek’s Change Log (13 August 2026) suggests max for complex tasks. The response returns reasoning_content alongside the final content. With “max”, max_tokens defaults to 128K and can be raised to 384K (API reference).

System:
You are a careful analyst. Think through the problem step by step in
reasoning_content. In content, return only the final answer in the
format requested.

User:
deepseek-flash charges $0.30 per 1M cache-miss input tokens, $0.006 per
1M cache-hit input tokens and $1.20 per 1M output tokens at peak;
off-peak rates are half that. Assume 1M calls/day, each with 2,000
cache-hit input + 200 cache-miss input + 300 output tokens. What is the
daily spend at peak and at off-peak rates, by bucket? Return a markdown table.

At these deepseek-flash rates (as of 22 October 2026), the hypothetical example works out as follows (2,000, 200 and 300 tokens × 1,000,000 calls; tokens ÷ 1,000,000 × rate):

  • Peak: 2,000,000,000 ÷ 1,000,000 × $0.006 = $12.00; 200,000,000 ÷ 1,000,000 × $0.30 = $60.00; 300,000,000 ÷ 1,000,000 × $1.20 = $360.00; total $432.00 a day
  • Off-peak: 2,000,000,000 ÷ 1,000,000 × $0.003 = $6.00; 200,000,000 ÷ 1,000,000 × $0.15 = $30.00; 300,000,000 ÷ 1,000,000 × $0.60 = $180.00; total $216.00 a day

All results are exact (no rounding). The example assumes every call hits the cache for its 2,000-token prefix (caching is best-effort) and that the 300 output tokens include any reasoning tokens.

Template 4 — Cache-friendly system prompt

On deepseek-flash, a cache hit costs $0.006 instead of $0.30 per 1M input tokens at peak ($0.003 vs $0.15 off-peak): 1/50 of the cache-miss price, or 98% less. On deepseek-v4-pro it is $0.044 vs $1.32 at peak ($0.022 vs $0.66 off-peak): 1/30, about 96.7% less (prices as of 22 October 2026).

Caching is on by default and best-effort: input that fully matches a prefix DeepSeek has already stored is billed at the hit price, but hits are not guaranteed, so check prompt_cache_hit_tokens in the usage block. Keep the prefix identical across calls:

  • Put the entire static instruction set, schemas, and few-shot examples in messages[0] (system) or the very front of messages[1] (user).
  • Never interpolate timestamps, request IDs, or per-user names into the prefix.
Diagram of a cache-friendly prompt layout: cached system block and few-shot examples first, the fresh user question last, all sent to the DeepSeek API.
Concept diagram: the cache-hit percentage and cost bar are illustrative, not measured and not computed from DeepSeek's prices.

For more on how cache hits are billed, see the DeepSeek context caching reference.

Template 5 — RAG with cited sources

System:
You answer questions only from the provided sources. Cite each claim
with the source id in square brackets, e.g. [S2]. If the sources do
not contain the answer, reply: "Not in sources." Do not invent facts.

Sources:
[S1] {chunk 1 text}
[S2] {chunk 2 text}
[S3] {chunk 3 text}

User:
{question}

Pair with retrieval as covered in the DeepSeek RAG tutorial. Use deepseek-flash; with thinking disabled, temperature 1.0 (DeepSeek’s data-analysis value) is a reasonable start.

Template 6 — Long-document summarisation

With a 1M-token context window, many documents fit without chunking. You still need to direct what gets summarised.

System:
Summarise the document in three layers:
1. One-sentence verdict
2. Five bullet key findings, each <= 20 words
3. Risks and unknowns, with section references like (p. 12)

Do not editorialise. Do not add information that is not in the document.

Template 7 — Role-based critique

A role prompt tells the model which expertise to apply and what is in scope, so be specific about both.

You are a database administrator with 15 years of Postgres experience.
Review the SQL below. List, in order of severity:
1. Correctness bugs
2. Performance issues at > 10M rows
3. Style problems
For each, quote the offending line and propose a fix.

Template 8 — Tool calling skeleton

Illustration of a desk with a laptop showing a tool-calling prompt in a code editor and mock terminal output, beside a monitor with a prompt-library app.
Illustration: the terminal output is a mock-up, not a captured API call.

Function calling uses the OpenAI format: declare tools, let the model emit a tool call, run it client-side, then append the assistant message (response.choices[0].message, which carries tool_calls and, in thinking mode, reasoning_content) and a tool message with the result, and call again (Tool Calls guide). In thinking mode, the default, reasoning_content must be passed back on every later request that uses tools, or the API returns HTTP 400; tool_choice “required” or a named function also returns 400 there. The API is stateless: resend the full history on every turn.

from openai import OpenAI

client = OpenAI(base_url="https://api.deepseek.com", api_key="...")

tools = [{
  "type": "function",
  "function": {
    "name": "get_weather",
    "description": "Current weather for a city",
    "parameters": {
      "type": "object",
      "properties": {"city": {"type": "string"}},
      "required": ["city"]
    }
  }
}]
opts = dict(model="deepseek-flash", tools=tools,
            extra_body={"thinking": {"type": "disabled"}})  # non-thinking, as in DeepSeek's sample

messages = [{"role": "user", "content": "Weather in Dublin?"}]
msg = client.chat.completions.create(messages=messages, **opts).choices[0].message
messages.append(msg)  # the assistant turn with tool_calls comes first
call = msg.tool_calls[0]  # validate call.function.arguments, then run your tool
messages.append({"role": "tool", "tool_call_id": call.id, "content": "..."})
msg = client.chat.completions.create(messages=messages, **opts).choices[0].message
print(msg.content)

To keep thinking on, replace the extra_body entry with reasoning_effort="high", extra_body={"thinking": {"type": "enabled"}}; appending msg already passes reasoning_content back. Full pattern: DeepSeek API function calling.

Template 9 — Translation with register control

Translate the text below from English to {target}.
Register: {formal|conversational|technical}.
Preserve: code blocks, URLs, numbers, proper nouns.
Output only the translation, no commentary.

DeepSeek’s Temperature Parameter page suggests 1.3 for translation; this only applies with thinking disabled.

Template 10 — Creative writing brief

Write a {format} of {length} words about {topic}.
Audience: {who}. Tone: {adjective + adjective}.
Constraints: {must include}. Avoid: {must not}.
Provide two distinct drafts, then a one-line note on the difference.

With thinking disabled, use temperature 1.5 (DeepSeek’s creative-writing value); values up to 2 are accepted. With thinking on, temperature has no effect, so rerun if the drafts read alike.

Template 11 — Test-case generator

For the function signature below, generate pytest tests covering:
- Happy path (3 cases)
- Edge cases (empty, single element, max size)
- Error cases (invalid type, out-of-range)
Return one fenced code block. No commentary.

{paste signature + docstring}

Template 12 — Self-critique pass

The first call drafts; the second critiques and rewrites. The extra pass is billed like any call, with the rewrite at the output rate ($1.20 per 1M tokens at peak, $0.60 off-peak on deepseek-flash, as of 22 October 2026).

Pass 1 (thinking disabled, temperature 1.3): Draft the response.
Pass 2 (thinking disabled, temperature 0.0): "Critique the draft below for
factual errors, weak claims, and structural problems. Rewrite to fix them.
Output only the rewritten version."

Endpoint and parameter reference

Templates go to POST /chat/completions at https://api.deepseek.com (OpenAI SDK); the Anthropic SDK uses https://api.deepseek.com/anthropic. Parameters used above:

  • model — deepseek-flash (DeepSeek-V4.1-Flash-1017) or deepseek-v4-pro (DeepSeek-V4-Pro-0813)
  • thinking — {"type": "enabled"} (default) or {"type": "disabled"}; with the OpenAI Python SDK, pass it in extra_body
  • reasoning_effort — "low", "high" (default) or "max"
  • temperature — non-thinking mode only (default 1.0, range 0–2); ignored in thinking mode
  • max_tokens — high enough that JSON cannot be cut off (finish_reason “length” means it was). Defaults: 8K non-thinking, 64K thinking, 128K at max effort; maximum 384K
  • response_format — {"type": "json_object"} for Template 1
  • tools — for Template 8
  • stream — true for chat UIs

For setup, see how to get a DeepSeek API key; for more utilities, including the prompt generator, see the DeepSeek tools and utilities hub.

What to avoid

Diagram of a prompt-template flow: a user picks a template category, which becomes a structured prompt (role, goal, steps, output) sent to the DeepSeek API.
Illustrative flow; most category names differ from the filters in the tool above.
  • Timestamps, request IDs or user names in the system prompt: they break the shared prefix, so at most the part before them can come from the cache.
  • Expecting temperature or a low top_p to steer thinking-mode output (Flash treats top_p below 0.95 as 0.95; Pro ignores it).
  • Thinking left on (the default) for short factual questions; disable it or use reasoning_effort="low", since reasoning tokens are billed as output.
  • JSON Output without a parser fallback: the API may occasionally return empty content, and output is cut off at max_tokens.
  • A single SWE-Bench number from a third-party blog, quoted without checking the split (Verified vs Full vs Lite) and the harness.

Frequently asked questions

How should a system prompt for DeepSeek’s API be structured?

Put the role, constraints, output format and any few-shot examples in the system message and keep it identical across calls, since a cache hit needs a full match of a stored prefix. Put volatile content (timestamps, user names, today’s question) in the latest user message. The four-block structure above applies to both models; for the theory, see our DeepSeek prompt engineering guide.

Which temperature suits each DeepSeek prompt template?

Temperature only matters with thinking disabled; in thinking mode, the default, it has no effect. With thinking off, DeepSeek’s Temperature Parameter page suggests 0.0 for code and maths, 1.0 for data analysis, 1.3 for general conversation and translation, and 1.5 for creative writing; the default is 1.0. More guidance lives in the DeepSeek API best practices reference.

Does the same prompt work on deepseek-flash and deepseek-v4-pro?

For text prompts, yes: both use the same Chat Completions format, a 1M-token context and a 384K maximum output. Exceptions: only deepseek-flash accepts images, concurrency limits differ (2,500 vs 500 per account), and top_p behaves differently. deepseek-v4-pro costs 3.3× Flash on output and 4.4× on cache-miss input (peak or off-peak, as of 22 October 2026), and DeepSeek claimed on 10 September 2026 that V4.1-Flash benchmarks ahead of V4-Pro (a vendor claim), so Flash is the sensible default and Pro an option to compare against. Compare both on the DeepSeek pricing calculator.

Does DeepSeek JSON mode guarantee valid JSON output?

Only with caveats. DeepSeek’s API reference says JSON Output guarantees valid JSON, but its JSON Output guide warns that the API may occasionally return empty content, and a reply cut off at max_tokens (finish_reason “length”) will not parse. Ask for JSON in the prompt, with an example, and keep a try/except with a retry. The DeepSeek API JSON mode doc has more.

Why does a DeepSeek prompt template cost more than expected?

Possible causes: a system prompt that changes between calls, so requests miss the cache; thinking left on (the default) for tasks that do not need it, or effort “max”, since reasoning tokens are billed as output; traffic in DeepSeek’s peak windows (01:00–04:00 and 06:00–10:00 UTC, Monday to Friday, excluding Chinese public holidays), billed at twice the off-peak rate since 16 August 2026; or deepseek-v4-pro where deepseek-flash would do. Estimate token counts with the DeepSeek token counter and review cache-hit, cache-miss and output tokens in each response’s usage block.

Sources & Methodology

Last source check: October 23, 2026

Primary sources

  • PricingDeepSeek API Docs: Models & PricingCurrent model names and versions (deepseek-flash = DeepSeek-V4.1-Flash-1017, deepseek-v4-pro = DeepSeek-V4-Pro-0813), peak and off-peak per-1M-token prices as of 22 October 2026, peak windows, 1M context, 384K maximum output, vision on deepseek-flash only, legacy deepseek-v4-flash name, concurrency limitsLast checked: October 23, 2026
  • OfficialDeepSeek API Docs: Thinking ModeThinking on by default (effort high); thinking and reasoning_effort request fields; low/high/max efforts; temperature ignored in thinking mode; per-model top_p behaviour; reasoning_content must be passed back with tools (HTTP 400)Last checked: October 23, 2026
  • OfficialDeepSeek API Reference: Chat CompletionsParameter defaults and ranges (temperature, top_p, max_tokens up to 384K); advice to change temperature or top_p, not both; JSON Output guarantee and finish_reason "length"; tool_choice limits in thinking mode; usage fieldsLast checked: October 23, 2026
  • OfficialDeepSeek API Docs: JSON OutputJSON Output setup (response_format, the word json plus an example, max_tokens) and the occasional empty-content warningLast checked: October 23, 2026
  • OfficialDeepSeek API Docs: Context CachingCaching on by default, full match of a stored prefix unit required for a hit, best-effort with no guaranteed hit rate, prompt_cache_hit_tokensLast checked: October 23, 2026
  • OfficialDeepSeek API Docs: Tool CallsTool-call round trip (append the assistant message, then a tool message) and the non-thinking sample the article's Python code followsLast checked: October 23, 2026

Technical references

Context sources

  • OfficialDeepSeek API Change LogEntries of 24 Apr 2026 (V4; legacy names), 13 Aug 2026 (V4-Pro GA; low/high/max efforts with max for complex scenarios; peak/off-peak pricing from 16 Aug 2026), 10 Sep 2026 (V4.1-Flash; V4-Flash retired; V4-Pro kept) and 17 Oct 2026 (V4.1-Flash-1017)Last checked: October 23, 2026
  • OfficialDeepSeek V4 Preview release note (24 Apr 2026)deepseek-chat and deepseek-reasoner retired after 15:59 UTC on 24 July 2026; until then they routed to deepseek-v4-flash non-thinking / thinkingLast checked: October 23, 2026
  • OfficialDeepSeek-V4.1-Flash release note (10 Sep 2026)V4-Flash retirement and DeepSeek's vendor claim that V4.1-Flash benchmarks ahead of V4-ProLast checked: October 23, 2026

Methodology

Based on DeepSeek's official API documentation and pricing page as checked on 22 October 2026. The templates and the cost example are illustrative; we do not run our own evaluations.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *