npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

claude-code-deepseek-thinking-proxy

v1.0.0

Published

Local proxy that preserves DeepSeek V4 thinking blocks across model switches in Claude Code

Readme

claude-code-deepseek-thinking-proxy

npm version license node

One command to fix "content[].thinking in the thinking mode must be passed back to the API" when using DeepSeek V4 with Claude Code.

What problem does this solve?

DeepSeek V4 models (deepseek-v4-pro / deepseek-v4-flash) always run in thinking mode. When the model makes tool calls, it requires the thinking blocks from previous turns to be preserved in the conversation history. If you switch models mid-session (e.g. to Anthropic Sonnet and back), Claude Code strips these blocks. Switching back to DeepSeek then fails with a 400 error.

This proxy sits between Claude Code and DeepSeek, caching thinking blocks and re-injecting them when missing — transparent to Claude Code.

Quickstart

npm install -g claude-code-deepseek-thinking-proxy
deepseek-thinking-proxy

Then set your Claude Code base URL to point to the proxy:

{
  "env": {
    "ANTHROPIC_BASE_URL": "http://127.0.0.1:8787",
    "ANTHROPIC_AUTH_TOKEN": "<your-deepseek-api-key>"
  }
}

That's it. Switch models freely — the proxy handles the rest.

How it works

Claude Code ──→ localhost:8787 ──→ api.deepseek.com/anthropic
                   │
                   ├─ Inbound: scan assistant messages
                   │   ├─ Cache hit → re-inject real thinking blocks
                   │   └─ Cache miss → inject placeholder
                   │
                   └─ Outbound: extract thinking blocks → cache by fingerprint
  • Cache: FNV-1a hash of conversation prefix, in-memory, TTL 30 min, max 500 entries
  • Placeholder: Falls back to "(thinking omitted)" with empty signature when cache is cold. DeepSeek's Anthropic endpoint does not validate signatures.

Auto-start with launchd (macOS)

cat > ~/Library/LaunchAgents/com.deepseek-thinking-proxy.plist << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.deepseek-thinking-proxy</string>
    <key>ProgramArguments</key>
    <array>
        <string>/path/to/node</string>
        <string>/path/to/deepseek-thinking-proxy</string>
    </array>
    <key>RunAtLoad</key><true/>
    <key>KeepAlive</key><true/>
    <key>StandardOutPath</key>
    <string>/tmp/thinking-proxy.log</string>
    <key>StandardErrorPath</key>
    <string>/tmp/thinking-proxy.log</string>
</dict>
</plist>
EOF

launchctl load ~/Library/LaunchAgents/com.deepseek-thinking-proxy.plist

Configuration

All via environment variables:

| Variable | Default | Description | |----------|---------|-------------| | PROXY_PORT | 8787 | Listen port | | PROXY_UPSTREAM | https://api.deepseek.com/anthropic | Upstream DeepSeek endpoint | | PROXY_PLACEHOLDER | fallback | off / fallback / always | | PROXY_PLACEHOLDER_TEXT | (thinking omitted) | Placeholder content | | PROXY_DEBUG | 0 | Set to 1 for verbose logging |

Health check

curl http://127.0.0.1:8787/health
# {"status":"ok","cacheSize":3,"upstream":"https://api.deepseek.com/anthropic"}

Use with cc-switch

If you use cc-switch to manage providers, set your DeepSeek provider's base URL to http://127.0.0.1:8787. The proxy runs independently via launchd — cc-switch only needs to point at it.

License

MIT