DeepInfra raises $107M Series B to scale the inference cloud — read the announcement

deepseek-ai logo

deepseek-ai/

DeepSeek-V4.1-Flash

$0.14

in

$0.42

out

$0.004

cached

/ 1M tokens

$0.20

in

$0.60

out

$0.006

cached

/ 1M tokens

30% off
TierInputOutputCached input
Priority (1.5×)Learn More
$0.21$0.63$0.0063
Flex (0.8×)Learn More
$0.112$0.336$0.0034

per 1M tokens — promotional pricing, 30% off already applied

Introduce DeepSeek-V4.1-Flash, a multimodal Mixture-of-Experts (MoE) model with 552B backbone parameters and support for contexts of up to one million tokens.

Supports Priority Tier
Supports Flex Tier
Public
Zero retention
fp8
1,048,576
JSON
Function
Multimodal
DeepSeek
deepseek-ai/DeepSeek-V4.1-Flash cover image
api
deepseek-ai/DeepSeek-V4.1-Flash cover image
DeepSeek V4.1 Flash

Ask me anything

You
Can you hear me?
deepseek-ai/DeepSeek-V4.1-Flash cover image
DeepSeek V4.1 Flash

Captcha verification failed. Please try again.

15.00ttft
0tps
0toks
15.00s

Settings

System Prompt

Tweak the overall style and tone of the conversation by giving some 'master' instructions. (Default: Be a helpful assistant)

Max New Tokens

maximum length of the newly generated text. If explicitly set to None it will be the model's max context length minus input length or 65536, whichever is smaller (Default: empty, 1 ≤ max_new_tokens ≤ 1000000)

Temperature

temperature to use for sampling. 0 means the output is deterministic. Values greater than 1 encourage more diversity (Default: 0.7, 0 ≤ temperature ≤ 1)

Top P

Sample from the set of tokens with highest probability such that sum of probabilies is higher than p. Lower values focus on the most probable tokens.Higher values sample more low-probability tokens (Default: 0.9, 0 < top_p ≤ 1)

Min P

Float that represents the minimum probability for a token to be considered, relative to the probability of the most likely token. Must be in [0, 1]. Set to 0 to disable this. (Default: 0, 0 ≤ min_p ≤ 1)

Top K

Sample from the best k (number of) tokens. 0 means off (Default: 0, 0 ≤ top_k < 1000)

Repetition Penalty

repetition penalty. Value of 1 means no penalty, values greater than 1 discourage repetition, smaller than 1 encourage repetition. (Default: 1, 0.01 ≤ repetition_penalty ≤ 5)

stop
You can add more items with the button on the right

Response Format

How to format the response

Presence Penalty

Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. (Default: 0, -2 ≤ presence_penalty ≤ 2)

Frequency Penalty

Positive values penalize new tokens based on how many times they appear in the text so far, increasing the model's likelihood to talk about new topics. (Default: 0, -2 ≤ frequency_penalty ≤ 2)

User

A unique identifier representing your end-user, which can help monitor and detect abuse. Avoid sending us any identifying information. We recommend hashing user identifiers.. (Default: empty)

Seed

Seed for random number generator. If not provided, a random seed is used. Determinism is not guaranteed. (Default: empty, -9223372036854776000 ≤ seed < 18446744073709552000)

Prompt Cache Key

A key to identify prompt cache for reuse across requests. If provided, the prompt will be cached and can be reused in subsequent requests with the same key.. (Default: empty)

Service tier

Choose the tier these requests run on

Model Information

DeepSeek-V4.1-Flash: Pushing the Limits of KV Cache Compression

DeepSeek-V4.1

Technical Report 👁️

Introduction

We introduce DeepSeek-V4.1-Flash, a multimodal Mixture-of-Experts (MoE) model with 552B backbone parameters and support for contexts of up to one million tokens. The model natively processes images and text, and generates text autoregressively.

Architecture. DeepSeek-V4.1-Flash adopts a Causal Encoder-Decoder (CED) architecture: a 40-layer Transformer organized as a 20-layer causal encoder followed by a 20-layer decoder. With CED, the decoder's global KV cache is projected from the final encoder hidden states rather than derived from each decoder layer's own hidden states. This allows the model to activate only 8B parameters per token during prefill and 16B during decode, substantially improving cost efficiency for input-heavy agentic workloads. SWA Bounded Replay reconstructs missing SWA KV states by replaying only the most recent n_win tokens, avoiding the need to persist SWA KV to SSD and reducing the persistent KV cache footprint to roughly 1/8 of that of DeepSeek-V4-Flash.

