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

教程 · 2026-04-24 · 机器翻译,仅供参考

如何在2026年使用DeepSeek:聊天、应用和API操作指南

Tutorials·April 24, 2026·By DS指南编辑
DeepSeek how-to-use tutorial card showing the three access paths to V4 — web chat at chat.deepseek.com, the iOS/Android app, and the API at platform.deepseek.com — plus the first /chat/completions call and tier-selection guidance for V4-Flash and V4-Pro.

所以你听说过DeepSeek,并真正想尝试它——而不是再阅读另一份新闻稿。本指南从三个角度介绍了如何使用DeepSeek:chat.deepseek.com上的免费网页聊天、iOS和Android应用,以及现在为两者提供动力的开发者API。自从预览版发布以来,我已经在生产环境中运行了DeepSeek V4,在此之前还有R1、V3和V3.2,所以以下步骤反映了2026年4月24日实际可行的方法——而不是营销页面所声称的内容。到结束时,你将已经登录到聊天机器人,在思考和非思考模式之间切换,使用OpenAI SDK发送了第一个API请求,并对V4两个级别进行了实际工作负载的成本计算。

概述DeepSeek是什么

Modern desk with a laptop and phone showing the DeepSeek chat interface during a hands-on walkthrough.

DeepSeek是一家位于杭州的AI实验室,提供开放权重的专家混合语言模型,以及基于它们的消费者聊天机器人和开发者API。当前一代,发布于2026年4月24日,是 DeepSeek V4(预览版), shipped as two model IDs: deepseek-v4-pro (总参数量1.6T,每token活跃参数量49B)以及 deepseek-v4-flash (总容量284B,活跃容量13B)。两者都是MIT许可下的开放权重MoE模型,默认为100万个token的上下文窗口,输出最多384,000个token,并且都可以通过单个与OpenAI兼容的端点访问。如果你首先想了解背景,请参阅 what is DeepSeek 基础教程涵盖了实验室、资金和模型系列。

使用DeepSeek的三种方法

DeepSeek提供了三个入口点。在创建账户之前,选择与你的目标相匹配的一个——注册流程是相同的,但界面表现却大不相同。

  • Web chat 在chat.deepseek.com——浏览器,保留对话历史,最适合一次性研究、草稿和推理。
  • Mobile app 在iOS和Android上——与网页版相同的功能集,支持语音输入和推送同步。
  • Developer API at https://api.deepseek.com ——无状态、按token付费,适用于自动化和产品。

网络聊天与API:让人感到困惑的一个区别

网页聊天和移动应用将您的对话历史保存在服务器端以供您的账户使用;您可以关闭标签页,明天回来,从上次离开的地方继续。API则不是这样。端点是无状态的——您的客户端必须在每次请求时重新发送完整的消息数组以维持多轮对话。将这两者混淆是初学者最常见的错误。 POST /chat/completions 端点是无状态的——您的客户端必须在每次请求时重新发送完整的消息数组以维持多轮对话。混淆这两者是初学者最常见的错误。

第一步:创建账户

访问 chat.deepseek.com,使用电子邮件地址、Google账户或电话号码注册。如果您使用的是移动设备,请先从App Store或Play Store安装官方应用——存在第三方冒充者,并且我们的 verify official DeepSeek app 清单显示了如何确认发布者。对于带有截图的完整操作指南,请参阅 DeepSeek account setup guide.

第二步:使用聊天机器人(带思考模式)

登录后,您将进入聊天窗口。DeepSeek V4现在在网页和应用程序上都是默认模型——没有模型选择器。您拥有的就是 DeepThink toggle 输入框上方。关闭它以获得快速答案;当任务需要深思熟虑(多步数学、代码调试、规划)时打开它。幕后,DeepThink会在非思考模式和思考模式之间切换V4;相同的开关在API中作为参数公开。

DeepSeek web chat interface with DeepThink toggle enabled
网络聊天保留会话历史;API 不保留。

何时切换DeepThink功能

  • 数学、证明、奥数风格的问题。
  • 调试代码,其中第一次猜测通常都是错误的。
  • 多文档比较或长上下文推理。
  • 任何你宁愿等待20秒以获得更好的答案也不愿得到快速、肤浅答案的任务。

第3步:获取API密钥

对于任何超出闲聊范围的事情,API是DeepSeek赢得声誉的地方。打开 platform.deepseek.com,使用相同的凭据登录,前往 API Keys,然后点击 创建新密钥立即复制值——DeepSeek只会显示一次。从“计费”标签页中加载一小部分余额(实验用5美元就足够了)。DeepSeek可能会提供作为促销信用额的已授余额,这可能会有有效期,因此请检查计费控制台中的当前优惠,而不是假设任何免费层。完整的设置细节请参阅 get a DeepSeek API key walkthrough.

