deepclaude-proxy

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

deepclaude

deepclaude

Skill by ara.so — Daily 2026 Skills collection.
deepclaude routes Claude Code's API calls to DeepSeek V4 Pro, OpenRouter, Fireworks AI, or any Anthropic-compatible backend — keeping the full Claude Code UX (file editing, bash, subagents, git) while cutting costs by up to 17x.
ara.so提供的Skill——属于Daily 2026 Skills合集。
deepclaude可将Claude Code的API请求路由至DeepSeek V4 Pro、OpenRouter、Fireworks AI或任何Anthropic兼容后端——在保留Claude Code完整用户体验(文件编辑、bash、子Agent、git)的同时,将成本最高降低17倍。

How it works

工作原理

Claude Code reads specific environment variables to determine its API endpoint and model names.
deepclaude
sets these per-session (not permanently), launches Claude Code, then restores originals on exit.
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)
Key environment variables Claude Code uses:
VariablePurpose
ANTHROPIC_BASE_URL
API endpoint override
ANTHROPIC_AUTH_TOKEN
API key for the backend
ANTHROPIC_DEFAULT_OPUS_MODEL
Model for Opus-tier tasks
ANTHROPIC_DEFAULT_SONNET_MODEL
Model for Sonnet-tier tasks
ANTHROPIC_DEFAULT_HAIKU_MODEL
Model for Haiku-tier / subagents
CLAUDE_CODE_SUBAGENT_MODEL
Model for spawned subagents
Claude Code会读取特定的环境变量来确定其API端点和模型名称。
deepclaude
会按会话设置这些变量(非永久),启动Claude Code,然后在退出时恢复原始设置。
你的终端
  └── Claude Code CLI(工具循环、文件编辑、bash、git —— 保持不变)
        └── API请求 → 转向DeepSeek V4 Pro(每百万token0.87美元)而非Anthropic(每百万token15美元)
Claude Code使用的关键环境变量:
变量用途
ANTHROPIC_BASE_URL
API端点覆盖
ANTHROPIC_AUTH_TOKEN
后端的API密钥
ANTHROPIC_DEFAULT_OPUS_MODEL
Opus级任务使用的模型
ANTHROPIC_DEFAULT_SONNET_MODEL
Sonnet级任务使用的模型
ANTHROPIC_DEFAULT_HAIKU_MODEL
Haiku级/子Agent使用的模型
CLAUDE_CODE_SUBAGENT_MODEL
生成的子Agent使用的模型

Installation

安装

Prerequisites

