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 · 中文
Metadata
Release files for ds-cc-proxy 0.1.23
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ds_cc_proxy-0.1.23.tar.gz | 17.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ds_cc_proxy-0.1.23-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.9 kB
Release files / ds_cc_proxy-0.1.23.tar.gz
| Download URL | ds_cc_proxy-0.1.23.tar.gz |
|---|---|
| Size | 17.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d61b08f5119bcc199e10b167d02f4ed5ab31e07af320eb4efe9efb40da381ba
|
|
BLAKE2b-256 checksum How to use checksums |
f079d3385bfc52665c62bd222fa5e900132ebb10f3f5757270b4bfef500dec17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Release files / ds_cc_proxy-0.1.23-py3-none-any.whl
| Download URL | ds_cc_proxy-0.1.23-py3-none-any.whl |
|---|---|
| Size | 16.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96aefca6604080b17c3f0c89334c43201ebb08b9d7c94dd8ca3cb831ed038fce
|
|
BLAKE2b-256 checksum How to use checksums |
b96eb4e09b0048c51d9eb04f529fe60a680d52143233e378e281988ad261182e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|