Compressed Sparse Attention 2 (CSA2). DeepSeek-V4.1-Flash uses CSA2, which assigns each attention layer one of three static modes — Full, Reindex, or Reuse — to share main KV and indexer K across layers and reuse Top-K sparse-attention indices. In the decoder, a Hierarchical Sparse Indexer further restricts later indexing layers to a candidate pool constructed by the first Full Mode layer, bounding deeper indexer cost independently of context length. Combined with FP4 main KV caching (E2M1 format, one E4M3 scale per 16 channels), these designs reduce the global KV cache footprint to 890 bytes per token — roughly 1/4 of DeepSeek-V4-Flash.

Additional architectural components include Single-Pass mHC (revised residual-stream mixing with an efficient Mega-mHC kernel), Engram conditional memory (196B parameters, sparsely accessed via token-based lookup), and DSpark speculative decoding (semi-autoregressive draft generation with confidence-scheduled verification). The model uses 1 shared expert and 384 routed experts per MoE layer, activating 6 routed experts per token.

Multimodal architecture. A vision encoder (DeepSeek-ViT, trained from scratch with 2D-RoPE and 3×3 pixel-unshuffle downsampling) and a two-layer MLP projector convert images into visual embeddings, processed jointly with text embeddings from the start of language-model pre-training.

Pre-training. DeepSeek-V4.1-Flash is trained from scratch on a multimodal corpus comprising 45T tokens, with sparse attention trained at a sequence length of 64K and context extended to 1M tokens at 34T tokens.

Post-training. The post-training recipe follows the standard SFT → RL → on-policy distillation (OPD) paradigm without algorithmic modifications. All substantive changes lie instead in the data pipeline: large-scale automated synthesis of agent tasks and environments with progressive scaling of data, tasks, and rollouts. The model supports a continuously controllable reasoning effort setting (integer 1–100) that trades inference cost for accuracy.

DeepSeek-V4.1-Flash agentic benchmark performance Global KV cache size per token across DeepSeek generations

Figure 1. (a) Performance of DeepSeek-V4.1-Flash and counterparts on agentic benchmarks. (b) Global KV cache size per token (bytes) across generations of DeepSeek models. DeepSeek-V4.1-Flash achieves approximately 4-fold and 437-fold reductions relative to DeepSeek-V4-Flash and DeepSeek-V1, respectively.

Evaluation Results

Base Model

All base models are evaluated in our internal framework under the same evaluation settings. Scores within 0.3 of each other are considered equivalent.

Benchmark (Metric)# ShotsDeepSeek-V4-Flash-BaseDeepSeek-V4-Pro-BaseDeepSeek-V4.1-Flash-Base
Architecture—MoEMoEMoE
# Backbone Params—284B1.6T552B
# Activated Params—13B49B8B / 16B
World Knowledge
AGIEval (EM)3–5-shot83.984.483.4
MMLU-Pro (EM)5-shot68.373.574.1
C-Eval (EM)5-shot92.193.192.1
MultiLoKo (LLM-Judge)5-shot42.650.945.5
SimpleQA-Verified (EM)25-shot30.155.242.3
SuperGPQA (EM)5-shot46.553.953.1
Language & Reasoning
BBH (EM)3-shot86.987.586.1
BBEH (EM)1-shot25.429.827.2
DROP (F1)1-shot88.688.787.9
HellaSwag (EM)0-shot85.788.087.2
Code & Math
BigCodeBench (Pass@1)3-shot56.859.260.6
HumanEval (Pass@1)0-shot69.576.879.4
GSM8K (EM)8-shot90.892.693.0
MATH (EM)4-shot57.464.561.1
MGSM (EM)8-shot85.784.480.2
Long Context
LongBench-V2 (EM)1-shot44.751.545.2
Multimodal
MMMU-Pro (EM)4-shot——56.5
CVBench (EM)4-shot——77.9
DocVQA (LLM-Judge)4-shot——95.6
RefCOCO-avg (Acc@0.5)0-shot——86.0

Instruct Model

DeepSeek-V4.1-Flash supports a continuously controllable reasoning effort from 1 to 100. All instruct results below use the maximum effort setting (reasoning_effort=100). Evaluations use temperature=1.0, top_p=0.95.

