deepseek-webgui
/deepseek-webgui
DeepSeek client via the private chat.deepseek.com API (browser-exported userToken), not the official platform.deepseek.com API. Use for personal webgui automation, `x-ds-pow-response` / DeepSeekHashV1 POW solving, or SSE THINK/TOOL_SEARCH stream parsing.
- Author
- htlin222 ↗
- Repository
- dotfiles ↗
- Licence
- MIT
- Last repository change
- 10.10.2026
Assessment and security
- Files in this package
- 5
- Scripts
- 3
- HTML comments
- 0
- URLs in SKILL.md
- 2
No signals detected. Repository changed on 10.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
- 3 scripts in this package. Review them before installing, as Claude may execute them.
- Paczka skrócona: część plików jest zbyt duża or wykonywalna. Pełny folder jest w repozytorium.
Scripts: scripts/client.py, scripts/pow.py, scripts/run.sh
What it does and when to use it
DeepSeek client via the private chat.deepseek.com API (browser-exported userToken), not the official platform.deepseek.com API. Use for personal webgui automation, `x-ds-pow-response` / DeepSeekHashV1 POW solving, or SSE THINK/TOOL_SEARCH stream parsing.
Original author description
DeepSeek client via the private chat.deepseek.com API (browser-exported userToken), not the official platform.deepseek.com API. Use for personal webgui automation, `x-ds-pow-response` / DeepSeekHashV1 POW solving, or SSE THINK/TOOL_SEARCH stream parsing.
How it works
- Overview
- When to use this skill
- Quick start
- Architecture
- Files
- Embedding the client into another tool
- Known caveats
- Verification
SKILL.md preview
---
name: deepseek-webgui
description: DeepSeek client via the private chat.deepseek.com API (browser-exported userToken), not the official platform.deepseek.com API. Use for personal webgui automation, `x-ds-pow-response` / DeepSeekHashV1 POW solving, or SSE THINK/TOOL_SEARCH stream parsing.
---
# deepseek-webgui
## Overview
Drives the **private** API behind `chat.deepseek.com` — the same one the React frontend calls. Useful when the user wants to use their existing webgui account (free quotas, browser-based reasoning + search) from a script, TUI, or another tool, and does not want to (or cannot) move to the paid OpenAI-compatible API at `platform.deepseek.com`.
The hard part is the proof-of-work: every `/api/v0/chat/completion` call requires an `x-ds-pow-response` header containing a base64-encoded answer to a server-issued `DeepSeekHashV1` challenge. The algorithm is implemented as an SHA3-based WASM solver inside the frontend bundle. This skill ships that WASM and drives it from Python via `wasmtime` so no Node.js is required at runtime.
## When to use this skill
Reach for it when any of the following appears:
- "use my deepseek web account / cookies / session", "free deepseek", "no API key"
- "deepseek-tui", "deepseek4free", "wrap chat.deepseek.com"
- "x-ds-pow-response", "DeepSeekHashV1", "POW challenge", "create_pow_challenge"
- "parse deepseek SSE", "THINK fragment", "TOOL_SEARCH", "JSON-Patch deepseek"
Prefer the **official** OpenAI-compatible API at `https://api.deepseek.com` whenever the user has (or can get) a paid API key. It is faster, supported, and has no anti-bot. This skill exists for the case where that is not an option.
## Quick start
```bash
# 1) Capture credentials from the browser (one-time)
# a. Log into https://chat.deepseek.com in any browser.
# b. DevTools console: copy(localStorage.userToken) # paste into auth.json
# c. Cookie-Editor / EditThisCookie: export *.deepseek.com # save as cookies.json
# 2) Place credentials next to the prompt or anywhere convenient:
echo '{"token": "<paste userToken here>"}' > auth.json
# 3) Send a prompt.
scripts/run.sh "Summarise the difference between TLS 1.2 and 1.3 in 3 bullets."
# Flags:
# --thinking enable reasoning trace (THINK fragments → think_delta events)
# --search enable web search (TOOL_SEARCH fragment → tool_search events)
# --model expert use the reasoning model (default: "default" = DeepSeek-V3)
# --raw emit every parsed StreamEvent as JSON (machine-readable mode)
# --cookies/--auth override file paths
```
`run.sh` is a thin `uv run --with wasmtime --with httpx` wrapper. If `uv` is unavailable, `pip install httpx wasmtime` and run `python3 scripts/client.py` directly.
## Architecture
```
prompt
│
▼
DeepSeekClient.completion()
│
├─ 1. POST /api/v0/chat_session/create → chat_session.id
├─ 2. POST /api/v0/chat/create_pow_challenge → challenge {algorithm, challenge, salt, expire_at, difficulty, signature}
├─ 3. solve_pow_challenge(...) → answer (int) (scripts/pow.py + sha3.wasm)
│ base64(JSON(answer + challenge + ...))→ x-ds-pow-response
│
└─ 4. POST /api/v0/chat/completion (streaming SSE)
│
└─ _parse_sse(...) → StreamEvent("delta"|"think_delta"|"tool_search"|"search_results"|"title"|"close"|"raw"|"ready")
```
Three layers of credentials are required and the API will reject calls missing any one of them:
- `Authorization: Bearer <userToken>` from `localStorage.userToken`.
- Cookies on `*.deepseek.com` (`aws-waf-token` for WAF + `ds_session_id` for session).
- A handful of frontend identity headers (`x-app-version`, `x-client-platform`, etc.) — the client sets them automatically.
If a request returns `{"code":40002,"msg":"Missing Token"}` the userToken is missing or expired. If the response is a 202 with `x-amzn-waf-action: challenge`, the `aws-waf-token` cookie has expired — the user needs to refresh `chat.deepseek.com` in the browser and re-export cookies.
## Files
- `scripts/client.py` — `DeepSeekClient`, SSE parser, CLI. Public surface:
- `load_cookies(path) -> dict[str,str]` — parses Cookie-Editor / EditThisCookie JSON.
- `load_auth_token(path) -> str | None` — reads `DEEPSEEK_TOKEN` env var or `{"token": "..."}` file.
- `DeepSeekClient(cookies, token=...).completion(prompt, *, thinking, search, model_type, chat_session_id, parent_message_id) -> Iterator[StreamEvent]`.
- `StreamEvent.kind`: `"ready" | "delta" | "think_delta" | "tool_search" | "search_results" | "title" | "close" | "raw"`. The `text` field on `delta` / `think_delta` / `title` is the human-visible string to print or accumulate.
- `scripts/pow.py` — `solve_pow_challenge(...)`. Pure-Python wrapper around the bundled WASM via `wasmtime`. Includes a self-test against the captured HAR challenge that asserts answer == 49586.
- `scripts/sha3.wasm` — the unmodified `sha3_wasm_bg.wasm` from `fe-static.deepseek.com/chat/static/`. ~26 KB. Contains `wasm_solve` which is the iteration kernel.
- `scripts/run.sh` — `uv`-driven launcher.
- `references/api_reference.md` — full reverse-engineered API surface: endpoints, error codes, POW field semantics, SSE patch dialect with examples. Read this when extending the client (file uploads, history listing, session deletion).
## Embedding the client into another tool
To wire this into a TUI or another agent:
```python
from scripts.client import DeepSeekClient, load_cookies, load_auth_token, StreamEvent
cookies = load_cookies("cookies.json")
token = load_auth_token("auth.json")
with DeepSeekClient(cookies, token=token) as ds:
sid = ds.create_session()
full = []
for ev in ds.completion("Hello", chat_session_id=sid, thinking=True):
if ev.kind == "delta":
print(ev.text, end="", flush=True)
full.append(ev.text)
elif ev.kind == "think_delta":
... # render in a side panel
elif ev.kind == "close":
break
print("".join(full))
```
`completion()` is a generator — it yields events as bytes arrive over the SSE stream. The first call after `create_session()` is the slowest because it triggers a fresh POW challenge (~tens of milliseconds in the WASM solver, plus one extra round-trip).
## Known caveats
- **Token mortality**: the `userToken` is long-lived but not eternal. When DeepSeek invalidates it (logout, password change, server-side revoke) the user has to re-export it.
- **POW expiry**: each challenge is valid for `expire_after` ms (5 minutes in the captures). The client always solves a fresh one per `completion()` call, so this only matters if you cache challenges yourself.
- **Rate limits / banning**: this is a personal account talking to a private API. Hammering it will get the account flagged. Don't.
- **Schema drift**: the SSE patch dialect is internal and may change between commits of the chat frontend. The parser falls through to `raw` events for anything it doesn't recognise — log those if a previously-working stream starts producing unexpected output.
## Verification
The skill was built against a HAR capture of two real `chat/completion` round-trips. Verified:
- `solve_pow_challenge(...)` reproduces the captured `answer = 49586` from `(challenge, salt, expire_at, difficulty)`.
- `_parse_sse(...)` consumes the captured 123 KB SSE stream and yields the expected fragment partitioning (162 chars of THINK reasoning + 3569 chars of visible response + the `云南最好玩推荐` title).
End-to-end live verification requires the user's `userToken`. Without it the API responds `{"code":40002,"msg":"Missing Token"}` immediately — there is no anonymous mode or cookie-only fallback (verified directly).
Files in this package (5)
- SKILL.md 8 KB
- references/api_reference.md 8 KB
- scripts/client.py 13 KB
- scripts/pow.py 2 KB
- scripts/run.sh 1 KB
Omitted from the package: 1 (too large or executable); available in the repository.
Versions
The database has no other skills named deepseek-webgui.
Database snapshot: 13.11.2026 · package version e65841cf9ee4 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 2 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 95deepseek-search
使用 DeepSeek 官方 Search/Fetch API 进行联网搜索,获取实时网页结果或抓取网页 Markdown 正文。当用户要求搜索/搜一下/查最新消息、获取训练数据之外的近期信息、按站点/语言/时间范围检索、核实事实,或读取某个网页的具体内容时使用;不用于本地文件或代码库检索。 - 90deepseek-helper
为当前 Claude 会话建立、查看、修改或撤销专属的 DeepSeek 副手(副会话)。当用户显式调用 /deepseek-helper,或说"建立/创建/开 DeepSeek 副手/帮手/下属/协作会话"、"修改/撤销/关闭 DeepSeek 副手"时使用。建立后协作方式写入工作目录的 AGENTS.md(并由 CLAUDE.md 引用),之后无需再调用。没有触发过本 skill 的会话视为独自完成全部工作,不要主动委派、不要主动创建副手。 - 100sap-webgui-recording
Guides an agent in deciding when SAP WebGUI exploration needs a focused user recording, coaching the user through Playwright recording in Edge, and consuming the resulting reference file safely. Use when autonomous browser exploration cannot inspect a complex SAP control or when… - 100deepseek-provider-contract
Validate a proposed DeepSeek API integration before any key or project context is sent: check thinking-mode tool-call history, strict-schema assumptions, bounded output, and provider data boundaries. Use when integrating DeepSeek, adding DeepSeek tool calls or streaming,… - 100codex-deepseek-subagent
配置和维护 Codex 桌面应用中的 DeepSeek 原生子 Agent,支持模型选择、路由验证、修复、停用和卸载。仅在用户要求配置或管理该集成时使用;普通 API 问题与配置后的日常编码任务不触发。 - 90deepseek-search
Web search and page fetch through the DeepSeek Search/Fetch API. Use this as a reliable fallback whenever the native Codex web search is unavailable, blocked, rate-limited, or returning poor or stale results, and whenever the user explicitly asks to search with DeepSeek, use the…