DeepSeek Anthropic API 兼容性代理 — 让 Claude Code 在 DeepSeek V4 模型上稳定运行
Project description
ds-cc-proxy
DeepSeek Anthropic API Proxy · Make Claude Code on DeepSeek V4 stabler and cheaper
Claude Code ←→ localhost:16889 ←→ api.deepseek.com/anthropic
Quick Start · Comparison · 中文
40% cheaper sub-agents. Zero quality loss on primary sessions. Fewer failures than calling DeepSeek directly.
How? Read the
thinkingfield from Claude Code. Route sub-agents (disabled) to Flash withbudget_tokens=2048. Passthrough primary sessions (enabled/adaptive) untouched.
| Request Type | Primary Session | Sub-agent |
|---|---|---|
CC sends thinking |
enabled / adaptive |
disabled |
| CC's intent | Deep reasoning | Quick execution |
| Proxy routes to | Pro model · original budget | Flash model · budget_tokens=2048 |
| Why | Passthrough — no quality impact | DeepSeek requires enabled; minimal budget satisfies API |
Quality is not compromised — it's improved. ds-cc-proxy fixes 12 compatibility bugs in the raw DeepSeek Anthropic API: thinking mode isolation, SSE parsing edge cases, connection pool exhaustion, header leakage, crash-on-invalid-env, and more.
Quick Start
pip install ds-cc-proxy # or pipx / uv tool install
ds-cc-proxy # start
ds-cc-proxy --stop # stop
Add to ~/.claude/settings.json under env:
"ANTHROPIC_BASE_URL": "http://localhost:16889"
curl http://localhost:16889/health
# {"status":"ok","version":"0.1.22","upstream":"https://api.deepseek.com/anthropic"}
Environment Variables
| Variable | Default | Description |
|---|---|---|
PROXY_UPSTREAM |
https://api.deepseek.com/anthropic |
Primary session upstream |
PROXY_FLASH_UPSTREAM |
Same as PROXY_UPSTREAM |
Sub-agent Flash upstream (falls back to Pro) |
PROXY_FLASH_MODEL |
(empty) | Sub-agent model override, e.g. deepseek-v4-flash |
PROXY_HOST |
127.0.0.1 |
Listen address |
PROXY_PORT |
16889 |
Listen port |
PROXY_LOG_LEVEL |
warning |
debug / info / warning / error |
PROXY_POOL_MAX_CONNECTIONS |
50 |
Upstream pool max connections |
PROXY_POOL_MAX_KEEPALIVE |
20 |
Max keep-alive connections |
PROXY_POOL_TIMEOUT |
120.0 |
Pool queue timeout (seconds) |
PROXY_UPSTREAM_TIMEOUT |
600.0 |
Per-request upstream timeout (seconds) |
PROXY_CONNECT_TIMEOUT |
10.0 |
TCP connect timeout (seconds) |
PROXY_MAX_BODY_BYTES |
10485760 |
Max request body size (10MB) |
PROXY_DUMP_DIR |
(empty) | Traffic dump (contains secrets, debug only) |
Comparison
| ds-cc-proxy | LiteLLM | CCR | OpenRouter | |
|---|---|---|---|---|
| Focus | DeepSeek specialist | General gateway | Multi-provider | Hosted aggregator |
| Footprint | ~650 LOC · 3 deps | ~10K+ LOC · 50+ deps | ~5K+ LOC · 80+ deps | SaaS |
| Auditable | ✅ 10-minute read | ❌ Days | ❌ Hours | ❌ Closed source |
| Thinking adapters | ✅ Inject / strip / adaptive | ⚠️ Partial | ❌ Via plugin | ❌ |
| Sub-agent cost opt. | ✅ Flash + budget control | ❌ | ❌ | ❌ |
| SSE robustness | ✅ Multi-layer type guards | ✅ | ⚠️ Generic | ❌ |
| Security hardening | ✅ 12 fixes | ✅ Enterprise | ⚠️ Basic | N/A |
Pick ds-cc-proxy if DeepSeek is your daily driver and you want stability, cost savings, and zero config.
Pick LiteLLM / CCR / OpenRouter if you need multi-provider switching, enterprise RBAC, or don't use DeepSeek thinking modes.
Coexistence with Local Proxies
ds-cc-proxy (127.0.0.1:16889) handles only Claude Code traffic. Clash Verge, V2Ray, and other system-level proxies work at different network layers — run both simultaneously, no configuration needed.
Project Origin
Forked from HosheaLi/P14_dsv4ToCC v1.8.0. Earlier versions were released as dsv4-cc-proxy. v0.1.22 was renamed to ds-cc-proxy. Upgrading:
pip uninstall dsv4-cc-proxy && pip install ds-cc-proxy
License
MIT · snowspruce/ds-cc-proxy · 中文
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ds_cc_proxy-0.1.23.tar.gz.
File metadata
- Download URL: ds_cc_proxy-0.1.23.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d61b08f5119bcc199e10b167d02f4ed5ab31e07af320eb4efe9efb40da381ba
|
|
| MD5 |
44313abadd6ec57d420a5cafb65fbf2d
|
|
| BLAKE2b-256 |
f079d3385bfc52665c62bd222fa5e900132ebb10f3f5757270b4bfef500dec17
|
File details
Details for the file ds_cc_proxy-0.1.23-py3-none-any.whl.
File metadata
- Download URL: ds_cc_proxy-0.1.23-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96aefca6604080b17c3f0c89334c43201ebb08b9d7c94dd8ca3cb831ed038fce
|
|
| MD5 |
c339d29e18eb1314a1edcd46bbbd2089
|
|
| BLAKE2b-256 |
b96eb4e09b0048c51d9eb04f529fe60a680d52143233e378e281988ad261182e
|