Skip to main content

deeptunnel

DeepSeek → Anthropic API proxy.
Run DeepSeek behind the Anthropic SDK, Claude Code, or any tool that speaks the Anthropic Messages API.

PyPI Python


Install

pip install deeptunnel

The WASM proof-of-work solver (sha3_wasm_bg.wasm, ~26 KB) is downloaded automatically from GitHub on the first run and cached in ~/.cache/deeptunnel/. You can also place the file next to the script manually to skip the download.


Quick start

# 1. Set your DeepSeek bearer token
#    Get it: browser DevTools → Network → any DeepSeek request → Authorization header
export DEEPSEEK_TOKEN="your-token-here"

# 2. Start the proxy
deeptunnel

# 3. In another shell, point the Anthropic SDK at it
export ANTHROPIC_BASE_URL="http://localhost:8765"
export ANTHROPIC_API_KEY="local-proxy-key"
claude          # or any other Anthropic SDK client

Flags

Flag Default Description
--model fast ✓ Use the fast DeepSeek model (model_type="default")
--model expert Use the expert model (model_type=null)
--search ✓ Enable web search
--no-search Disable web search
--think Enable thinking mode
--port PORT 8765 Port to listen on
deeptunnel --model expert --no-search --think --port 9000

Environment variables

Variable Default Description
DEEPSEEK_TOKEN required Bearer token(s), comma-separated for rotation
DEEPSEEK_COOKIES Optional cookie string
PROXY_PORT 8765 Port override (CLI --port takes precedence)
PROXY_MAX_SESSIONS 64 Max cached DeepSeek sessions
PROXY_MAX_HISTORY_MESSAGES 40 Max history messages per prompt

Multiple tokens (auto-rotation)

export DEEPSEEK_TOKEN="token1,token2,token3"
deeptunnel

Tokens rotate automatically when DeepSeek returns a "server busy" / generation_timeout response.


How it works

  1. Receives Anthropic-format /v1/messages requests.
  2. Translates Anthropic tool definitions → XML schema in the prompt.
  3. Solves DeepSeek's proof-of-work challenge (via WASM).
  4. Forwards the request to chat.deepseek.com.
  5. Parses DeepSeek's plain-text response for <tool_use> blocks.
  6. Re-emits proper Anthropic tool_use / text content blocks as SSE.

Manual WASM placement

If the automatic download fails (firewall, air-gapped environment), download the file manually and place it in ~/.cache/deeptunnel/:

mkdir -p ~/.cache/deeptunnel
curl -L 'https://github.com/IMApurbo/deepseek_scrapper/blob/main/deepseek-cli/sha3_wasm_bg.wasm' \
     -o ~/.cache/deeptunnel/sha3_wasm_bg.wasm

License

MIT © IMApurbo

Metadata

Release files for deeptunnel 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for deeptunnel 0.1.1
File Interpreter ABI Platform
deeptunnel-0.1.1-py3-none-any.whl Python 3 none any Details

Release files / deeptunnel-0.1.1-py3-none-any.whl

Download URL deeptunnel-0.1.1-py3-none-any.whl
Size 33.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b8299f84abd921ae60d0c763581c35ee4a64bb266644e4ebeba03220974834e
BLAKE2b-256 checksum
How to use checksums
f405346282aa3fadd4f90148a48ba91820bbafeef998239b912765cdb5206c45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release history Release notifications | RSS feed

0.1.3

1 release file

0.1.2

1 release file

This release

0.1.1 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page