For code agent benchmarks (Terminal-Bench 2.1/3.0/4.0, DeepSWE v1.1, NL2Repo-Bench, ProgramBench), the model is evaluated with the Minimal mode of DeepSeek Harness and a 1M-token context window. To align with official setup requirements, the mini-SWE harness is used for DeepSWE v1.1, and the Claude Code harness for SEC-Bench Pro. Visual agent benchmarks (Chartography, BabyVision, ZeroBench) use the Claude Code harness with a 512k-token context window. Agent's Last Exam and AutomationBench use their official scaffolds. All agentic evaluations use temperature=1.0, top_p=0.95.

Comparison with frontier models (Max reasoning effort)

Benchmark (Metric)Opus-5.0GPT-5.6 SolK3GLM-5.3DS-V4-ProDS-V4-FlashDS-V4.1-Flash
Reasoning
GPQA Diamond (Pass@1)93.494.192.988.192.489.990.9
HLE (Pass@1)56.344.543.542.0†42.7†37.8†36.8 (39.1†)
Codeforces (Rating)————334832893471
MathArena Apex (Pass@1)——65.6—65.358.665.6
Agentic
Terminal-Bench 2.1 (Pass@1)89.188.888.388.287.982.790.6
Terminal-Bench 3.0 (Pass@1)43.334.417.728.311.87.630.0
Terminal-Bench 4.0 (Pass@1)51.839.912.637.912.47.031.2
DeepSWE v1.1 (Resolved)74.073.067.566.962.754.474.2
ProgramBench (Almost@1)37.023.017.519.015.5—20.3
NL2Repo-Bench (Score)75.356.858.058.061.554.264.0
CyberGym (Pass@1)—84.580.084.583.376.788.1
SEC-Bench Pro (Pass@1)—74.3——56.430.962.8
ExploitGym (Pass@1)22.133.7—15.05.41.815.3
HLE w/ tools (Pass@1)63.6—59.862.560.051.563.9
AutomationBench (Pass@1)50.345.846.748.843.237.754.8
Agent's Last Exam (Pass@1)28.626.727.628.525.725.231.8
Chartography w/ tools (Pass@1)84.079.968.1———78.9
BabyVision w/ tools (Pass@1)94.188.985.7———89.6
ZeroBench-main w/ tools (Pass@5)52.053.041.0———49.0

† Text-only subset of HLE.

Performance across agent scaffolds (DeepSWE v1.1 and Terminal-Bench 2.1, Max reasoning effort)

All scaffolds use N=8 samples per task on DeepSWE v1.1 and N=3 on Terminal-Bench 2.1, with Linux containers, temperature=1.0, top_p=0.95, a 1M-token context limit, and max_steps=500 per agent. Terminal-Bench 2.1 is evaluated without network access.

Benchmark (Metric)Claude CodeCodexOpenCodePimini-SWEDSH MinimalDSH StandardDSH PTC
DeepSWE v1.1 (Resolved)69.865.665.566.274.272.670.567.6
Terminal-Bench 2.1 (Pass@1)88.084.185.086.190.390.685.885.8

Prompt Encoding

This release does not include a Jinja-format chat template. The encoding folder contains a self-contained Python reference implementation (encoding.py) with test cases for multi-turn conversations, tool calling, thinking mode, numeric reasoning effort, mid-conversation system messages, and interleaved image content.

For production use, we additionally release deepseek-recipe, a set of Rust libraries with Python bindings that provides the same prompt format as a maintained, protocol-aware toolkit. It converts Messages, Chat Completions, and Responses API requests into the Conversation format, encodes them into DeepSeek V4 and V4.1 prompts or token IDs, and parses model output back into complete or streamed responses — covering thinking, tool calls, images, and generation settings. Model inference, tool execution, and HTTP transport are left to the caller.

Minimal Inference

Please refer to the inference folder for instructions on weight conversion and running inference locally.

Recommended sampling parameters:

ParameterValue
temperature1.0
top_p0.95 or 1.0
context_window1M tokens
max_tokens≥ 256K

Reproducing DeepSWE Benchmark Results

The evaluation folder contains step-by-step instructions for reproducing the DeepSWE v1.1 benchmark results, covering both the dsh-minimal agent and the official mini-swe-agent. The patch required to integrate dsh-minimal with Pier is also included there.