🔥 DeepClaude:用 DeepSeek V4 Pro 跑 Claude Code 的 Agent 循环,省 90% 费用
项目地址:aattaran/deepclaude | ⭐ 1.8k+ Stars | 🛠 JavaScript | 作者 aattaran
老实说,Claude Code 是目前最好用的终端编码 Agent——但 $200/月的 Max Plan 加上 $15/M 的 output token 定价,用起来是真的心疼。DeepSeek V4 Pro 在 LiveCodeBench 上 96.4%,output 只要 $0.87/M,便宜了 17 倍。问题来了:怎么让 Claude Code 那套强大的自主 Agent 循环去调 DeepSeek 的脑子?
DeepClaude 干的就是这事儿。 它不换你的工具链,只换背后推理的模型。
一、架构:偷梁换柱
结构简单到离谱:
你的终端
+-- Claude Code CLI(工具循环、文件编辑、bash、git — 原封不动)
+-- API 调用 -> DeepSeek V4 Pro ($0.87/M) 替代 Anthropic ($15/M)
所有功能照常工作:文件读写、bash 执行、子 Agent 派发、多步自主编码。唯一变的是哪个模型在思考。
二、2 分钟上手
安装:
# macOS/Linux
chmod +x deepclaude.sh
sudo ln -s "$(pwd)/deepclaude.sh" /usr/local/bin/deepclaude
# 设 API Key
export DEEPSEEK_API_KEY="sk-..."
使用:
deepclaude # 默认用 DeepSeek V4 Pro 启动
deepclaude --backend or # 换 OpenRouter(最便宜)
deepclaude --backend fw # 换 Fireworks AI(最快)
deepclaude --backend anthropic # 切回 Anthropic(处理难题)
deepclaude --cost # 看价格对比
就一行 deepclaude,剩下的一切体验跟原生 Claude Code 完全一样。
三、Live Switching:不重启切换后端
最骚的操作是 slash command。把三个命令文件放进 ~/.claude/commands/:
~/.claude/commands/deepseek.md:
Switch the model proxy to DeepSeek. Run this command silently and report the result:
curl -sX POST http://127.0.0.1:3200/_proxy/mode -d "backend=deepseek"
If successful, say: "Switched to DeepSeek."
~/.claude/commands/anthropic.md:
Switch the model proxy back to Anthropic. Run this command silently and report the result:
curl -sX POST http://127.0.0.1:3200/_proxy/mode -d "backend=anthropic"
If successful, say: "Switched to Anthropic."
然后在聊天框打 /deepseek 或 /anthropic 就能即时切换——同一个 session,不用重启。日常搬砖用 DeepSeek,遇到复杂推理 slash 切回 Opus。
四、Cost Tracking
DeepClaude 自带的 proxy 跑在 localhost:3200,追踪每个后端的 token 消耗:
curl -s http://127.0.0.1:3200/_proxy/cost
返回:
{
"backends": {
"deepseek": {
"input_tokens": 125000,
"output_tokens": 45000,
"requests": 12,
"cost": 0.0941,
"anthropic_equivalent": 1.05
}
},
"total_cost": 0.0941,
"anthropic_equivalent": 1.05,
"savings": 0.9559
}
实际省钱效果: 轻度使用(10天/月)从 $200 干到 ~$20/月,省 90%。重度使用(25天/月)~$50/月。DeepSeek 的自动上下文缓存让 Agent 循环极其便宜——首轮之后的系统提示和文件上下文只要 $0.004/M。
五、Remote Control:浏览器里用
deepclaude --remote
会打印一个 https://claude.ai/code/session_... 链接,手机、平板、任何浏览器都能打开。远程控制的 WebSocket 桥接走 Anthropic 基础设施,模型调用走本地 proxy,所以你需要 Claude Code 登录状态和一个 claude.ai 订阅。
六、踩坑记录
总结:
/anthropic 切回 Opus,灵活度拉满标签:#AI编程 #Agent #DeepSeek #ClaudeCode #省钱