deeptunnel
DeepSeek → Anthropic API proxy.
Run DeepSeek behind the Anthropic SDK, Claude Code, or any tool that speaks the Anthropic Messages API.
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
- Receives Anthropic-format
/v1/messagesrequests. - Translates Anthropic tool definitions → XML schema in the prompt.
- Solves DeepSeek's proof-of-work challenge (via WASM).
- Forwards the request to
chat.deepseek.com. - Parses DeepSeek's plain-text response for
<tool_use>blocks. - Re-emits proper Anthropic
tool_use/textcontent 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.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| deeptunnel-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Release files / deeptunnel-0.1.2-py3-none-any.whl
| Download URL | deeptunnel-0.1.2-py3-none-any.whl |
|---|---|
| Size | 31.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1f188cb16969adc63dfb2203e4a35752c0a99a38f258782bb196250128e8565c
|
|
BLAKE2b-256 checksum How to use checksums |
92b28471a3e8673b03665857e6c1255d1e8c89673729bf8ce58396f5d8608f69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|