# DeepClaude - 搭载 DeepSeek V4 Pro 的 Claude Code 代理循环，价格仅为原价的 1/17

- 来源：Hacker News 热门（buzzing.cc 中文翻译）
- 作者：alattaran
- 发布时间：2026-05-04 08:13
- AIHOT 分数：72
- AIHOT 标记：精选
- AIHOT 链接：https://aihot.virxact.com/items/cmoqgdoi314c1sll9cav3273r
- 原文链接：https://github.com/aattaran/deepclaude

## 精选理由

用 DeepSeek V4 Pro 跑 Claude Code 代理循环，成本直接打到一杯奶茶钱，虽说不一定每个任务都能媲美原版，但便宜成这样还要什么自行车？

## AI 摘要

DeepClaude项目在GitHub上发布，它是一个结合了DeepSeek V4 Pro模型的Claude代码代理循环工具。该工具的核心优势在于显著降低了使用成本，其价格仅为原Claude方案的1/17，即便宜了约17倍。这一开源方案为开发者提供了一个高性能且极具成本效益的代码生成与处理替代选择。

## 正文

deepclaude

使用 Claude Code 的自主智能体循环，搭配 DeepSeek V4 Pro、OpenRouter 或任何兼容 Anthropic 的后端。相同的用户体验，成本降低 17 倍。

这是做什么的

Claude Code 是最优秀的自主编码智能体——但它每月收费 200 美元且有使用上限。DeepSeek V4 Pro 在 LiveCodeBench 上得分 96.4%，输出 token 成本为 $0.87/M。

deepclaude 替换了大脑，保留了身体：

Your terminal
+-- Claude Code CLI (tool loop, file editing, bash, git - unchanged)
+-- API calls -> DeepSeek V4 Pro ($0.87/M) instead of Anthropic ($15/M)

一切功能都正常工作：文件读取、编辑、bash 执行、子智能体生成、自主多步编码循环。唯一的区别是哪个模型在思考。

快速入门（2 分钟）

1. 获取 DeepSeek API 密钥

在 platform.deepseek.com 注册，充值 5 美元，复制你的 API 密钥。

2. 设置环境变量

Windows（PowerShell）：

setx DEEPSEEK_API_KEY "sk-your-key-here"

macOS/Linux：

echo 'export DEEPSEEK_API_KEY="sk-your-key-here"' >> ~/.bashrc
source ~/.bashrc

3. 安装

Windows：

# Copy the script to a directory in your PATH
Copy-Item deepclaude.ps1 "$env:USERPROFILE\.local\bin\deepclaude.ps1"

# Or add the repo directory to PATH
setx PATH "$env:PATH;C:\path\to\deepclaude"

macOS/Linux：

chmod +x deepclaude.sh
sudo ln -s "$(pwd)/deepclaude.sh" /usr/local/bin/deepclaude

4. 使用它

deepclaude # Launch Claude Code with DeepSeek V4 Pro
deepclaude --status # Show available backends and keys
deepclaude --backend or # Use OpenRouter (cheapest, $0.44/M input)
deepclaude --backend fw # Use Fireworks AI (fastest, US servers)
deepclaude --backend anthropic # Normal Claude Code (when you need Opus)
deepclaude --cost # Show pricing comparison
deepclaude --benchmark # Latency test across all providers
deepclaude --switch ds # Switch backend mid-session (no restart)

工作原理

Claude Code 会读取这些环境变量，以确定将 API 调用发送到哪里：

变量 作用

ANTHROPIC_BASE_URL API 端点（默认：api.anthropic.com）

ANTHROPIC_AUTH_TOKEN 后端的 API 密钥

ANTHROPIC_DEFAULT_OPUS_MODEL Opus 级别任务的模型名称

ANTHROPIC_DEFAULT_SONNET_MODEL Sonnet 级别任务的模型名称

ANTHROPIC_DEFAULT_HAIKU_MODEL Haiku 级别任务（子智能体）的模型名称

CLAUDE_CODE_SUBAGENT_MODEL 生成的子智能体使用的模型

deepclaude 会在每个会话中设置这些变量（非永久），启动 Claude Code，然后在退出时恢复原始设置。

支持的后端

后端 标志 输入/M 输出/M 服务器 备注

DeepSeek（默认） --backend ds $0.44 $0.87 中国 自动上下文缓存（重复轮次成本降低 120 倍）

OpenRouter --backend or $0.44 $0.87 美国 价格最低，从美国/欧洲延迟最低

Fireworks AI --backend fw $1.74 $3.48 美国 最快的推理

Anthropic --backend anthropic $3.00 $15.00 美国 原始 Claude Opus（用于难题）

各后端设置

DeepSeek（默认——只需 DEEPSEEK_API_KEY）：

setx DEEPSEEK_API_KEY "sk-..." # Windows
export DEEPSEEK_API_KEY="sk-..." # macOS/Linux

OpenRouter（可选）：

setx OPENROUTER_API_KEY "sk-or-..." # Windows
export OPENROUTER_API_KEY="sk-or-..." # macOS/Linux

Fireworks AI（可选）：

setx FIREWORKS_API_KEY "fw_..." # Windows
export FIREWORKS_API_KEY="fw_..." # macOS/Linux

成本对比

使用级别 Anthropic Max deepclaude（DeepSeek） 节省

轻度（每月 10 天） $200/月（有上限） 约 $20/月 90%

重度（每月 25 天） $200/月（有上限） 约 $50/月 75%

使用自动循环 $200/月（有上限） 约 $80/月 60%

DeepSeek 的自动上下文缓存使得智能体循环极其便宜——第一次请求后，系统提示和文件上下文以 $0.004/M 的价格被缓存（相比之下，未缓存时是 $0.44/M）。