前提条件

  • Claude Code CLI installed (
    npm install -g @anthropic-ai/claude-code
    )
  • Node.js 18+ (for the proxy server)
  • API key for at least one backend
  • 已安装Claude Code CLI(
    npm install -g @anthropic-ai/claude-code
  • Node.js 18+(用于代理服务器)
  • 至少一个后端的API密钥

1. Clone the repo

1. 克隆仓库

bash
git clone https://github.com/aattaran/deepclaude.git
cd deepclaude
bash
git clone https://github.com/aattaran/deepclaude.git
cd deepclaude

2. Set API keys

2. 设置API密钥

macOS/Linux:
bash
undefined
macOS/Linux:
bash
undefined

DeepSeek (default backend — get key at platform.deepseek.com)

DeepSeek(默认后端——在platform.deepseek.com获取密钥)

echo 'export DEEPSEEK_API_KEY="$DEEPSEEK_API_KEY"' >> ~/.bashrc
echo 'export DEEPSEEK_API_KEY="$DEEPSEEK_API_KEY"' >> ~/.bashrc

OpenRouter (optional — cheapest US latency)

OpenRouter(可选——美国区域延迟最低)

echo 'export OPENROUTER_API_KEY="$OPENROUTER_API_KEY"' >> ~/.bashrc
echo 'export OPENROUTER_API_KEY="$OPENROUTER_API_KEY"' >> ~/.bashrc

Fireworks AI (optional — fastest inference)

Fireworks AI(可选——推理速度最快)

echo 'export FIREWORKS_API_KEY="$FIREWORKS_API_KEY"' >> ~/.bashrc
source ~/.bashrc

**Windows (PowerShell):**
```powershell
setx DEEPSEEK_API_KEY $env:DEEPSEEK_API_KEY
setx OPENROUTER_API_KEY $env:OPENROUTER_API_KEY
setx FIREWORKS_API_KEY $env:FIREWORKS_API_KEY
echo 'export FIREWORKS_API_KEY="$FIREWORKS_API_KEY"' >> ~/.bashrc
source ~/.bashrc

**Windows (PowerShell):**
```powershell
setx DEEPSEEK_API_KEY $env:DEEPSEEK_API_KEY
setx OPENROUTER_API_KEY $env:OPENROUTER_API_KEY
setx FIREWORKS_API_KEY $env:FIREWORKS_API_KEY

3. Install the CLI

3. 安装CLI

macOS/Linux:
bash
chmod +x deepclaude.sh
sudo ln -s "$(pwd)/deepclaude.sh" /usr/local/bin/deepclaude
Windows (PowerShell):
powershell
Copy-Item deepclaude.ps1 "$env:USERPROFILE\.local\bin\deepclaude.ps1"
macOS/Linux:
bash
chmod +x deepclaude.sh
sudo ln -s "$(pwd)/deepclaude.sh" /usr/local/bin/deepclaude
Windows (PowerShell):
powershell
Copy-Item deepclaude.ps1 "$env:USERPROFILE\.local\bin\deepclaude.ps1"

Or add repo directory to PATH:

或将仓库目录添加至PATH:

setx PATH "$env:PATH;C:\path\to\deepclaude"
undefined
setx PATH "$env:PATH;C:\path\to\deepclaude"
undefined

Key CLI commands

关键CLI命令

bash
undefined
bash
undefined

Launch Claude Code with DeepSeek V4 Pro (default)

使用DeepSeek V4 Pro启动Claude Code(默认)

deepclaude
deepclaude

Show available backends and configured API keys

显示可用后端和已配置的API密钥

deepclaude --status
deepclaude --status

Select a specific backend

选择特定后端

deepclaude --backend ds # DeepSeek (default) deepclaude --backend or # OpenRouter deepclaude --backend fw # Fireworks AI deepclaude --backend anthropic # Normal Claude Opus
deepclaude --backend ds # DeepSeek(默认) deepclaude --backend or # OpenRouter deepclaude --backend fw # Fireworks AI deepclaude --backend anthropic # 原生Claude Opus

Show pricing comparison

显示价格对比

deepclaude --cost
deepclaude --cost

Latency benchmark across all configured providers

在所有已配置提供商之间进行延迟基准测试

deepclaude --benchmark
deepclaude --benchmark

Switch backend mid-session (proxy must be running)

会话中切换后端(需代理运行)

deepclaude --switch ds deepclaude --switch or deepclaude --switch anthropic
deepclaude --switch ds deepclaude --switch or deepclaude --switch anthropic

Remote control — open session in any browser

远程控制——在任意浏览器中打开会话

deepclaude --remote deepclaude --remote --backend or deepclaude --remote --backend anthropic
undefined
deepclaude --remote deepclaude --remote --backend or deepclaude --remote --backend anthropic
undefined

Supported backends

支持的后端

BackendFlagInput/MOutput/MNotes
DeepSeek
ds
$0.44$0.87Auto context caching (120x cheaper on repeat turns)
OpenRouter
or
$0.44$0.87Lowest latency from US/EU
Fireworks AI
fw
$1.74$3.48Fastest inference, US servers
Anthropic
anthropic
$3.00$15.00Original Claude Opus
后端标识输入/百万token输出/百万token说明
DeepSeek
ds
$0.44$0.87自动上下文缓存(重复轮次成本低120倍)
OpenRouter
or
$0.44$0.87美国/欧盟区域延迟最低
Fireworks AI
fw
$1.74$3.48推理速度最快,美国服务器
Anthropic
anthropic
$3.00$15.00原生Claude Opus

Live backend switching (no restart)

实时后端切换(无需重启)

A local proxy runs on
localhost:3200
and intercepts all API calls. Switch backends instantly without restarting Claude Code.
本地代理运行在
localhost:3200
,可拦截所有API请求。无需重启Claude Code即可即时切换后端。

Proxy control endpoints

代理控制端点

bash
undefined
bash
undefined

Switch backend

切换后端

curl -sX POST http://127.0.0.1:3200/_proxy/mode -d "backend=deepseek" curl -sX POST http://127.0.0.1:3200/_proxy/mode -d "backend=openrouter" curl -sX POST http://127.0.0.1:3200/_proxy/mode -d "backend=anthropic"
curl -sX POST http://127.0.0.1:3200/_proxy/mode -d "backend=deepseek" curl -sX POST http://127.0.0.1:3200/_proxy/mode -d "backend=openrouter" curl -sX POST http://127.0.0.1:3200/_proxy/mode -d "backend=anthropic"

Check current backend + uptime

查看当前后端+运行时长

Token usage and cost savings vs Anthropic

Token使用量及与Anthropic相比的成本节省


Cost endpoint response shape:
```json
{
  "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
}

成本端点响应格式:
```json
{
  "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
}

Slash commands (recommended UX)

斜杠命令(推荐体验)

Create files in
~/.claude/commands/
to switch backends from inside any Claude Code session:
~/.claude/commands/deepseek.md
:
markdown
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
:
markdown
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."
~/.claude/commands/openrouter.md
:
markdown
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."
Then type
/deepseek
,
/anthropic
, or
/openrouter
in any Claude Code session.
~/.claude/commands/
目录下创建文件,即可在任意Claude Code会话内切换后端:
~/.claude/commands/deepseek.md
:
markdown
将模型代理切换至DeepSeek。静默运行此命令并报告结果:
curl -sX POST http://127.0.0.1:3200/_proxy/mode -d "backend=deepseek"
如果成功,回复:"已切换至DeepSeek。"
~/.claude/commands/anthropic.md
:
markdown
将模型代理切换回Anthropic。静默运行此命令并报告结果:
curl -sX POST http://127.0.0.1:3200/_proxy/mode -d "backend=anthropic"
如果成功,回复:"已切换至Anthropic。"
~/.claude/commands/openrouter.md
:
markdown
将模型代理切换至OpenRouter。静默运行此命令并报告结果:
curl -sX POST http://127.0.0.1:3200/_proxy/mode -d "backend=openrouter"
如果成功,回复:"已切换至OpenRouter。"
之后在任意Claude Code会话中输入
/deepseek
/anthropic
/openrouter
即可执行切换。

VS Code keyboard shortcuts

VS Code键盘快捷键

.vscode/tasks.json
:
json
{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Proxy: Switch to DeepSeek",
      "type": "shell",
      "command": "curl -sX POST http://127.0.0.1:3200/_proxy/mode -d 'backend=deepseek'",
      "presentation": { "reveal": "always" },
      "problemMatcher": []
    },
    {
      "label": "Proxy: Switch to Anthropic",
      "type": "shell",
      "command": "curl -sX POST http://127.0.0.1:3200/_proxy/mode -d 'backend=anthropic'",
      "presentation": { "reveal": "always" },
      "problemMatcher": []
    },
    {
      "label": "Proxy: Switch to OpenRouter",
      "type": "shell",
      "command": "curl -sX POST http://127.0.0.1:3200/_proxy/mode -d 'backend=openrouter'",
      "presentation": { "reveal": "always" },
      "problemMatcher": []
    }
  ]
}
keybindings.json
:
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" },
  { "key": "ctrl+alt+o", "command": "workbench.action.tasks.runTask", "args": "Proxy: Switch to OpenRouter" }
]
.vscode/tasks.json
:
json
{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Proxy: Switch to DeepSeek",
      "type": "shell",
      "command": "curl -sX POST http://127.0.0.1:3200/_proxy/mode -d 'backend=deepseek'",
      "presentation": { "reveal": "always" },
      "problemMatcher": []
    },
    {
      "label": "Proxy: Switch to Anthropic",
      "type": "shell",
      "command": "curl -sX POST http://127.0.0.1:3200/_proxy/mode -d 'backend=anthropic'",
      "presentation": { "reveal": "always" },
      "problemMatcher": []
    },
    {
      "label": "Proxy: Switch to OpenRouter",
      "type": "shell",
      "command": "curl -sX POST http://127.0.0.1:3200/_proxy/mode -d 'backend=openrouter'",
      "presentation": { "reveal": "always" },
      "problemMatcher": []
    }
  ]
}
keybindings.json
:
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" },
  { "key": "ctrl+alt+o", "command": "workbench.action.tasks.runTask", "args": "Proxy: Switch to OpenRouter" }
]

VS Code / Cursor terminal profiles

VS Code / Cursor终端配置文件

settings.json
on macOS/Linux:
json
{
  "terminal.integrated.profiles.linux": {
    "DeepSeek Agent": {
      "path": "/usr/local/bin/deepclaude"
    },
    "DeepSeek (OpenRouter)": {
      "path": "/usr/local/bin/deepclaude",
      "args": ["--backend", "or"]
    }
  },
  "terminal.integrated.defaultProfile.linux": "DeepSeek Agent"
}
settings.json
on Windows:
json
{
  "terminal.integrated.profiles.windows": {
    "DeepSeek Agent": {
      "path": "powershell.exe",
      "args": ["-ExecutionPolicy", "Bypass", "-NoExit", "-File", "C:\\path\\to\\deepclaude.ps1"]
    }
  }
}
macOS/Linux下的
settings.json
:
json
{
  "terminal.integrated.profiles.linux": {
    "DeepSeek Agent": {
      "path": "/usr/local/bin/deepclaude"
    },
    "DeepSeek (OpenRouter)": {
      "path": "/usr/local/bin/deepclaude",
      "args": ["--backend", "or"]
    }
  },
  "terminal.integrated.defaultProfile.linux": "DeepSeek Agent"
}
Windows下的
settings.json
:
json
{
  "terminal.integrated.profiles.windows": {
    "DeepSeek Agent": {
      "path": "powershell.exe",
      "args": ["-ExecutionPolicy", "Bypass", "-NoExit", "-File", "C:\\path\\to\\deepclaude.ps1"]
    }
  }
}

Remote control (browser UI)

远程控制(浏览器UI)

Open a Claude Code session in any browser with DeepSeek as the backend:
bash
deepclaude --remote                  # DeepSeek backend
deepclaude --remote --backend or     # OpenRouter backend
deepclaude --remote --backend anthropic  # Normal Anthropic
Traffic split:
claude remote-control
  ├── Bridge WebSocket → wss://bridge.claudeusercontent.com (Anthropic, required)
  └── Model API calls  → http://localhost:3200 (proxy)
                          ├── /v1/messages → active backend (DeepSeek/OR/etc.)
                          └── everything else → Anthropic (passthrough)
Requirements for remote control:
  • Must be logged in:
    claude auth login
  • Must have a claude.ai subscription (bridge is Anthropic infrastructure)
在任意浏览器中打开以DeepSeek为后端的Claude Code会话:
bash
deepclaude --remote                  # DeepSeek后端
deepclaude --remote --backend or     # OpenRouter后端
deepclaude --remote --backend anthropic  # 原生Anthropic后端
流量分配:
claude远程控制
  ├── 桥接WebSocket → wss://bridge.claudeusercontent.com(Anthropic,必需)
  └── 模型API请求  → http://localhost:3200(代理)
                          ├── /v1/messages → 当前激活后端(DeepSeek/OR等)
                          └── 其他请求 → 转发至Anthropic
远程控制要求:
  • 已登录:
    claude auth login
  • 拥有claude.ai订阅(桥接服务依赖Anthropic基础设施)

Manually setting environment variables (without the CLI wrapper)

手动设置环境变量(不使用CLI包装器)

If you want to wire up the backend yourself without using the
deepclaude
wrapper script:
bash
undefined
如果不想使用
deepclaude
包装脚本,可自行配置后端:
bash
undefined

DeepSeek

DeepSeek

export ANTHROPIC_BASE_URL="https://api.deepseek.com/v1" export ANTHROPIC_AUTH_TOKEN="$DEEPSEEK_API_KEY" export ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek-chat" export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-chat" export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-chat" export CLAUDE_CODE_SUBAGENT_MODEL="deepseek-chat" claude # launch normally
export ANTHROPIC_BASE_URL="https://api.deepseek.com/v1" export ANTHROPIC_AUTH_TOKEN="$DEEPSEEK_API_KEY" export ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek-chat" export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-chat" export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-chat" export CLAUDE_CODE_SUBAGENT_MODEL="deepseek-chat" claude # 正常启动

OpenRouter

OpenRouter

export ANTHROPIC_BASE_URL="https://openrouter.ai/api/v1" export ANTHROPIC_AUTH_TOKEN="$OPENROUTER_API_KEY" export ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek/deepseek-chat-v3-0324" export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek/deepseek-chat-v3-0324" export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek/deepseek-chat-v3-0324" export CLAUDE_CODE_SUBAGENT_MODEL="deepseek/deepseek-chat-v3-0324" claude
undefined
export ANTHROPIC_BASE_URL="https://openrouter.ai/api/v1" export ANTHROPIC_AUTH_TOKEN="$OPENROUTER_API_KEY" export ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek/deepseek-chat-v3-0324" export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek/deepseek-chat-v3-0324" export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek/deepseek-chat-v3-0324" export CLAUDE_CODE_SUBAGENT_MODEL="deepseek/deepseek-chat-v3-0324" claude
undefined

What works and what doesn't

支持与不支持的功能

✅ Fully supported

