Skip to content

sayanthns/deepclaude-mixed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deepclaude-mixed-setup

Route Claude Desktop (and Claude Code CLI) through DeepSeek — pay DeepSeek API rates instead of Anthropic's subscription tier.

Setup guide: docs/GUIDE.md | Team guide (Claude Code / VS Code / Cursor): docs/TEAM-GUIDE.md


Quick Start

npx deepclaude-mixed-setup

Paste your DeepSeek API key when prompted. Claude Desktop restarts with DeepSeek routing active.

Get a key: platform.deepseek.com/api_keys

Requirements: Node.js 18+, Claude Desktop installed. macOS / Windows 10+ / Linux (systemd).


Model Routing

Picker Backend Notes
Opus 4.6 DeepSeek V4 Pro Matches reasoning quality
Sonnet 4.6 DeepSeek V4 Pro Default workhorse
Haiku 4.5 DeepSeek V4 Flash Fast + cheap

Switch mid-chat via picker — no restart needed.


Switching Between DeepSeek (3p) and Anthropic (1p)

The proxy supports two modes. Switch any time, no reinstall needed.

claude-mode 3p       # route through DeepSeek (default after install)
claude-mode 1p       # use your Anthropic Pro subscription directly
claude-mode toggle   # flip current mode
claude-mode status   # show current mode

What changes:

  • 3p — Claude Desktop sends requests to your local proxy → DeepSeek API
  • 1p — Claude Desktop talks directly to Anthropic servers (your Pro plan)

Restart Claude Desktop after switching mode for it to take effect.


Upgrading

Existing installs: re-run the installer to deploy the latest proxy script.

npx deepclaude-mixed-setup@latest

Your API key is not re-asked if already set in the auto-start config.

v0.1.2 fix: Thinking blocks were incorrectly stripped on DeepSeek routes, causing 400 errors on multi-turn conversations with extended thinking enabled. Fixed — existing users must upgrade.


Commands

# Mode switching
claude-mode 3p | 1p | toggle | status

# Proxy health
curl -s http://127.0.0.1:3200/_proxy/status

# Uninstall
npx deepclaude-mixed-uninstall

How It Works

  1. Installer writes a Claude Desktop gateway profile under Claude-3p/configLibrary/
  2. Sets deploymentMode = "3p" in Claude's config — activates third-party inference
  3. Installs auto-start service (LaunchAgent / systemd / Task Scheduler) running local proxy on 127.0.0.1:3200
  4. Proxy intercepts Claude's API calls, remaps model names to DeepSeek equivalents
  5. Thinking blocks from DeepSeek are preserved and echoed back on multi-turn (required by DeepSeek API); stripped only when forwarding to Anthropic

Files

Path Purpose
~/.deepclaude-mixed/mixed-proxy.mjs Proxy script (auto-started)
Claude-3p/configLibrary/<uuid>.json Gateway profile
Claude-3p/claude_desktop_config.json deploymentMode: "3p"
macOS: ~/Library/LaunchAgents/com.deepclaude.proxy.plist Auto-start
Linux: ~/.config/systemd/user/deepclaude-proxy.service Auto-start
Windows: Task Scheduler DeepclaudeProxy Auto-start

Verify Installation

curl -s http://127.0.0.1:3200/_proxy/status

Expected:

{
  "mode": "mixed",
  "deepseekKey": "set",
  "routes": {
    "opus": "deepseek-v4-pro",
    "sonnet": "deepseek-v4-pro",
    "haiku": "deepseek-v4-flash"
  }
}

Troubleshooting

"Unable to connect to API" in Claude Desktop

Proxy not running.

macOS:

launchctl list | grep deepclaude
tail /tmp/com.deepclaude.proxy.err.log
# Restart:
launchctl unload ~/Library/LaunchAgents/com.deepclaude.proxy.plist
launchctl load  ~/Library/LaunchAgents/com.deepclaude.proxy.plist

Linux:

systemctl --user status deepclaude-proxy
journalctl --user -u deepclaude-proxy -f

Windows:

schtasks /Query /TN DeepclaudeProxy
type %TEMP%\deepclaude-proxy.err.log

Still shows Pro plan in Claude Desktop Settings

In 1p mode. Run claude-mode 3p then restart Claude Desktop.

400 error on multi-turn / extended thinking

Outdated proxy script. Run npx deepclaude-mixed-setup@latest.

Invalid model errors

Run npx deepclaude-mixed-setup@latest for latest model names.

Subagent in Cowork can't reach external hosts (ConnectionRefused, blocked-by-allowlist)

Three sandbox layers exist. v0.1.6+ writes all three. If still blocked:

  1. Verify managed-settings.json present (Cowork honors only this):

    sudo cat "/Library/Application Support/ClaudeCode/managed-settings.json"

    Must contain sandbox.network.allowedDomains with target hosts.

  2. Full quit Claude Desktop, not window close:

    pkill -9 -f "Claude.app"; pkill -9 -f "Claude Helper"; sleep 2; open /Applications/Claude.app

    Sandbox config loads at process start.

  3. Re-run installer to regenerate all three layers:

    npx deepclaude-mixed-setup@latest

    Provide sudo password when prompted.

WebFetch fails with "model doesn't exist" / deepseek-v4-flash errors

Stale ~/.zshrc exports from manual setup phase override the gateway. Check:

grep -E "ANTHROPIC_BASE_URL|ANTHROPIC_DEFAULT|CLAUDE_CODE_SUBAGENT_MODEL|ANTHROPIC_AUTH_TOKEN" ~/.zshrc

If anything matches, remove those lines. They predate the npm package and bypass the local proxy. After cleaning:

source ~/.zshrc
pkill -9 -f "Claude.app"; sleep 2; open /Applications/Claude.app

Same applies to ~/.bashrc, ~/.zprofile, /etc/launchd.conf, and launchctl getenv ANTHROPIC_BASE_URL. Clean them all.

Subagent says "AGENT_SECRET needed" or similar auth errors

Different problem. Sandbox is not blocking — the destination server requires auth. Provide the bearer token to the subagent or unblock its credential source. Not a deepclaude-mixed bug.


Optional: Real Anthropic Opus

Set ANTHROPIC_API_KEY in the auto-start config. Opus picker routes to api.anthropic.com; Sonnet and Haiku stay on DeepSeek.

  • macOS: edit ~/Library/LaunchAgents/com.deepclaude.proxy.plist → add to EnvironmentVariables
  • Linux: edit ~/.config/systemd/user/deepclaude-proxy.service → add Environment=ANTHROPIC_API_KEY=sk-ant-...
  • Windows: re-run installer with ANTHROPIC_API_KEY env var set

Restart proxy service after edit.


Uninstall

npx deepclaude-mixed-uninstall

Removes proxy script and auto-start service. Claude-3p profiles remain — delete via Claude Desktop UI if desired.


Security

  • API key stored in OS auto-start config, never in plaintext files elsewhere
  • Proxy listens on 127.0.0.1 only — no external network access
  • No telemetry, no phoning home
  • Thinking blocks from DeepSeek preserved in-flight (required by API); stripped only before forwarding to Anthropic

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors