DeepSeek-V4.1-Flash
| Tier | Input | Output | Cached input |
|---|---|---|---|
PriorityLearn more | 108 | 324 | 3.24 |
FlexLearn more | 40.32 | 120.96 | 1.224 |
DeepSeek V4.1 Flash is a multimodal Mixture-of-Experts model built around one goal: making the memory cost of long context collapse. It carries 552 billion backbone parameters but activates only 8 billion per token while reading your input and 16 billion while writing its answer — an asymmetry made possible by a causal encoder-decoder design where the decoder's key-value cache is projected from the encoder's final states rather than rebuilt layer by layer. The result is 890 bytes of cache per token, roughly a quarter of the previous generation and a fraction of a percent of where the series began. Reasoning effort is a continuous integer from 1 to 100 rather than a handful of preset levels, so cost and accuracy can be tuned rather than chosen from a menu.

Use DeepSeek-V4.1-Flash in VS Code, Cursor and Antigravity
DEVUP Code, the DEVUP AI extension, is free to install. Requests are paid from your DEVUP balance.
DeepSeek V4.1 Flash
A multimodal Mixture-of-Experts model with 552B backbone parameters and a one-million-token context window, built around a single engineering target: collapsing the memory cost of long context.
The Numbers That Define It
| Backbone parameters | 552B |
| Activated during prefill | 8B per token |
| Activated during decode | 16B per token |
| Global KV cache | 890 bytes per token |
| Experts | 6 routed of 384, plus 1 shared |
| Context | 1,048,576 tokens |
| Precision | FP8 weights, FP4 KV cache |
Two of those deserve attention.
Activation is asymmetric. Most models activate the same parameters whether they are reading input or generating output. This one uses 8B while reading and 16B while writing. Reading is the expensive half of an agentic workload — long histories, tool output, retrieved documents — and that is the half this model made cheaper.
890 bytes per token is roughly a quarter of the previous generation and, per DeepSeek's own comparison, about 1/437 of the first model in the series. Long context stops being a memory problem and becomes a throughput one.
Reasoning Effort Is a Number, Not a Level
reasoning_effort takes an integer from 1 to 100.
Every other reasoning model works from a fixed vocabulary — three or four named levels, each a discrete jump. This one is continuous. The practical difference is that you can calibrate rather than choose.
{
"model": "deepseek-ai/DeepSeek-V4.1-Flash",
"messages": [{ "role": "user", "content": "..." }],
"reasoning_effort": 35
}That matters for a reason worth internalising: on other models, measurement has shown the lowest named level can be worse than no reasoning at all — enough deliberation to go wrong, not enough to arrive. A continuous scale lets you find where a workload actually flips to reliable, rather than guessing between two presets that bracket it.
All published benchmark results use reasoning_effort=100. Read every score below with that in
mind — they describe the model at its most expensive setting.
A workable approach: start at 100 to establish a ceiling, then bisect downward until accuracy drops on your own evaluation set. The point where it holds is your production setting.
Architecture
Causal Encoder-Decoder
A 40-layer Transformer, structured as a 20-layer causal encoder followed by a 20-layer decoder.
The consequential part: the decoder's global KV cache is projected from the encoder's final hidden states rather than derived from each decoder layer's own hidden states. That single change is what allows 8B activated parameters during prefill on a 552B model.
Compressed Sparse Attention 2
Each attention layer is assigned one of three static modes — Full, Reindex, or Reuse — which share main KV and indexer keys across layers and reuse Top-K sparse-attention indices.
In the decoder, a Hierarchical Sparse Indexer restricts later indexing layers to a candidate pool built by the first Full-mode layer. This bounds deeper indexer cost independently of context length — the reason a million-token window does not degrade into an indexing problem.
Cache compression
| Technique | Effect |
|---|---|
| FP4 main KV caching | E2M1 format, one E4M3 scale per 16 channels |
| SWA Bounded Replay | Reconstructs missing sliding-window KV states by replaying only the most recent tokens, avoiding SSD persistence — roughly 1/8 the persistent footprint of the previous generation |
Other components
Single-Pass mHC — revised residual-stream mixing with a dedicated fused kernel.
Engram conditional memory — 196B parameters, held outside the backbone and accessed sparsely through token-based lookup. Capacity that does not cost activation.
DSpark speculative decoding — semi-autoregressive draft generation with confidence-scheduled verification, shipped in the checkpoint.
Vision
A vision encoder trained from scratch (2D-RoPE, 3×3 pixel-unshuffle downsampling) feeding a two-layer MLP projector. Visual and text embeddings are processed jointly from the start of language-model pre-training rather than aligned afterwards.
Training
Pre-trained from scratch on a 45T-token multimodal corpus. Sparse attention was trained at 64K sequence length, with context extended to 1M after 34T tokens.
Post-training follows a standard SFT → RL → on-policy-distillation pipeline with no algorithmic modifications. DeepSeek is explicit that the gains came from the data pipeline instead: large-scale automated synthesis of agent tasks and environments, with progressive scaling of data, tasks, and rollouts.
Capabilities
| Capability | Value |
|---|---|
input_types | text, image |
output_types | text |
context_window | 1048576 |
reasoning | Continuous integer, 1–100 |
streaming | Supported |
tool_calling | Supported |
structured_output | Supported |
requires_prompt | Yes — text prompt required, image optional |
Recommended Generation Parameters
| Parameter | Value |
|---|---|
temperature | 1.0 |
top_p | 0.95 or 1.0 |
max_tokens | ≥ 256K |
The output budget recommendation is unusually large and should be taken seriously. At high reasoning effort the trace consumes output tokens, and truncating a reasoning model mid-trace returns an unfinished response rather than a shorter one.
Note that some serving interfaces default to lower temperature and top-p values than these. If you have not set them explicitly, you are probably not running the recommended configuration.
Evaluation Results
All figures at reasoning_effort=100, temperature=1.0, top_p=0.95.
Against the previous generation
| Benchmark | V4.1 Flash | V4 Pro | V4 Flash |
|---|---|---|---|
| Terminal-Bench 2.1 | 90.6 | 87.9 | 82.7 |
| Terminal-Bench 3.0 | 30.0 | 11.8 | 7.6 |
| Terminal-Bench 4.0 | 31.2 | 12.4 | 7.0 |
| DeepSWE v1.1 | 74.2 | 62.7 | 54.4 |
| CyberGym | 88.1 | 83.3 | 76.7 |
| SEC-Bench Pro | 62.8 | 56.4 | 30.9 |
| AutomationBench | 54.8 | 43.2 | 37.7 |
| Agent's Last Exam | 31.8 | 25.7 | 25.2 |
| NL2Repo-Bench | 64.0 | 61.5 | 54.2 |
| Codeforces (rating) | 3471 | 3348 | 3289 |
| HLE with tools | 63.9 | 60.0 | 51.5 |
It surpasses the previous flagship — a model with roughly three times its backbone and six times its activated parameters — across essentially every agentic benchmark.
The honest read
DeepSeek also publishes comparisons against frontier models from other developers, and the picture there is not uniform.
Where it leads the published comparison set: Terminal-Bench 2.1, DeepSWE v1.1, CyberGym, AutomationBench, Agent's Last Exam, HLE with tools, and Codeforces rating.
Where it trails clearly: raw knowledge and reasoning without tools. On HLE it scores 36.8 against a leading proprietary model's 56.3 — the widest gap in the table. It also trails on the harder Terminal-Bench 3.0 and 4.0 variants, on ProgramBench, and on exploitation benchmarks.
The pattern is consistent and worth stating plainly: this model executes better than it knows. Given tools and an environment, it is at or near the top. Asked to answer from what it learned, it is not. HLE moving from 36.8 without tools to 63.9 with them is the same fact stated twice.
Multimodal (base model)
| Benchmark | Score |
|---|---|
| DocVQA | 95.6 |
| RefCOCO (avg) | 86.0 |
| CVBench | 77.9 |
| MMMU-Pro | 56.5 |
The Harness Matters as Much as the Model
DeepSeek published something most vendors do not: the same model, the same benchmarks, across eight different agent scaffolds.
| Scaffold | DeepSWE v1.1 | Terminal-Bench 2.1 |
|---|---|---|
| mini-SWE | 74.2 | — |
| DSH Minimal | 72.6 | 90.6 |
| DSH Standard | 70.5 | 85.8 |
| DSH PTC | 67.6 | 85.8 |
| Claude Code | 69.8 | 88.0 |
| Pi | 66.2 | 86.1 |
| Codex | 65.6 | 84.1 |
| OpenCode | 65.5 | 85.0 |
A nine-point spread on DeepSWE and a six-point spread on Terminal-Bench, from the scaffold alone. Same model, same weights, same settings.
Two things follow.
Your harness is a first-class variable. The difference between the best and worst scaffold here is larger than the difference between many model generations. Before concluding that a model underperforms, check what is wrapping it.
More sophisticated is not better. The minimal harness outscored the standard and programmatic-tool-calling variants on both benchmarks. Complexity in a scaffold adds failure modes as readily as capability.
Using DeepSeek V4.1 Flash on DEVUP AI
Base URL: https://api.devupai.com/v1 · Model ID: deepseek-ai/DeepSeek-V4.1-Flash
Quick start — cURL
curl https://api.devupai.com/v1/chat/completions \
-H "Authorization: Bearer $DEVUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-ai/DeepSeek-V4.1-Flash",
"messages": [
{
"role": "user",
"content": "Two services write to the same row without a transaction. Walk through the failure modes in order of likelihood and propose the smallest fix for each."
}
],
"reasoning_effort": 50,
"temperature": 1.0,
"top_p": 0.95,
"max_tokens": 32768
}'Calibrating reasoning effort — Python
The control this model gives you that others do not. Find where your workload flips to reliable rather than picking between presets.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["DEVUP_API_KEY"],
base_url="https://api.devupai.com/v1",
)
def solve(prompt: str, effort: int, max_tokens: int = 32768) -> tuple[str, int]:
"""Return the answer and the reasoning tokens consumed at a given effort level."""
if not 1 <= effort <= 100:
raise ValueError(f"reasoning_effort must be an integer from 1 to 100, got {effort!r}")
response = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V4.1-Flash",
messages=[{"role": "user", "content": prompt}],
temperature=1.0,
top_p=0.95,
max_tokens=max_tokens,
extra_body={"reasoning_effort": effort},
)
usage = response.usage
return response.choices[0].message.content, usage.completion_tokens
# Sweep your own evaluation set to find the cheapest level that still holds.
for effort in (100, 75, 50, 25, 10):
answer, tokens = solve(hard_prompt, effort)
print(f"effort={effort:>3} output_tokens={tokens:>6} correct={check(answer)}")Published results all use 100. Your production setting is the lowest value that still passes your
own checks — and on a continuous scale, that value is findable rather than guessed.
Image input — Python
import base64
with open("invoice.png", "rb") as handle:
encoded = base64.b64encode(handle.read()).decode("utf-8")
response = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V4.1-Flash",
messages=[
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {"url": f"data:image/png;base64,{encoded}"},
},
{
"type": "text",
"text": (
"Extract every line item as JSON with fields: description, quantity, "
"unit_price, line_total. Report the currency exactly as printed. "
"Use null for any illegible field — do not infer."
),
},
],
}
],
temperature=1.0,
top_p=0.95,
max_tokens=16384,
extra_body={"reasoning_effort": 40},
)
print(response.choices[0].message.content)Instructing the model to return null rather than infer is not optional in document work. An
invented figure is undetectable downstream.
Long-context agent loop — Python
The workload the architecture was built for. Input is the cheap half here.
import json
TOOLS = [
{
"type": "function",
"function": {
"name": "read_file",
"description": "Return the contents of a file at a repository-relative path.",
"parameters": {
"type": "object",
"properties": {"path": {"type": "string"}},
"required": ["path"],
},
},
},
{
"type": "function",
"function": {
"name": "run_tests",
"description": "Run the test suite and return pass/fail counts with failure output.",
"parameters": {"type": "object", "properties": {}},
},
},
]
def read_file(path: str) -> dict:
"""Replace with your real, sandboxed file access."""
raise NotImplementedError
def run_tests() -> dict:
"""Replace with your real, sandboxed test runner."""
raise NotImplementedError
HANDLERS = {"read_file": read_file, "run_tests": run_tests}
messages = [{"role": "user", "content": "The invoice rounding test is failing. Find the cause and fix it."}]
for _ in range(40): # bounded loop — never let an agent iterate without a ceiling
response = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V4.1-Flash",
messages=messages,
tools=TOOLS,
temperature=1.0,
top_p=0.95,
max_tokens=65536,
extra_body={"reasoning_effort": 100},
)
message = response.choices[0].message
messages.append(message)
if not message.tool_calls:
print(message.content)
break
for call in message.tool_calls:
handler = HANDLERS.get(call.function.name)
if handler is None:
result = {"error": "unknown_tool", "name": call.function.name}
else:
try:
result = handler(**json.loads(call.function.arguments or "{}"))
except Exception as exc: # describe the failure — do not crash the loop
result = {"error": type(exc).__name__, "detail": str(exc)}
messages.append(
{
"role": "tool",
"tool_call_id": call.id,
"content": json.dumps(result),
}
)
else:
print("Agent loop exceeded its iteration limit.")Growing conversation history is what this architecture made cheap. A long agent run accumulates input faster than output, and input is the 8B-activation half.
The iteration ceiling is the only bound you have — there is no per-request spending limit on this platform, so an unbounded loop runs against your full balance.
Node.js — DEVUP AI SDK
npm install devupaiimport DevupAI from "devupai";
const client = new DevupAI({
apiKey: process.env.DEVUP_API_KEY,
});
const response = await client.chat.completions.create({
model: "deepseek-ai/DeepSeek-V4.1-Flash",
messages: [
{
role: "system",
content:
"You are a staff engineer reviewing a migration. Report only defects that would " +
"cause data loss or downtime, each with a severity and the smallest safe fix.",
},
{ role: "user", content: migrationPlan },
],
temperature: 1.0,
top_p: 0.95,
max_tokens: 32768,
reasoning_effort: 60,
});
console.log(response.choices[0]?.message?.content);Streaming
stream = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V4.1-Flash",
messages=[{"role": "user", "content": "Design a retry policy for a webhook delivery system."}],
temperature=1.0,
top_p=0.95,
max_tokens=32768,
stream=True,
extra_body={"reasoning_effort": 60},
)
for chunk in stream:
if not chunk.choices:
if getattr(chunk, "usage", None):
print(f"\n\nTokens — in: {chunk.usage.prompt_tokens}, out: {chunk.usage.completion_tokens}")
continue
delta = chunk.choices[0].delta
if getattr(delta, "content", None):
print(delta.content, end="", flush=True)Watching output tokens across effort levels is how you calibrate. The reasoning trace and the answer share the same budget.
Prompt Encoding
This release ships no Jinja chat template. DeepSeek provides a self-contained Python reference implementation instead, with test cases covering multi-turn conversations, tool calling, thinking mode, numeric reasoning effort, mid-conversation system messages, and interleaved image content.
For production, a maintained Rust toolkit with Python bindings is also published. It converts Messages, Chat Completions, and Responses API requests into DeepSeek's conversation format, encodes them, and parses model output back — covering thinking, tool calls, images, and generation settings.
This matters only if you are serving the model yourself. Through a hosted API the encoding is handled for you.
Limitations
- Knowledge trails execution. On tool-free reasoning benchmarks this model is well behind the leading proprietary models. Its strength appears when it has an environment to work in.
- Published results all use maximum reasoning effort. Real deployments at lower settings will not reproduce them.
- Text output only. Images in, text out. No image generation.
- Harness-dependent results. A nine-point spread across scaffolds on the same benchmark is published by DeepSeek itself. Treat any single agentic figure as a measurement of a model-and-harness pair.
- A very large output budget is recommended — at least 256K tokens. Undersizing it truncates reasoning rather than shortening answers.
- No Jinja chat template for self-hosted deployments; a reference encoder must be used.
- No per-request spending limit exists on this platform. Bound agent loops by iteration count and watch your balance.
- Recently released, with correspondingly little independent verification.
- Not a safety layer. Apply your own moderation and validation before acting on model output in a production system.