✅ 完全支持

  • File reading, writing, editing (
    Read
    /
    Write
    /
    Edit
    tools)
  • Bash / PowerShell execution
  • Glob and Grep search
  • Multi-step autonomous tool loops
  • Subagent spawning
  • Git operations
  • Project initialization (
    /init
    )
  • Thinking mode (enabled by default)
  • 文件读取、写入、编辑(
    Read
    /
    Write
    /
    Edit
    工具)
  • Bash / PowerShell执行
  • Glob和Grep搜索
  • 多步骤自主工具循环
  • 子Agent生成
  • Git操作
  • 项目初始化(
    /init
  • 思考模式(默认启用)

⚠️ Not supported or degraded

⚠️ 不支持或功能受限

FeatureReason
Image / vision inputDeepSeek's Anthropic-compat endpoint doesn't support images
MCP server toolsNot supported through compatibility layer
Anthropic prompt caching (
cache_control
)
Ignored; DeepSeek uses its own automatic caching
Parallel tool useDeepSeek supports up to 128/call but Claude Code sends sequentially
功能原因
图片/视觉输入DeepSeek的Anthropic兼容端点不支持图片
MCP服务器工具兼容层不支持该功能
Anthropic提示缓存(
cache_control
被忽略;DeepSeek使用自身自动缓存机制
并行工具调用DeepSeek支持单次调用最多128个工具,但Claude Code会按顺序发送请求

Choosing the right backend

选择合适的后端

Task typeRecommendation
Routine coding, refactoring, CRUDDeepSeek (default) — 90% cost savings
US/EU latency sensitiveOpenRouter
Highest throughput / speedFireworks AI
Complex multi-step reasoning, architectureSwitch to
--backend anthropic
Use
/deepseek
for most work,
/anthropic
for the hard 20% — then switch back.
任务类型推荐方案
常规编码、重构、CRUDDeepSeek(默认)——节省90%成本
对美国/欧盟区域延迟敏感OpenRouter
最高吞吐量/速度需求Fireworks AI
复杂多步骤推理、架构设计切换至
--backend anthropic
大部分工作使用
/deepseek
,遇到20%的复杂任务时切换至
/anthropic
,完成后再切回。

Troubleshooting

故障排查

DEEPSEEK_API_KEY
not found:
bash
undefined
未找到
DEEPSEEK_API_KEY
:
bash
undefined

Verify the var is set in current shell

验证当前shell中变量是否已设置

echo $DEEPSEEK_API_KEY
echo $DEEPSEEK_API_KEY

If blank, re-source your profile

如果为空,重新加载配置文件

source ~/.bashrc # or ~/.zshrc

**`deepclaude: command not found`:**
```bash
source /.bashrc # 或/.zshrc

**`deepclaude: command not found`:**
```bash

Check symlink

检查符号链接

ls -la /usr/local/bin/deepclaude
ls -la /usr/local/bin/deepclaude

Re-create if missing

若缺失则重新创建

sudo ln -sf "$(pwd)/deepclaude.sh" /usr/local/bin/deepclaude

**Proxy not responding on port 3200:**
```bash
sudo ln -sf "$(pwd)/deepclaude.sh" /usr/local/bin/deepclaude

**代理在3200端口无响应:**
```bash

Check if proxy process is running

检查代理进程是否运行

lsof -i :3200
lsof -i :3200

Restart deepclaude — proxy starts automatically

重启deepclaude——代理会自动启动

deepclaude

**`curl` not available on Windows for slash commands:**
```powershell
deepclaude

**Windows下斜杠命令缺少`curl`:**
```powershell

Use PowerShell equivalent in the .md command files:

在.md命令文件中使用PowerShell等效命令:

Invoke-RestMethod -Uri http://127.0.0.1:3200/_proxy/mode -Method Post -Body 'backend=deepseek'

**Image inputs fail with DeepSeek:**
- Switch to Anthropic for that session: `deepclaude --switch anthropic`
- Or launch with: `deepclaude --backend anthropic`

**Remote control fails:**
```bash
Invoke-RestMethod -Uri http://127.0.0.1:3200/_proxy/mode -Method Post -Body 'backend=deepseek'

**使用DeepSeek时图片输入失败:**
- 切换至Anthropic会话:`deepclaude --switch anthropic`
- 或启动时指定:`deepclaude --backend anthropic`

**远程控制失败:**
```bash

Ensure you're authenticated

确保已完成认证

claude auth login
claude auth login

Verify subscription at claude.ai — bridge requires it

验证claude.ai订阅状态——桥接服务需要订阅权限

undefined
undefined