Chuyển đến nội dung
tinAI
Quay lại

DeepClaude: chạy Claude Code agent loop với DeepSeek V4 Pro, rẻ hơn 17 lần

github.com · Loại nguồn: GitHub 2026-05-04T00:15:42.955Z
Bản dịch tiếng Việt của tinAI · Từ DeepClaude — Claude Code agent loop with DeepSeek V4 Pro, 17x cheaper (github.com) · Ngày gốc: · Dịch ngày:

và giữ bối cảnh từ bản tin tinAI đã giới thiệu bài này .

Bài gốc: DeepClaude — Claude Code agent loop with DeepSeek V4 Pro, 17x cheaper (github.com)

Tác giả: aattaran

Ngày đăng: Dịch ngày:

TL;DR

Wrapper script swap base URL của Claude Code sang DeepSeek V4 Pro hoặc OpenRouter — giữ nguyên tool loop, file edit, subagent spawn, chỉ thay 'bộ não'. Cost giảm từ $200/mo Anthropic Max xuống $20-80/mo, vẫn fallback về Anthropic khi cần Opus cho task khó.

Ước tính đọc: 3 phút

Giới thiệu

Claude Code là agent coding tốt nhất hiện tại — nhưng giá $200/mo và có usage cap. DeepSeek V4 Pro đạt 96.4% trên LiveCodeBench với cost $0.87/M output tokens.

deepclaude swap bộ não nhưng giữ nguyên cơ thể:

Terminal của bạn
  └── Claude Code CLI (tool loop, file edit, bash, git — không đổi)
        └── API call → DeepSeek V4 Pro ($0.87/M) thay vì Anthropic ($15/M)

Mọi thứ vẫn chạy: file read, edit, bash, subagent spawn, autonomous multi-step coding loop. Khác biệt duy nhất là model nào đang “think”.

Cách dùng (2 phút)

1. Lấy DeepSeek API key

Đăng ký tại platform.deepseek.com, nạp $5 credit, copy API key.

2. Set env var

macOS/Linux:

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

3. Cài đặt

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

4. Chạy

deepclaude                  # Launch Claude Code với DeepSeek V4 Pro
deepclaude --status         # Show backend và key đang có
deepclaude --backend or     # Dùng OpenRouter (rẻ nhất, $0.44/M input)
deepclaude --backend fw     # Dùng Fireworks AI (nhanh nhất, server US)
deepclaude --backend anthropic  # Claude Code bình thường (khi cần Opus)
deepclaude --cost           # So pricing
deepclaude --benchmark      # Latency test các provider

Cách hoạt động

Claude Code đọc các env var sau để quyết định gửi API call đi đâu:

VariableTác dụng
ANTHROPIC_BASE_URLAPI endpoint (default: api.anthropic.com)
ANTHROPIC_AUTH_TOKENAPI key cho backend
ANTHROPIC_DEFAULT_OPUS_MODELModel name cho task tier Opus
ANTHROPIC_DEFAULT_SONNET_MODELModel name cho task tier Sonnet
ANTHROPIC_DEFAULT_HAIKU_MODELModel name cho task tier Haiku (subagent)
CLAUDE_CODE_SUBAGENT_MODELModel cho subagent spawn

deepclaude set các var này per-session (không vĩnh viễn), launch Claude Code, restore setting cũ khi exit.

Backend hỗ trợ

BackendFlagInput/MOutput/MServerNote
DeepSeek (default)--backend ds$0.44$0.87ChinaAuto context cache (rẻ hơn 120x cho turn lặp)
OpenRouter--backend or$0.44$0.87USRẻ nhất, latency thấp nhất từ US/EU
Fireworks AI--backend fw$1.74$3.48USInference nhanh nhất
Anthropic--backend anthropic$3.00$15.00USClaude Opus gốc (cho problem khó)

DeepSeek có automatic context caching — agent loop cực rẻ vì sau request đầu, system prompt và file context được cache ở $0.004/M (so $0.44/M nếu uncached).

So sánh cost

Mức dùngAnthropic Maxdeepclaude (DeepSeek)Tiết kiệm
Light (10 ngày/tháng)$200/mo (cap)~$20/mo90%
Heavy (25 ngày/tháng)$200/mo (cap)~$50/mo75%
Có auto loop$200/mo (cap)~$80/mo60%

Cái gì work, cái gì không

Work

Không work hoặc giảm chất lượng

FeatureLý do
Image/vision inputAnthropic endpoint của DeepSeek không support image
Parallel tool useDisabled — tool execute tuần tự
MCP server toolsKhông support qua compatibility layer
Prompt caching savingsDeepSeek có cache riêng (auto), nhưng cache_control của Anthropic bị ignore

Khác biệt intelligence

Tích hợp VS Code / Cursor

Thêm terminal profile vào IDE:

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

Remote control (--remote)

Mở Claude Code session trên browser bất kỳ — vẫn dùng DeepSeek làm bộ não:

deepclaude --remote                # Remote control + DeepSeek
deepclaude --remote -b or          # Remote control + OpenRouter
deepclaude --remote -b anthropic   # Remote control + Anthropic (bình thường)

Lệnh này print URL https://claude.ai/code/session_... mở được trên phone, tablet, browser bất kỳ.

Cách work

Remote control cần bridge WebSocket của Anthropic, nhưng model call đi đâu cũng được. deepclaude khởi local proxy split traffic:

claude remote-control
  ├── Bridge WebSocket → wss://bridge.claudeusercontent.com (Anthropic, hardcoded)
  └── Model API call   → http://localhost:3200 (proxy)
                            ├── /v1/messages → DeepSeek ($0.87/M)
                            └── còn lại     → Anthropic (passthrough)

Yêu cầu

Proxy auto-start khi chạy và stop khi session end.

License

MIT.


Đường dẫn nguồn

tinAI dịch bài này sang tiếng Việt từ DeepClaude — Claude Code agent loop with DeepSeek V4 Pro, 17x cheaper (github.com) · Loại nguồn: GitHub và giữ bối cảnh từ bản tin tinAI đã giới thiệu bài này .

Bản tin này có 4 bài dịch liên quan từ cùng bản tin.

Đọc tiếp từ đây

Bạn có thể quay lại bản tin nguồn hoặc mở kho bài dịch để đọc tiếp.

Các bài bên dưới cùng xuất hiện trong bản tin nguồn, nên giữ chung bối cảnh đọc với bài này.

Các bài liên quan trong cùng bản tin trải trên 2 loại nguồn (3 bài). Loại nguồn: web 2 Loại nguồn: công ty/blog 1