Table of Contents

1. DeepSeek 官方文档
文档:https://api-docs.deepseek.com/zh-cn/
产品:
2. DeepSeek 模型 API 调用方法
2.1 官方API 申请
2.2 API 价格
2.2 API 调用(以Python 为例)
DeepSeek官方 API 目前仅支持 OpenAI SDK 的ChatCompletion API
DeepSeek R1 推理模型的简单实现代码:
import os
from openai import OpenAI
from dotenv import load_dotenv, find_dotenv
# Load environment variables from .env file
load_dotenv(find_dotenv())
# Set API key for DeepSeek
DEEPSEEK_API_KEY = os.getenv("DEEPSEEK")
# Initialize the OpenAI client with the API key and base URL
client = OpenAI(api_key=DEEPSEEK_API_KEY, base_url="https://api.deepseek.com")
# Create a chat completion request
response = client.chat.completions.create(
model="deepseek-reasoner",
messages=[
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Hello"},
],
stream=False
)
# Extract reasoning content and response content from the API response
reasoning_content = response.choices[0].message.reasoning_content
content = response.choices[0].message.content
# Print the extracted content
print("Reasoning Content:")
print(reasoning_content)
print("\nResponse Content:")
print(content)
上述代码将分别展示推理及输出。
3. DeepSeek 进阶运用
3.1 官方 API
将上述代码稍作升级,让DeepSeek模型支持本地cli 的多轮对话,并设置推理过程的开关:
import os
from openai import OpenAI
from dotenv import load_dotenv, find_dotenv
import re
# Load environment variables
load_dotenv(find_dotenv())
# Set API key and model name
DEEPSEEK_API_KEY = os.getenv("DEEPSEEK")
deepseek_model = "deepseek-reasoner" # Replace with the specific DeepSeek model name
client = OpenAI(
api_key=DEEPSEEK_API_KEY,
base_url="https://api.deepseek.com",
)
# Conversation history
conversation = [{"role": "system", "content": "You are a helpful assistant."}]
# Toggles
enable_stream = False # Default stream mode is False
enable_reasoning = True # Default reasoning content display is True
def get_multiline_input():
"""Get multi-line user input"""
lines = []
print("🌓 Continue the conversation, type 'll' to finish input, or 'q' to quit >>>")
while True:
line = input()
if line.strip().lower() == 'q': # Exit the program
return "__END__"
if line.strip().lower() == "ll": # End multi-line input
break
lines.append(line)
return "\n".join(lines)
def send_to_deepseek(messages):
"""Call DeepSeek API to generate a response"""
try:
response = client.chat.completions.create(
model=deepseek_model,
max_tokens=12800,
temperature=0.2,
messages=messages,
stream=enable_stream # Use the toggle for stream mode
)
if enable_stream:
content = ""
reasoning_content = ""
for chunk in response: # Handle streamed responses
if "content" in chunk.choices[0].message:
content += chunk.choices[0].message.content
if enable_reasoning and "reasoning_content" in chunk.choices[0].message:
reasoning_content += chunk.choices[0].message.reasoning_content
if enable_reasoning:
return f"Reasoning:\n{reasoning_content}\n\nResponse:\n{content}"
return content
else:
# Handle non-stream responses
content = response.choices[0].message.content
if enable_reasoning:
reasoning_content = response.choices[0].message.reasoning_content
return f"Reasoning:\n{reasoning_content}\n\nResponse:\n{content}"
return content
except Exception as e:
error_message = str(e)
match = re.search(r'<p>(.*?)</p>', error_message)
if match:
return f"Error: {match.group(1)}"
return f"Error: {error_message}"
def main():
global conversation
global enable_stream
global enable_reasoning
print("Welcome to DeepSeek!")
while True:
user_input = get_multiline_input()
if user_input == "__END__":
print("Program exited.")
break
# Toggle stream mode
if user_input.strip().lower() == "toggle stream":
enable_stream = not enable_stream
print(f"Stream enabled: {enable_stream}")
continue
# Toggle reasoning content
if user_input.strip().lower() == "toggle reasoning":
enable_reasoning = not enable_reasoning
print(f"Reasoning enabled: {enable_reasoning}")
continue
# Add user input to conversation history
conversation.append({"role": "user", "content": user_input})
# Call DeepSeek API to generate a response
response_content = send_to_deepseek(conversation)
if response_content:
conversation.append({"role": "assistant", "content": response_content})
print(f"DeepSeek🤖: {response_content}")
if __name__ == "__main__":
main()
代码预留了推理结果是否显示,以及流式Stream 输出的开关。
更多代码用例参考官方整合Github。
3.2 外部工具
比如,通过Ollama 接口实现DeepSeek 的调用。
4. DeepSeek 模型更新
DeepSeek 于2025/5/28 发布 R1模型小版本试升级
版本升级与体验方式
- DeepSeek R1 模型完成小版本升级,当前版本为 DeepSeek-R1-0528。
- 用户可通过官方网站、App、小程序选择“深度思考”功能体验最新模型,API 也已同步更新,调用方式不变。
思维深度与推理能力升级
- 该版本依然基于 2024 年 12 月发布的 DeepSeek V3 Base 模型,但在后训练阶段使用了更多算力。
- 显著提升模型的思维深度和推理能力,多个基准测评(数学、编程、逻辑等)中表现国内领先,整体已接近国际顶尖模型 o3 与 Gemini-2.5-Pro。
复杂推理任务表现大幅提升
- AIME 2025 测试准确率由旧版的 70% 提升至 87.5%,主要由于思维深度加强,平均使用 tokens 从 12K 增加到 23K,解题过程更为详尽深入。
蒸馏衍生小模型表现优异
- 将 DeepSeek-R1-0528 思维链蒸馏到 Qwen3-8B Base,得到 DeepSeek-R1-0528-Qwen3-8B,其在 AIME 2024 数学测试中性能次于本体版,但超越了原生 Qwen3-8B(高出10%),与 Qwen3-235B 相当。此举对学术界和工业小模型有重要意义。
其他能力更新
- 幻觉率降低45~50%,在改写、摘要、阅读理解等场景中更准确可靠。
- 创意写作能力增强,议论文、小说、散文等文体长度和完整度提升,风格更贴近人类喜好。
- 工具调用支持但不支持思考(thinking)中调用;Tau-Bench测评与 OpenAI o1-high 相当,略逊于o3-High和Claude 4 Sonnet。
- 前端代码生成、角色扮演等方面能力也有提升。
API 与参数变更
- API 同步升级,支持 Function Calling 与 JsonOutput。
- max_tokens 参数现在表示单次输出总长度(包括思考过程),默认为 32K,上限 64K,需关注参数设置防止输出截断。
- 官方及API上下文长度为64K,第三方平台可用128K的开源版。
开源政策与兼容性
- DeepSeek-R1-0528 仅后训练方案不同,base 模型一致。
- 私有部署只需更新checkpoint与tokenizer_config.json。
- 模型参数规模为 685B;开源版上下文128K,网页端等为64K。
- 权重发布于 Huggingface 和 Model Scope,采用MIT License,鼓励模型输出和蒸馏训练新模型。
模型更新官方说明:https://api-docs.deepseek.com/zh-cn/news/news250528
截至文本发布,DeepSeek 未正式发布任何新的推理模型。
5. DeepSeek 热度变化
最初推出直接影响到英伟达股价,当时创造出”DeepSeek 时刻”。
The Rise and Fall of DeepSeek’s Popularity
When DeepSeek’s open-source R1 large language model (LLM) launched in early 2025, the global tech community erupted with excitement. Touted as a direct challenger to OpenAI’s powerhouse O1 inference model, DeepSeek R1 was heralded as a new milestone in accessible, cutting-edge AI development. At its peak, DeepSeek was the subject of Twitter trends, GitHub stars, and countless YouTube explainers. Researchers, developers, and companies from diverse industries rushed to integrate DeepSeek into their workflows.
Yet, less than a year later, DeepSeek’s invocation rates are plummeting. Online forums that once buzzed with tips and enthusiasm have grown quiet; scripts calling the model are now few and far between. What drove this remarkable, whiplash-inducing shift from global sensation to virtual obscurity? Below, we explore the chronology of DeepSeek’s popularity and the key factors behind its fluctuating fortunes.
A Meteoric Beginning
DeepSeek’s debut was timed to perfection. By early 2025, the open-source AI ecosystem hungered for a scalable, accessible LLM that combined transparency with high performance. OpenAI’s O1 was the gold standard for inference tasks, but its closed-weights model and restrictive APIs left many academics and startups wanting more flexibility. DeepSeek’s R1, by contrast, boasted state-of-the-art benchmarks and was released under a permissive open-source license. This triggered a feeding frenzy: from rapid integrations in industry to rapid-fire academic papers leveraging its capabilities.
A significant portion of DeepSeek’s initial appeal came from its open approach. Developers valued the flexibility to fine-tune, audit, or deploy the model in custom hardware environments. Communities collaboratively built wrappers, GUIs, and plugins — all fueled by DeepSeek’s promise of democratizing top-tier AI. For a time, it seemed DeepSeek might dethrone O1 as the go-to engine for AI inference.
Signs of Trouble: The Hype Curve Bends Downward
However, this honeymoon period proved short-lived. By mid-2025, analytics showed a steep drop in API calls and community engagement. Some Discord servers dedicated to DeepSeek went dormant, and notable organizations began migrating their workflows elsewhere. By late 2025, “DeepSeek” had all but vanished from trending tech searches.
Several intertwined factors explain this dramatic cooling of DeepSeek’s popularity:
1. Fierce Competition, Relentless Innovation
The AI landscape does not stand still. Mere months after DeepSeek’s release, rival projects — some from well-funded startups, others backed by academic-industrial partnerships — launched newer, more powerful inference models. These alternatives boasted better context windows, lower latency, and greater energy efficiency. Most tellingly, several matched or exceeded DeepSeek’s performance in complex, multilingual, and zero-shot settings.
OpenAI, in particular, responded aggressively, updating O1’s architecture and API while introducing modular plug-ins and seamless cloud-to-edge scaling. With each innovation, DeepSeek R1 looked more like yesterday’s news.
2. DeepSeek’s Plateau: Where Are the Breakthroughs?
A central frustration for DeepSeek’s early adopters was the lack of continuous improvement. While the R1 launch was impressive, subsequent updates were minor and infrequent. Bug fixes and optimizations trickled in, but DeepSeek Labs did not deliver any R2 leap or show strong roadmaps for closing the gap with newer models.
Users began to perceive DeepSeek as stagnant. In an industry obsessed with novelty, this perception was fatal: the moment a model appears to be standing still, the community’s attention shifts elsewhere.
3. Ecosystem Fatigue and Fragmentation
Initially, the open-source nature of DeepSeek fostered a vibrant ecosystem. But as newer models emerged — many with even more permissive licenses or built-in support for composable workflows — developer attention fragmented. Attempts to federate plugins from DeepSeek into other models were often stymied by incompatibility or maintenance costs. As collaborative efforts waned, the sense of momentum faded.
Deeper Lessons: Hype, Temporality, and the AI Arms Race
The story of DeepSeek is both a cautionary tale and a microcosm of the modern AI boom-bust cycle. In an era where breakthroughs are measured in months rather than years, models that fail to evolve rapidly are left behind. The combination of aggressive competition and user expectation for constant novelty makes sustaining relevance exceptionally difficult. Open-source, while an advantage, is not enough on its own; innovation, roadmap clarity, and a healthy community matter just as much.
For DeepSeek to regain its relevance, it would need not just incremental improvements but a decisive leap — whether R2 or another avenue of differentiation. Its initial moment in the spotlight proved both how quickly excitement can gather and how just as quickly it can dissipate.
As the industry moves forward, DeepSeek’s rise and fall reminds us: In AI, today’s phenomenon may be tomorrow’s footnote, unless evolution is relentless and community momentum sustained. The next breakthrough is always around the corner — and only those who anticipate and outpace it will remain in the limelight.