第4步:进行第一次API调用

Editor and terminal showing a first DeepSeek V4 API call from Python with a JSON response printed back.

DeepSeek API与OpenAI的Chat Completions格式兼容,因此官方OpenAI Python SDK无需更改即可使用——您只需交换 base_url and api_key. Chat requests hit POST /chat/completions,与OpenAI兼容的端点。如果您更喜欢Anthropic SDK,DeepSeek也在相同的基URL上暴露了Anthropic兼容的表面。

这里是一个使用 Python 的最小示例 deepseek-v4-flash,这是成本效益最高的层级,大多数生产工作负载都应该从这里开始:

from openai import OpenAI

client = OpenAI(
    base_url="https://api.deepseek.com",
    api_key="sk-...",  # your key
)

resp = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[
        {"role": "system", "content": "You are a concise assistant."},
        {"role": "user", "content": "Summarise the capital of France in one line."},
    ],
    temperature=1.3,
    max_tokens=200,
)

print(resp.choices[0].message.content)

与 curl 一行命令相同的请求:

curl https://api.deepseek.com/chat/completions 
  -H "Authorization: Bearer $DEEPSEEK_API_KEY" 
  -H "Content-Type: application/json" 
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

如果您来自 Node,模式是相同的——请参阅 JavaScript 版本的 DeepSeek Node.js integration 教程。

在API中启用思考模式

V4 中的思考模式是一个 parameter,而不是一个单独的模型 ID。您保持在 deepseek-v4-pro or deepseek-v4-flash 并添加两个字段:

resp = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[{"role": "user", "content": "Plan a migration from V3.2 to V4."}],
    reasoning_effort="high",
    extra_body={"thinking": {"type": "enabled"}},
)
# resp.choices[0].message.reasoning_content  -> the reasoning trace
# resp.choices[0].message.content            -> the final answer

启用思考模式后,响应将返回 reasoning_content alongside the final content。对于最重的任务,设置 reasoning_effort="max" ——只需确保 max_tokens 允许 384,000 个标记,以便跟踪不会被截断。

旧版模型ID和迁移窗口

如果您正在维护较旧的集成,则遗留的 ID deepseek-chat and deepseek-reasoner 仍然在今天有效。它们现在分别路由到 deepseek-v4-flash 非思考模式和思考模式。两者都将 retired on 2026-07-24 at 15:59 UTC,之后使用这些ID的请求将失败。迁移只需一行更改:更新 model= 字段。您的 base_url does not change.

第5步:选择正确的参数

DeepSeek 文档根据任务类型推荐 temperature 设置。匹配它们可以节省您大量的试错时间。

Task Temperature Notes
Code generation, mathematics 0.0 确定性——相同的提示,相同的答案。
Data analysis, data cleaning 1.0 平衡;很好地遵循结构化提示。
General conversation, translation 1.3 大多数聊天机器人的默认设置。
Creative writing, poetry 1.5 更丰富的词汇选择。

值得早期了解的其他参数:

  • top_p — 核心采样;使用核心采样代替,而不是与激进的温度调整同时使用。
  • max_tokens — 限制输出长度。使用V4可以高达384,000。
  • stream=true — 服务器发送事件,用于逐个标记的UI。
  • response_format={"type": "json_object"} — JSON模式(见以下注意事项)。
  • tools — 兼容OpenAI的功能调用;在思考和非思考模式下都有效。

关于JSON模式的说明

JSON mode is designed 返回有效的JSON,但不保证。三条规则使其可靠:在提示中包含单词“json”和一个小示例模式,设置 max_tokens 足够高,以便输出不会被截断,并且优雅地处理偶尔的空内容。完整模式请参阅 DeepSeek API JSON mode reference.

第6步:计算成本

DeepSeek的定价有三个令牌桶,而不是两个,跳过任何一个都会使估计变得没有意义。截至2026年4月,每100万个令牌的费率如下:

Model Cache hit (input) Cache miss (input) Output
deepseek-v4-flash $0.0028 $0.14 $0.28
deepseek-v4-pro $0.003625 promo / $0.0145 list $0.435 promo / $1.74 list $0.87 promo / $3.48 list

V4-Pro的输出价格大约是V4-Flash的12倍。除非某个基准测试特别证明了前沿级别的合理性,否则从Flash开始。DeepSeek之前运行的离峰折扣已于2025-09-05结束,并且尚未恢复。

Worked example: 1,000,000 chat calls on V4-Flash

