Skip to content

About

Use your own DeepSeek web account through OpenAI & Anthropic-compatible APIs. FastAPI reverse proxy with tool calling, vision & streaming.

Resources

Stars

3 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

183 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Important Note

I am busy with exams so new PR and Issues might be slow to resolve or merge (but i would merge them or resolve the issue as I get time in between) so expect some inconvenience.

DeeperSeeker

CI Pipeline

DeepSeek website reverse-proxy server with FastAPI, supporting OpenAI & Anthropic API standards.

If you want to use deeperseeker with claude desktop app see Claude Desktop Setup Guide

For solving deepseek pow challenge the wasm file included is from my other repo: https://github.com/AmanCode22/deepseek_pow_solver/

If you liked this repo please star it and star the solver also.

⚠️ Warning: Automated use violates DeepSeek's Terms of Use. Use a dedicated throwaway account, never your personal one. Accounts may be banned at any time. Use at your own risk.

A kind request: do not spam the server, respect DeepSeek's limits, and use it for personal purposes only.

Quickstart

Local Python[UV, Recommended]

Needs uv first

for linux/macos

curl -LsSf https://astral.sh/uv/install.sh | sh

or on windows

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Then,

uv sync
source .venv/bin/activate # or activate.fish or activate.zsh
cp .env.example .env
uv run deeperseeker

Local Python[Non UV, Not usually recommended]

python3 -m venv .venv
pip install -r requirements.txt 
cp .env.example .env 
python3 app.py

Note: Thanks to PR AmanCode22#16 by @alan7383, Playwright and Chromium are deprecated and kept as backup (DeepSeek does not enforce AWS WAF on requests using Android client headers). You no longer need to run playwright install chromium or xvfb-run unless reverting to the backup cookie mechanism. And it now saves ram also and is much stable than cookie harvesting.

Docker / Podman (Podman recommended for rootless execution)

Suggested in issue #3

cp .env.example .env

# Using Podman (Recommended - Rootless)
podman build -t deeperseeker .
podman run -d --name deeperseeker -p 4000:4000 --env-file .env deeperseeker

# Using Docker
docker build -t deeperseeker .
docker run -d --name deeperseeker -p 4000:4000 --env-file .env deeperseeker

# Or using Podman Compose / Docker Compose
podman-compose up -d
# docker compose up -d

Note: docker-compose.yml binds to 127.0.0.1:4000 only (local access) — change the ports mapping if you need to expose it.

国内网络构建

Compose 默认使用清华 Debian 主源和安全源,以及 npmmirror 的 Playwright 浏览器镜像,不配置代理。APT 索引和 DEB 使用 BuildKit 缓存;Chromium 系统依赖与浏览器分层安装,避免浏览器下载失败后重复处理系统依赖。首次构建仍需下载,后续构建请保留缓存,不要使用 --no-cache。

docker compose --progress plain build
docker compose up -d --no-build

可通过 BUILD_DEBIAN_MIRROR、BUILD_DEBIAN_SECURITY_MIRROR 和 BUILD_PLAYWRIGHT_DOWNLOAD_HOST 环境变量或 .env 覆盖镜像地址。浏览器镜像同时提供 Chromium、Headless Shell 和 FFmpeg;若需切回官方 CDN,将 BUILD_PLAYWRIGHT_DOWNLOAD_HOST 设为 https://cdn.playwright.dev。下载失败时构建报错,不会生成缺少浏览器的镜像。

Dashboard: http://localhost:4000/

Configuration (.env)

Copy .env.example to .env and edit your secret values:

cp .env.example .env
Variable Description Default
DEEPSEEKER_API_KEY Bearer API key required to access endpoints dseeker
DEEPSEEKER_ADMIN_USER Dashboard login username admin
DEEPSEEKER_ADMIN_PASSWORD Dashboard login password admin
HOST Bind address for bare-metal runs (127.0.0.1 = local only, 0.0.0.0 = expose) 127.0.0.1
PORT Server port 4000
DEEPSEEKER_MAX_HISTORY_TOKENS Token cap for injected history on first-message prompt builds 24000
DEEPSEEKER_MAX_TOOL_RESULT_TOKENS Token cap for injected tool results 12000
DEEPSEEKER_MEMORY_LIMIT_TOKENS Observed remembered-context limit that triggers rollover 393228
DEEPSEEKER_FIRST_MESSAGE_TOKENS Observed single-first-message acceptance (informational) 974848
DEEPSEEKER_MAX_OUTPUT_TOKENS Observed per-response output cap (reported by /v1/models) 8192
DEEPSEEKER_ROLLOVER_SAFETY_TOKENS Headroom reserved below the memory limit before summarizing 24000
DEEPSEEKER_MAX_SUMMARY_TOKENS Budget for the model-generated handoff summary 4096
DEEPSEEKER_FACT_MEMORY_TOKENS Budget for deterministic facts carried across repeated compactions 1800
DEEPSEEKER_PER_TOOL_RESULT_TOKENS Per-result tool-output cap (so one giant output can't eat the budget) 2000
DEEPSEEKER_PROMPT_LANGUAGE Reasoning/answer language; auto follows the latest user turn, zh-CN forces Simplified Chinese auto
DEEPSEEKER_TOKEN_CHECK_INTERVAL Token pool health-check interval in seconds 300
DEEPSEEKER_DEVICE_ID Explicit device ID for account login; skips browser harvesting unset
DEEPSEEKER_DEVICE_ID_PATH Where the harvested device ID is cached next to the database
DEEPSEEKER_DEVICE_ID_TIMEOUT Seconds to wait for the fingerprint SDK to publish a device ID 60

Auth Token Setup

  1. Open incognito window -> chat.deepseek.com -> Login
  2. Console (F12): JSON.parse(localStorage.getItem("userToken")).value
  3. Paste raw token string into Dashboard (/dashboard). Close incognito window.

The Chinese dashboard also supports adding an account directly with its DeepSeek email and password. The bridge calls /api/v0/users/login, stores only the returned bearer token, and does not persist the submitted password.

The login endpoint validates the device ID produced by the web client's fingerprint SDK, so a random value is rejected with biz_code=11 / RISK_DEVICE_DETECTED. Before the first login the bridge therefore opens the sign-in page in headless Chromium, reads the SDK's device ID, and caches it next to the database. Later logins reuse the cached ID, which keeps one stable device identity for the whole deployment. Set DEEPSEEKER_DEVICE_ID to bypass harvesting with a value you copied from a real browser session. The dashboard stays usable either way: a rejected login only reports the error, and the cached ID survives container recreation as long as the data volume is kept.

API Endpoints & Usage

  • OpenAI Base: http://localhost:4000/v1
    • POST /v1/chat/completions (streaming & non-streaming)
    • POST /v1/responses (Responses API)
    • GET /v1/models
    • POST /v1/files
    • GET /v1/files/{file_id}
    • GET /v1/files/{file_id}/content
  • Anthropic Base: http://localhost:4000
    • POST /v1/messages (also at /messages)
    • POST /v1/files/upload
  • Auth Key: Configured in .env (DEEPSEEKER_API_KEY)
  • Model: v4.1flash — the single default DeepSeek model (vision-capable: vision no longer needs a separate model tier). Every request is served by it, whatever model value the client sends (legacy aliases such as instant, expert, vision, and anthropic/claude-* are accepted and normalized to v4.1flash). Also listed as anthropic/claude-v4.1flash for Claude Desktop auto-discovery. If no model is sent, requests default to v4.1flash.

Features

  • Multi-Token Pooling: Random active token rotation.
  • Token Pool Health Checks: The dashboard is Chinese-localized and checks every token every five minutes through a lightweight authenticated challenge request. Checks can also be triggered manually per token or for the entire pool; no model prompt is sent during a health check.
  • Context-Based Session Selector: Computes a SHA-256 signature over the canonicalized message history (up to the last assistant turn), the model, and the API key scope, to match and resume existing web chat sessions. Session creation is lock-protected to avoid duplicates.
  • Summarize-and-Rollover Context Policy: When accumulated session context nears the observed remembered-context limit (~393K input tokens), the bridge asks the model for a compact, language-matched handoff summary in a scratch chat, starts a fresh web chat, and seeds it with that summary plus the newest user message. System instructions, history, tool results, and the active request are kept in separate sections; replayed history/tool output is marked as untrusted data so OpenCode's long English system prompt or tool text cannot redirect the current task. DEEPSEEKER_PROMPT_LANGUAGE=auto follows the latest user turn, while zh-CN forces Simplified Chinese for reasoning and answers. Relevant newest tool calls/results are preserved (capped by DEEPSEEKER_MAX_TOOL_RESULT_TOKENS, with a tighter per-result cap via DEEPSEEKER_PER_TOOL_RESULT_TOKENS); attachments are described in words inside the summary rather than forwarded. The first exchange — however large — is never rolled over (the first-message path accepts ~1M tokens). Declared limits in /v1/models (context_window, max_output_tokens) reflect this observed behavior, not guaranteed upstream limits.
  • Full History Injection: Inject full conversation history into new sessions when session signature is not in DB or when account fails over.
  • Automatic Rate-Limit Recovery: Auto-marks tokens RATE_LIMITED on HTTP 401/403/429, provisions a new token, transfers full context (including files), and continues seamless chat with a single retry.
  • Long-Context Resilience: Live sessions are proactively migrated before the remembered-context ceiling, using a scratch-chat handoff summary plus a deterministic fact ledger (goal, constraints, modified files, commands, errors, unfinished work, and next action). If the upstream web session fails or returns an empty response (e.g. context overflow), the broken session is discarded and the request is retried once on a fresh session with a compacted, token-capped history injection; unrecoverable upstream errors are returned as proper JSON API errors instead of raw 500s.
  • Tool Calling & Streaming: Server-sent events (SSE) streaming with think-tag reassembly across chunk boundaries (no truncation) and multi-format tool-call parsing — DSML XML, <tool_call> XML, <function_call> blocks, and JSON — into OpenAI/Anthropic tool schemas.
  • File & Vision Support: Base64/URL image extraction (with SSRF protection) and document upload streaming. Images and documents are referenced directly via ref_file_ids — the vision file-forking step (fork_file_task) was removed because v4.1flash handles vision natively.
  • Claude Desktop Compatible: Rich /v1/models capability metadata + the anthropic/claude-v4.1flash alias for automatic client discovery.
  • Hardened Dashboard: Session TTL, brute-force login lockout (5 attempts → 5 min), CSRF origin check.

Pricing (per 1M tokens, as of 2026-09-06)

Flat peak-hour rates for the single default model:

Model Tier Input Cost (Cache Miss) Output Cost
DeepSeek V4.1 Flash (v4.1flash) $0.44 $1.32

The cost reported in API responses uses these flat rates.

Star History

Star History Chart

Disclaimer

Educational purpose only. This project is not affiliated with, endorsed by, or sponsored by DeepSeek. Use responsibly and in accordance with DeepSeek's terms of service.

Contributors

Contributors

About

Use your own DeepSeek web account through OpenAI & Anthropic-compatible APIs. FastAPI reverse proxy with tool calling, vision & streaming.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages