Appearance
DeepSeek R1 第二次响应提示 Server is busy
问题
使用 DeepSeek R1 进行多轮对话时,第一条消息响应正常,从第二条消息开始持续报:
Server is busy. Please try again later.新建对话后问题短暂消失,但上下文无法延续。
分析
这是 DeepSeek 服务器端容量问题,在以下情况下高发:
- 高峰期(北京时间早上 9~11 点、晚上 8~11 点)
- 模型刚发布期(如 R1 发布初期流量爆发)
- R1 推理时间较长,服务器并发名额更稀缺
解决方案
- 错峰使用:避开高峰时段,使用效果最明显
- 重试逻辑:在代码中加指数退避重试:
python
import time
from openai import OpenAI
client = OpenAI(api_key="your-key", base_url="https://api.deepseek.com")
def chat_with_retry(messages, max_retries=5):
for i in range(max_retries):
try:
return client.chat.completions.create(
model="deepseek-reasoner",
messages=messages
)
except Exception as e:
if "busy" in str(e).lower() and i < max_retries - 1:
wait = 2 ** i
print(f"Server busy, retrying in {wait}s...")
time.sleep(wait)
else:
raise- 切换第三方服务:火山引擎、硅基流动等平台部署了 DeepSeek R1,高峰期稳定性更好。