假设每次调用都有一个缓存的2,000个token的系统提示,一个新鲜的200个token的用户消息,以及一个300个token的响应。

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

The same workload on deepseek-v4-pro 将是 $29.00 + $348.00 + $1,044.00 = $1,421.00. 注意,每次调用中的用户消息是对缓存的prefix的未命中——一个常见的错误是,一旦看到任何缓存命中,就假设整个输入都已被缓存。并非如此。对于重复的成本建模,请... DeepSeek pricing calculator lets you plug in your own token counts.

第7步:验证是否成功

三个检查告诉你集成是健康的:

  1. 非空 HTTP 200 响应 choices[0].message.content.
  2. 令牌计数在 usage 对象中与您预期的相符(大约每 0.75 个英语单词一个令牌)。
  3. 如果处于思考模式, reasoning_content 已填充,并且与硬提示中的最终答案相比明显更长。

Common errors and fixes

Symptom Likely cause Fix
401 Unauthorized 错误或已撤销的密钥 从API密钥页面重新生成;通过环境变量设置,而不是在源代码中。
402 Insufficient Balance 账户余额已降至零 在账单中充值;授权的余额可能会过期。
模型“忘记”了之前的回合 API是无状态的 Resend the full messages 每个请求的数组。
JSON模式下的空JSON 提示缺失“json”或模式示例 添加两者;提升 max_tokens.
被截断的思考输出 max_tokens 对于太低 reasoning_effort="max" Set max_tokens 允许384,000个
旧版ID将于7月后失效 2026-07-24 15:59 UTC停用 Swap deepseek-chat → deepseek-v4-flash.

更长的修复列表位于 DeepSeek troubleshooting and DeepSeek API error codes.

DeepSeek适用之处,不适之处

DeepSeek V4在编码、数学、长上下文推理和结构化输出方面表现最强——这些领域是V4 Preview公告报告中所提到的。 deepseek-v4-pro 在SWE-Bench Verified上达到80.6%。它在一些消费者打磨方面不如美国的大型实验室:语音模式、原生图像生成、深度第三方插件生态系统。对于前沿聊天... 应用程序 拥有庞大的集成目录, DeepSeek vs ChatGPT 列出了每个产品的优势所在。对于API工作负载的原始每token成本,截至2026年4月,DeepSeek-V4-Flash是前沿级别中最便宜的选择之一——但在做出承诺之前,请始终比较每个提供商的当前定价页面。

Next steps

Diagram of three DeepSeek surfaces - web chat, mobile app and API - all routing to V4.

基础功能运行正常后,自然的发展步骤是:

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.

Frequently asked questions

Is DeepSeek free to use?

DeepSeek官网聊天室(chat.deepseek.com)和移动应用免费使用,截至2026年4月,没有公开记录的每日消息上限。API按token计费,默认没有免费层——DeepSeek可能会为新账户提供一定的促销余额,但这可能会过期,请检查账单控制台。关于免费和不免费内容的详细说明,请参阅 is DeepSeek free.

如何在思考模式和非思考模式之间切换?

在网页聊天或应用中,使用输入框上方的DeepThink开关——开启表示思考模式,关闭表示快速响应。在API中,保持相同的V4模型ID,并设置 reasoning_effort="high" plus extra_body={"thinking": {"type": "enabled"}}默认为启用思考功能;传递 extra_body={"thinking": {"type": "disabled"}} 用于非思考模式。完整参数引用见 DeepSeek API documentation.

What is the difference between DeepSeek V4-Pro and V4-Flash?

V4-Pro拥有1.6T总参数(49B活跃)并针对前沿编码和代理工作。V4-Flash拥有284B总参数(13B活跃),在输出token上的成本大约是Pro的十二分之一,同时能够舒适地处理大多数聊天和助手工作负载。两者共享1M-token的上下文窗口和相同的功能集。详细规格请参阅 DeepSeek V4 page.

Does the DeepSeek API remember previous messages?

号。是的,直到2026-07-24 15:59 UTC。当前两个旧ID都路由到 POST /chat/completions 端点是无状态的——DeepSeek不会在服务器端保留API请求的对话历史。您的客户端必须在每次调用时重新发送完整的 messages 数组。只有网页聊天和移动应用会为您保留会话历史。更多详情请参阅 DeepSeek browser vs app guide.

Can I still use deepseek-chat and deepseek-reasoner?

非思考模式, deepseek-v4-flash — deepseek-chat 迁移模式参考。 deepseek-reasoner 在思考模式下。之后,这些ID将被淘汰,使用它们的请求将失败。迁移只需一行代码更改即可。 model field; base_url stays the same. See the DeepSeek API best practices reference for migration patterns.

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.