哪些功能有效，哪些无效

有效

文件读取、写入、编辑（读/写/编辑工具）

Bash/PowerShell 执行

Glob 和 Grep 搜索

多步骤自主工具循环

子智能体生成

Git 操作

项目初始化（/init）

思考模式（默认启用）

无法工作或性能降级

功能 原因

图像/视觉输入 DeepSeek 的 Anthropic 端点不支持图像

并行工具使用 DeepSeek 支持（每次调用最多 128 个），但 Claude Code 默认按顺序发送工具

MCP 服务器工具 通过兼容层不支持

Prompt 缓存节省 DeepSeek 有自己的缓存（自动），但 Anthropic 的 cache_control 被忽略

智能差异

常规任务（80% 的工作）：DeepSeek V4 Pro 与 Claude Opus 相当

复杂推理（20%）：Claude Opus 更强——使用 --backend anthropic 切换

实时切换（无需重启）

在会话中切换 Anthropic 和 DeepSeek——在 Claude Code 内部完成。无需重启，无需终端命令。只需输入斜杠命令。

在 Claude Code 终端中：

在 Claude Code VS Code 扩展中：

工作原理

代理运行在 localhost:3200 上，拦截所有 API 调用。一个控制端点（/_proxy/mode）可让你即时切换活跃后端：

Claude Code -> localhost:3200 (proxy)
|
+-- /_proxy/mode POST -> switch backend
+-- /_proxy/status GET -> current backend + uptime
+-- /_proxy/cost GET -> token usage + cost savings
|
+-- /v1/messages -> active backend (DeepSeek/OpenRouter/Anthropic)
+-- everything else -> Anthropic (passthrough)

选项 1：斜杠命令（推荐）

将这些文件添加到 ~/.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."

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."

openrouter.md：

Switch the model proxy to OpenRouter. Run this command silently and report the result:
curl -sX POST http://127.0.0.1:3200/_proxy/mode -d "backend=openrouter"
If successful, say: "Switched to OpenRouter."

然后在任意 Claude Code 会话中输入 /deepseek、/anthropic 或 /openrouter 即可即时切换。

选项 2：CLI 标志

deepclaude --switch deepseek # or: ds, or, fw, anthropic
deepclaude -s anthropic

选项 3：VS Code 键盘快捷键

添加到 .vscode/tasks.json：

{
"version": "2.0.0",
"tasks": [
{
"label": "Proxy: Switch to DeepSeek",
"type": "shell",
"command": "Invoke-RestMethod -Uri http://127.0.0.1:3200/_proxy/mode -Method Post -Body 'backend=deepseek'",
"presentation": { "reveal": "always" },
"problemMatcher": []
},
{
"label": "Proxy: Switch to Anthropic",
"type": "shell",
"command": "Invoke-RestMethod -Uri http://127.0.0.1:3200/_proxy/mode -Method Post -Body 'backend=anthropic'",
"presentation": { "reveal": "always" },
"problemMatcher": []
}
]
}

然后在 keybindings.json 中绑定：

{ "key": "ctrl+alt+d", "command": "workbench.action.tasks.runTask", "args": "Proxy: Switch to DeepSeek" },
{ "key": "ctrl+alt+a", "command": "workbench.action.tasks.runTask", "args": "Proxy: Switch to Anthropic" }

成本追踪

代理追踪 token 使用量，并计算相对于 Anthropic 定价的节省：

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
}

VS Code / Cursor 集成

添加终端配置文件，这样你就可以从 IDE 启动 deepclaude：

设置 > JSON：

{
"terminal.integrated.profiles.windows": {
"DeepSeek Agent": {
"path": "powershell.exe",
"args": ["-ExecutionPolicy", "Bypass", "-NoExit", "-File", "C:\\path\\to\\deepclaude.ps1"]
}
}
}

或者在 macOS/Linux 上：

{
"terminal.integrated.profiles.linux": {
"DeepSeek Agent": {
"path": "/usr/local/bin/deepclaude"
}
}
}

远程控制（--remote）

在任何浏览器中打开 Claude Code 会话——以 DeepSeek 作为大脑：

deepclaude --remote # Remote control + DeepSeek
deepclaude --remote -b or # Remote control + OpenRouter
deepclaude --remote -b anthropic # Remote control + Anthropic (normal)

这会打印一个 https://claude.ai/code/session_... URL，你可以在手机、平板或任何浏览器中打开。

工作原理

远程控制需要 Anthropic 的网桥来建立 WebSocket 连接，但模型调用可以走其他路径。deepclaude 启动一个本地代理来分流流量：

claude remote-control
+-- Bridge WebSocket -> wss://bridge.claudeusercontent.com (Anthropic, hardcoded)
+-- Model API calls -> http://localhost:3200 (proxy)
+-- /v1/messages -> DeepSeek ($0.87/M)
+-- everything else -> Anthropic (passthrough)

前提条件

必须登录 Claude Code：claude auth login

必须拥有 claude.ai 订阅（桥梁为 Anthropic 基础设施）

Node.js 18+（用于代理）

代理会自动启动并在会话结束时停止。技术细节请参阅 proxy/README.md。

许可证

MIT

关于

使用 Claude Code 的自主智能体循环，搭配 DeepSeek V4 Pro、OpenRouter 或任何兼容 Anthropic 的后端。相同体验，价格便宜 17 倍。

资源

Readme

许可证

MIT 许可证

活动

星标

2.1k 星标

关注者

12 人关注

复刻

138 个复刻

举报仓库

发布版本

尚无发布版本

软件包

贡献者

语言

JavaScript 50.9%

PowerShell 25.2%

Shell 23.9%
