DeepSeek 网摘deepseek.wang
EN
📄 查看英文原文

指南 · 2026-04-25 · 机器翻译,仅供参考

The DeepSeek Advanced Guide for V4 Pro, V4 Flash and Thinking Mode

Guides·April 25, 2026·By DS指南编辑
DeepSeek advanced guide card showing the four facts that frame the production patterns in April 2026: cache-aware cost math (cache-hit, cache-miss, output buckets), legacy deepseek-chat and deepseek-reasoner IDs retiring on July 24, 2026, V4-Pro and V4-Flash both supported, and battle-tested production patterns rather than benchmark theatre.

您已经知道如何向DeepSeek发送聊天请求。本高级指南回答的问题是下一个:您如何在生产中实际运行V4,而不会烧掉预算、在长上下文中遇到截断,或者发送偶尔为空的JSON?自2026年4月24日预览发布以来,我已经在V3.2迁移工作负载的同周开始运行DeepSeek V4 Pro和V4 Flash。以下模式来自可计费流量,而非基准测试场景——模型选择、思维模式管道、缓存感知成本计算以及7月24日之前退休的旧ID的迁移窗口。期待具体数字、有效代码以及关于V4仍存在不足的一些观点。

DeepSeek V4 的变化及其为何对高级用户很重要

Multi-monitor power-user desk running DeepSeek V4 Pro and Flash with Thinking Mode in a long session

DeepSeek V4不是一个模型。它是一个 两个开放式混合专家层系列,同一天发布,具有共享的功能集。V4-Pro总参数为1.6T,每个token活跃49B,V4-Flash总参数为284B,每个token活跃13B。两者都支持一百万token的上下文长度,并且都遵循MIT许可的开源权重。

对于生产工作负载,有两个架构决策很重要。首先,新的混合注意力结合了压缩稀疏注意力(CSA)和高度压缩注意力(HCA),以显著提高长上下文效率。其次,效率提升足够大,使得1M上下文变得可负担:在1M-token上下文设置中,与DeepSeek-V3.2相比,DeepSeek-V4-Pro只需要27%的单token推理FLOPs和10%的KV缓存。V4-Flash的降低幅度更大。

如果您是从V3.2或更早版本升级的,请参阅 DeepSeek V3.2 前一代基线参考;本文其余部分默认采用V4。

模型选择:何时选择 V4 Pro 与 V4 Flash

V4 Pro的每输出token成本大约是Flash的12倍。这个比例几乎驱动了每一个选择决策。对于大多数团队来说,诚实的答案是:从Flash开始,当基准测试差距映射到实际收入或质量杠杆时,将特定路由升级到Pro。

Dimension V4-Flash V4-Pro
Total / active params 284B / 13B 1.6T / 49B
Default context 1,000,000 tokens 1,000,000 tokens
Max output tokens 384,000 384,000
SWE-Bench Verified 79.0% 80.6%
Terminal-Bench 2.0 56.9% 67.9%
输出每100万令牌的价格(美元) $0.28 $0.87 promo / $3.48 list
最佳匹配 聊天,RAG,高量级代理 前沿编码,复杂多步骤智能体

Terminal-Bench差距是代理构建者最有用的数据点。Terminal-Bench 2.0涉及3小时超时的真实自主终端执行,这个差距对于代理工作流程来说比单轮编码基准测试更重要。如果您的代理在沙盒中运行数十分钟,Pro就能证明其价值。如果它只响应一个工具调用并返回,Flash几乎总是正确的选择。

为了进行更深入的面对面比较, DeepSeek V4-Pro and DeepSeek V4-Flash 参考页面将基准测试按任务类型分解。

Thinking mode: a parameter, not a model

从V3.x版本最大的API变化是,思考模式不再是单独的模型ID。DeepSeek-V4-Pro和DeepSeek-V4-Flash都支持三种推理努力模式:非思考(默认),思考模式。 reasoning_effort="high",以及一个全力以赴的层级, reasoning_effort="max"。模式是按请求设置的。

Chat requests hit POST /chat/completions, the OpenAI-compatible endpoint at https://api.deepseek.com。以下是一个使用OpenAI SDK调用V4-Pro思考模式的Python最小示例:

from openai import OpenAI

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

