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

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.

DeepSeek Prompt Templates Library
23 prompt skeletons with clearly separated sections. Search, filter by category, copy, fill the {placeholders}, send.
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).
- System block — role, constraints, output format. Stable across calls.
- Reference block — schemas, examples, retrieved documents. Mostly stable.
- Task block — what to do this turn. Changes per call.
- 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 ofmessages[1](user). - Never interpolate timestamps, request IDs, or per-user names into the prefix.

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

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) ordeepseek-v4-pro(DeepSeek-V4-Pro-0813)thinking—{"type": "enabled"}(default) or{"type": "disabled"}; with the OpenAI Python SDK, pass it inextra_bodyreasoning_effort—"low","high"(default) or"max"temperature— non-thinking mode only (default 1.0, range 0–2); ignored in thinking modemax_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 384Kresponse_format—{"type": "json_object"}for Template 1tools— for Template 8stream— 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

- 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
temperatureor a lowtop_pto steer thinking-mode output (Flash treatstop_pbelow 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
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
- OfficialDeepSeek API Docs: The Temperature ParameterSuggested temperatures by use case (0.0 / 1.0 / 1.3 / 1.5) and default 1.0; page last modified 17 April 2026, before V4, and no longer linked from the docs navigationLast checked: October 23, 2026
- OfficialDeepSeek API Docs: Multi-round ConversationStateless /chat/completions API: resend the conversation history on every turnLast checked: October 23, 2026
- OfficialDeepSeek API Docs: Your First API CallOpenAI-format base URL https://api.deepseek.com and Anthropic-format base URL https://api.deepseek.com/anthropicLast checked: October 23, 2026
- OfficialDeepSeek API Docs: Using the Anthropic APIAnthropic SDK base URL https://api.deepseek.com/anthropicLast checked: October 23, 2026
- OfficialDeepSeek API Docs: Rate Limit & IsolationPer-account concurrency limits: 2,500 for deepseek-flash, 500 for deepseek-v4-proLast checked: October 23, 2026
- OfficialDeepSeek API Docs: Using the Responses APIOutput tokens include reasoning (chain-of-thought) tokens, so reasoning is billed as outputLast checked: October 23, 2026
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.
