| — | ||||||||
|---|---|---|---|---|---|---|---|---|
| 多 Agent 原生支持 | ? 3 端點 | ? 需 LangGraph | ? 需自建 | |||||
| 上下文長度 | 128 K | 128 K | 200 K | |||||
| 官方并發 | 500 req/min | 10 k req/min | 5 k req/min | |||||
| 價格(1 M tokens) | ¥1.2 | ¥15.0 | ¥10.5 | |||||
| 中文微調語料 | 85 B tokens | 7 B tokens | 2 B tokens |
?? 官方文檔:https://platform.deepseek.com/docs
?? 價格頁:https://platform.deepseek.com/pricing
curl -fsSL https://raw.githubusercontent.com/deepseek/examples/main/bootstrap.sh | bash
腳本會自動安裝:
?? deepseek-5day-bootcamp/
├ ?? agent.py 單 Agent 示例
├ ?? crew.py 多 Agent 編排
├ ?? memory.py 持久化
├ ?? tools.py 工具鏈
└ ?? deploy.yml K8s 部署
from openai import OpenAI
client = OpenAI(
api_key="sk-xxx",
base_url="https://api.deepseek.com/v1"
)
response = client.chat.completions.create(
model="deepseek-chat",
messages=[{"role": "user", "content": "用 Python 寫一個快速排序"}]
)
print(response.choices[0].message.content)
運行時間 ≈ 1.2 s,token 消耗 212。
stream = client.chat.completions.create(
model="deepseek-chat",
messages=[...],
stream=True
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")

POST /v1/agent/crew
{
"crew_id": "bootcamp_day2",
"agents": [
{"name":"router","role":"router","model":"deepseek-chat"},
{"name":"dev","role":"dev","model":"deepseek-chat"},
{"name":"review","role":"review","model":"deepseek-chat"}
],
"task": "完成一個 Python CLI 工具"
}
返回字段:
session_id:用于后續輪詢
status:queued | running | done | failed
import requests, time
url = "https://api.deepseek.com/v1/agent/crew"
payload = {...}
r = requests.post(url, json=payload, headers={"Authorization":"Bearer sk-xxx"})
session_id = r.json()["session_id"]
while True:
status = requests.get(f"{url}/{session_id}", headers={"Authorization":"Bearer sk-xxx"}).json()["status"]
if status == "done": break
time.sleep(2)
| — | ||||||||
|---|---|---|---|---|---|---|---|---|
| 短期記憶 | 會話級 | /v1/session/memory | 多輪對話 | |||||
| 長期記憶 | 用戶級 | /v1/user/memory | 偏好、歷史 | |||||
| 全局記憶 | 應用級 | /v1/app/memory | 企業知識庫 |
POST /v1/user/memory
{
"user_id": "alice@corp.com",
"key": "tech_stack",
"value": "Python, FastAPI, PostgreSQL"
}
| — | ||||||
|---|---|---|---|---|---|---|
| ?? search | 聯網搜索 | search("Python 3.12 release notes") | ||||
| code_exec | 沙箱執行 | code_exec("print(1+1)") | ||||
| ?? file_read | 讀取文件 | file_read("README.md") |
from deepseek.tools import register_tool
@register_tool(name="jira")
def jira_tool(ticket_id: str) -> str:
return requests.get(f"https://jira.corp.com/rest/api/2/issue/{ticket_id}", auth=("user","pass")).json()["fields"]["summary"]
docker build -t deepseek-crew:v1 .
docker run -p 8000:8000 deepseek-crew:v1
apiVersion: apps/v1
kind: Deployment
metadata:
name: deepseek-crew
spec:
replicas: 3
selector:
matchLabels: {app: deepseek-crew}
template:
metadata:
labels: {app: deepseek-crew}
spec:
containers:
- name: app
image: deepseek-crew:v1
env:
- name: DEEPSEEK_API_KEY
valueFrom:
secretKeyRef: {name: ds-secret, key: api-key}
| — | ||||||
|---|---|---|---|---|---|---|
| Canary | 5 % | 延遲 & 錯誤率 | ||||
| Beta | 30 % | 業務成功率 | ||||
| GA | 100 % | 用戶滿意度 |
| — | ||||||||
|---|---|---|---|---|---|---|---|---|
| 總 tokens | 1.05 M | 1.10 M | 4.5 % | |||||
| 平均延遲 | 2.1 s | 3.7 s | 43 % | |||||
| 成本 | ¥1.26 | ¥16.5 | 92 % |
| — | ||||||
|---|---|---|---|---|---|---|
| 429 rate limit | 連續調用失敗 | 退避重試 + 并發池 | ||||
| 記憶沖突 | 新舊信息覆蓋 | 使用 merge_strategy=append |
||||
| 工具超時 | 沙箱 30 s 限制 | 拆分長任務 |
5 天實踐驗證了 DeepSeek V3.1 多 Agent 協同 API 在「培訓場景」的完整閉環:從單 Agent 熱身到灰度上線,團隊 6 人、累計 40 工時,成功交付一套內部代碼問答機器人。
未來,DeepSeek 官方已預告 「Agent Marketplace」 與 「可視化編排器」,將進一步降低使用門檻。
如果你正在為團隊尋找 低成本、高效率、可落地 的 LLM 培訓方案,現在就是最佳上車時間。