resp = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[
        {"role": "system", "content": "You are a senior SRE. Be terse."},
        {"role": "user", "content": "Plan a zero-downtime Postgres 14->16 upgrade."},
    ],
    reasoning_effort="high",
    extra_body={"thinking": {"type": "enabled"}},
    max_tokens=8000,
)

print(resp.choices[0].message.reasoning_content)  # the reasoning content
print(resp.choices[0].message.content)            # the final answer

When thinking is enabled the response returns reasoning_content alongside the final content两个操作注意事项:最大努力思考需要空间——对于Think Max推理模式,推荐上下文窗口至少为384K个token。并且DeepSeek还公开了一个与相同基础URL兼容的Anthropic表面,因此Anthropic SDK可以通过交换 base_url and api_key.

对于采样默认值,DeepSeek官方指南值得记住:代码和数学的温度为0.0,数据分析为1.0,一般对话和翻译为1.3,创意写作为1.5。完整参考信息位于 DeepSeek API best practices page.

无状态API:打破天真端口规则的规则

The /chat/completions 端点是无状态的。服务器不会记住之前的回合。每个多回合请求必须重新发送完整的 messages 数组——系统、用户、助手、用户等——否则模型将像对话刚刚开始一样响应。

这与网页聊天和移动应用形成对比,后者在服务器端维护用户的会话历史。如果您正在移植一个“只需工作”的流程, DeepSeek chat, API边界最常见的错误是忘记持久化和重新发送会话状态。构建一个最近轮次的环形缓冲区,或者依赖上下文缓存(下一节)以使重新发送变得便宜。

成本计算:如何在不欺骗自己的情况下定价工作负载

下面的每个成本示例都明确指出了层级。在V4-Flash和V4-Pro之间混合费率是我看到幻灯片中最常见的错误。

V4-Flash工作示例

工作负载:每月100万次调用,2000个token缓存的系统提示,200个token的用户消息(未缓存),300个token的响应。

  • Cached input: 2,000,000,000 tokens × $0.0028/M = $5.60
  • Uncached input: 200,000,000 tokens × $0.14/M = $28.00
  • Output: 300,000,000 tokens × $0.28/M = $84.00
  • Total: $117.60

V4-Pro工作示例

相同工作量,专业版费率:

  • 缓存输入:2,000,000,000 × 0.0145/兆字节 = $29.00
  • 非缓存输入:200,000,000 × 1.74/兆字节 (列表) = $348.00
  • 输出:300,000,000 × 3.48/兆字节 (列表) = $1,044.00
  • 总计:列表价格为 1,421.00 美元 (currently $355.25 during the 75% V4-Pro promo through 2026-05-31)

人们容易忘记两件事。每次调用中的用户消息是对缓存前缀的未缓存缺失——你不能假装系统提示缓存命中覆盖了整个输入。并且输出主导了Pro的费用:上述示例中总费用的62%。如果你不能让模型在更少的token内回答,Pro会受到影响。 DeepSeek context caching guide and the DeepSeek pricing calculator 将允许您插入自己的比例。

注意,非高峰期折扣已于2025年9月5日结束,并且V4尚未恢复。将它们作为活跃状态引用是一个常见的错误——不要这样做。

JSON模式,工具调用,FIM及其他表面功能

DeepSeek的 JSON mode 设计为返回有效的JSON,但不保证一定如此。我对每个JSON模式路由强制执行的三个规则:

  1. 在提示中包含“json”一词以及一个小示例模式。文档要求这样做;当你这样做时,模型更可靠。
  2. Set max_tokens 足够高,以至于JSON不能被截断。截断的JSON是无效的JSON。
  3. 明确处理空内容情况。API有时会返回空字符串,请使用try/except语句进行异常处理。 json.loads 还不够。

工具调用采用与OpenAI兼容的格式,并在思考和非思考模式下均受支持。 FIM (Fill-In-the-Middle) completion 目前处于Beta测试阶段,仅以非思考模式运行;对于代码补全插件来说,与DeepSeek Chat搭配使用时非常有用。 DeepSeek with VS Code 或者您自己的编辑器界面。通过以下方式启用流: stream=true当开启思考模式时,推理内容会与最终内容并行流式传输。Chat Prefix Completion也处于Beta测试阶段,适用于续写风格的提示。

V3.2 → V4迁移清单

DeepSeek V4 modes — Flash, Pro, Thinking

有三个集成变量很重要,工作量不大。旧版ID的退役窗口是唯一的硬性截止日期:

  1. 交换模型字段。 Replace deepseek-chat with deepseek-v4-flash, and deepseek-reasoner with deepseek-v4-flash 加上上述的思考参数。deepseek-chat和deepseek-reasoner将在2026年7月24日15:59(UTC时间)后完全退役且不可访问,目前正路由到deepseek-v4-flash的非思考/思考模式。
  2. 保持基本URL。 无更改。 https://api.deepseek.com.
  3. 重新调优。 max_tokens 用于新的上下文预算。 默认输入为1M;输出可达384,000。

如果您也使用网页聊天,V4 现在是默认选项。DeepSeek-V4 已在 Hugging Face、DeepSeek API 和 chat.deepseek.com(专家模式=V4-Pro,即时模式=V4-Flash)上发布。

V4仍有哪些不足

两个明显的差距。HLE(人类最后考试)37.7%的成绩使 V4-Pro 低于 Claude(40.0%)、GPT-5.4(39.8%),并且远低于 Gemini-3.1-Pro(44.4%)——HLE 测试的是专家级别的跨领域推理能力。SimpleQA-Verified 在 57.9% 与 Gemini 的 75.6% 相比,揭示了有意义的实际知识检索差距;如果您的用例需要准确的真实世界知识回忆,Gemini 拥有明显的优势。将检索功能集成到您的堆栈中——参见 DeepSeek RAG tutorial —而不是让V4记住整个世界。

与主流封闭替代方案进行对比,以下是完整delta的概述。 DeepSeek vs Claude and DeepSeek vs ChatGPT 在这里,比较的深度超过了空间的限制。生产路线的模式和提示模板存在于更广泛的 DeepSeek beginner guides hub.

DeepSeek AI Guide is an independent resource and is not affiliated with DeepSeek or its parent company. Model IDs, pricing and API behaviour change; check the official DeepSeek documentation and pricing page before committing to a production decision.

实际上,DeepSeek V4与V3.2有何不同?

V4 以两个 MoE 层级发布——V4-Pro(1.6T/49B 活跃)和 V4-Flash(284B/13B 活跃)——而不是 V3.2 的单一聊天/推理对。两者默认为 1,000,000 个 token 的上下文,输出最多可达 384,000 个 token,思考模式是一个请求参数,而不是单独的模型 ID。迁移是一个模型字段交换;参见 DeepSeek V4 响应包含两个字段:

当处于思考模式时,DeepSeek API返回什么?

模型的推理内容,以及 reasoning_content 最终答案。两个字段在 content 任何V4模型上同时流式传输。 stream=true. Set reasoning_effort="high" with extra_body={"thinking": {"type": "enabled"}} on either V4 model. The DeepSeek API streaming 指南涵盖了缓冲和部分令牌处理。

我能否继续使用deepseek-chat和deepseek-reasoner?

是的,但仅至2026年7月24日15:59 UTC。当前两个旧ID都路由到 deepseek-v4-flash 分别在非思考模式和思考模式下的情况。退休后,使用这些 ID 的请求将失败。迁移是一个单行 model= 变更;基本URL不会改变。逐步说明位于 DeepSeek API documentation page.

DeepSeek的API是否像网络聊天那样记住对话历史?

No. The /chat/completions 端点是无状态的——客户端必须在每个请求中重新发送完整的消息历史。网页聊天和移动应用会为用户保留会话历史,但开发者界面不会。请在您的端持久化会话状态,或使用上下文缓存来保持重发成本低。The DeepSeek context caching 页面上记录了缓存命中率。

DeepSeek V4实际上是开源的吗?

是的——V4-Pro和V4-Flash都作为开源权重在MIT许可下发布,可在Hugging Face上获取。这涵盖了本地运行、微调和商业部署,但需遵守MIT条款。较旧版本有时会将代码(MIT)与权重(单独的DeepSeek模型许可)分开; is DeepSeek open source 指南跟踪每个模型的许可。

Sources & Methodology

Last source check: April 30, 2026

Primary sources

Technical references

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

引用带主要来源链接的事实为高;上下文叙述为中等。

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.