# DeepSeek API Tools - System Prompt & Documentation # BY 3MH TECHNOLOGIES | https://3mh.pages.dev # Contact: https://t.me/j49_c ================================================================ SYSTEM PROMPT ================================================================ You are a DeepSeek AI assistant connected through the 3MH Technologies DeepSeek API Tools proxy. You have access to DeepSeek's full capabilities including: - Advanced reasoning and analysis - Code generation and debugging - Mathematical problem solving - Creative writing - Multi-language support - Document analysis When responding: - Be helpful, accurate, and concise - Use markdown formatting when appropriate - If asked about your identity, mention you are powered by DeepSeek through the 3MH Technologies API proxy - For technical questions, provide code examples when relevant ================================================================ API DOCUMENTATION ================================================================ Base URL: https://deepseek-pow.contact-3mh.workers.dev All endpoints accept POST with Content-Type: application/json Rate limit: 60 requests/min per IP (600/min for /api/pow* and /get_pow) Tune with worker vars: RATE_LIMIT_RPM (default 60), POW_RPM (default 600). ---------------------------------------------------------------- 1. CHAT (Full Proxy) ---------------------------------------------------------------- POST /api/chat Solves PoW automatically and sends your message to DeepSeek. Returns thinking process + response. NOTE: PoW is solved on the server with DeepSeek's own official WASM (wasm_solve, ~50ms at difficulty 144000). No client-side solving is ever required; pow_response is accepted only as an optional override. Request: { "prompt": "Your message here", "token": "YOUR_DEEPSEEK_TOKEN", "session_id": "optional-session-id", "parent_message_id": "optional-parent-message-id", "thinking_enabled": true, "search_enabled": false, "system_prompt": "optional-custom-system-instructions", "model": "optional-model", "temperature": 1.0, "max_tokens": 8192, "presence_penalty": 0.0, "frequency_penalty": 0.0, "pow_response": "optional-pre-solved-pow" } Response: { "session_id": "uuid", "parent_message_id": "uuid", "thinking": "AI thinking process...", "response": "AI response text", "usage": { "prompt_tokens": 12, "completion_tokens": 34, "total_tokens": 46 }, "pow_time": "0.6s", "pow_difficulty": 144000, "method": "worker" } Parameters: prompt (required) - Your message to the AI token (required) - Your DeepSeek token (POST /api/login returns one). The worker keeps no account: every request carries the caller's own token. session_id (optional) - Reuse an existing chat session parent_message_id (opt)- Continue from a specific message (multi-turn) thinking_enabled - Enable DeepSeek thinking mode (default: true) search_enabled - Enable web search (default: false) system_prompt (optional)- Override the system instructions model (optional) - Model name if supported by the client model_type (optional) - Native DeepSeek model_type (forwarded as-is) temperature (optional) - Sampling temperature 0.0 - 2.0 (default: 1.0) max_tokens (optional) - Max tokens to generate (default: 8192) top_p (optional) - Nucleus sampling 0.0 - 1.0 presence_penalty (opt) - Penalize new topics, range -2.0 to 2.0 frequency_penalty (opt)- Penalize repetition, range -2.0 to 2.0 response_style (opt) - balanced | concise | detailed | creative (folded into system instructions) pow_response (optional)- Pre-solved PoW as base64 JSON (solve via POST /api/pow, then btoa the JSON answer) Rare fallback (only if ALL server-side solves fail): { "error": "PoW could not be solved server-side. ...", "session_id": "uuid", "pow_challenge": { "algorithm": "DeepSeekHashV1", "challenge": "64-char-hex", "salt": "...", "difficulty": 144000, "expire_at": 1787692750574, "signature": "...", "target_path": "/api/v0/chat/completion" } } Multi-turn: keep the same session_id and pass the parent_message_id from the previous response to continue the conversation thread. Human-like pacing (anti-mute): Upstream DeepSeek requests are humanized per token, so aggressive bots don't get the account temporarily muted: a stable device fingerprint (x-rangers-id) is derived from each token, completions and uploads for the same token are serialized and spaced >= 1.2s apart with random jitter, and retries/polls use jittered sleeps. Tune via worker vars: DS_HUMAN_ENABLED=0 (disable pacing), DS_HUMAN_GAP_MS (default 1200), DS_HUMAN_JITTER_MS (default 500). AUTH: the worker holds no credential of its own — there is no default account and no account pool. Every request must carry a token via one of: - "token": "DEEPSEEK_TOKEN" in the body, or - Authorization: Bearer , or - x-deepseek-token: Get a token: POST /api/login {email, password}. ---------------------------------------------------------------- 1c. UPSTREAM & HEALTH ---------------------------------------------------------------- Every upstream DeepSeek call leaves directly from Cloudflare's own egress: there is no outbound proxy layer, no relay hops and no worker-side account pool — the caller always supplies the token. GET /health {"status":"ok","service":"deepseek-pow","time":"..."} A plain liveness probe; the worker stores no credentials. ---------------------------------------------------------------- 1d. WORKER API KEY ---------------------------------------------------------------- Set WORKER_API_KEY and every route except /health requires it: Authorization: Bearer (or x-api-key: ) Useful when the worker is used as a shared gateway. ---------------------------------------------------------------- 1b. OPENAI-COMPATIBLE ENDPOINTS ---------------------------------------------------------------- POST /v1/chat/completions OpenAI chat format. Supports tools (function calling), reasoning_effort, web_search_options, inline file parts and an optional system message. Needs your own DeepSeek token — the worker keeps no account of its own. Response includes usage + tool_calls when the model calls tools. POST /v1/messages Anthropic Messages format. Supports system, tools, file blocks. Response is Claude-shaped (content[], stop_reason, usage). /anthropic/v1/messages is an alias of the same handler. POST /v1/messages/count_tokens Estimates tokens for {model, messages} (~4 chars/token). Returns {"input_tokens": N}. POST /v1/responses OpenAI Responses API format. Supports instruction, input, tools, stream. GET /v1/models Lists available models (static fallback list). GET /v1/models/refresh Drops the cached upstream list and returns a fresh one. Inline file parts (OpenAI / Anthropic): {type:"file", file:{file_data:"data:text/plain;base64,..."}} and image_url data:/http: parts are auto-uploaded, forked to vision when needed, and attached as ref_file_ids. ---------------------------------------------------------------- 2. CHAT STREAM (SSE) ---------------------------------------------------------------- POST /api/chat/stream Same as /api/chat but returns Server-Sent Events for real-time streaming responses. Request body: Same as /api/chat (prompt, token, session_id, parent_message_id, thinking_enabled, search_enabled, system_prompt, model, model_type, temperature, max_tokens, top_p, presence_penalty, frequency_penalty, response_style, pow_response) -------------------------------------------------------------- 3. CHAT SESSION (Create / List / Delete) -------------------------------------------------------------- POST /api/chat/session Create a new DeepSeek chat session and get its id. Request: { "token": "YOUR_DEEPSEEK_TOKEN" } Response: { "success": true, "session_id": "uuid", "title": "optional-title" } Use the returned session_id in subsequent /api/chat calls to keep a conversation history. POST /api/chat/sessions/list (alias: /api/chat/sessions, GET also works with ?token= or Authorization header) List existing DeepSeek chat sessions. Request: { "token": "YOUR_DEEPSEEK_TOKEN" } Response: { "success": true, "sessions": [ { "id": "uuid", "title": "...", ... } ] } POST /api/chat/sessions/delete Delete a DeepSeek chat session. Request: { "token": "YOUR_DEEPSEEK_TOKEN", "chat_session_id": "uuid" } Response: { "success": true, "session_id": "uuid" } -------------------------------------------------------------- 3b. Telegram-bot PoW (legacy /get_pow compat) -------------------------------------------------------------- GET /get_pow?authorization= Solves a PoW challenge for /api/v0/chat/completion server-side and returns it in the legacy Python-proxy shape, so the Telegram bot can use this worker as its POW_PROXY: POW_PROXY = "https://" POW_URL = POW_PROXY + "/get_pow?authorization=" Response: { "x_ds_pow_response": "" } Also accepts the token via Authorization: Bearer , ?token=, or POST {"token": "..."}. -------------------------------------------------------------- 4. PoW SOLVE -------------------------------------------------------------- POST /api/pow Solves a DeepSeek Proof of Work challenge. Two modes: A) SINGLE-SHOT (any difficulty — native WASM solve, typically ~50ms) Request: { "challenge": "64-char-hex-hash", "salt": "random-salt", "difficulty": 144000, "expire_at": 1787692750574, "signature": "optional" } Response: { "algorithm": "DeepSeekHashV1", "challenge": "...", "salt": "...", "answer": 53021, "signature": "", "time": "0.60s" } If no solution exists the endpoint returns 404 (never a blind 503). B) CHUNKED RANGE (any difficulty, CPU-safe, never 503) Add "start" and "count" (count <= 1200). Searches nonces [start, start+count) only. Send many requests in parallel (up to 600/min for /api/pow endpoints) until one returns found:true. Request: { "challenge": "...", "salt": "...", "difficulty": 144000, "expire_at": 1787692750574, "start": 52800, "count": 1200 } Response (not found in range): { "challenge": "...", "found": false, "searched": 1200, "next_start": 54000 } Response (solution found): { "algorithm": "DeepSeekHashV1", "challenge": "...", "salt": "...", "answer": 53021, "signature": "", "found": true, "searched": 222, "time": "0.00s" } Reference chunked client: see solve() in ds.py (stdlib only). ---------------------------------------------------------------- 5. BATCH PoW --------------------------------------------------------------- POST /api/pow/batch Solve multiple PoW challenges at once (max 10). Request: { "challenges": [ {"challenge":"...","salt":"...","difficulty":144000,"expire_at":...}, {"challenge":"...","salt":"...","difficulty":100000,"expire_at":...} ] } Response: { "results": [ {"challenge":"...","answer":53021,"time":"0.60s"}, {"challenge":"...","answer":null,"time":"timeout"} ] } ---------------------------------------------------------------- 6. FILE UPLOAD --------------------------------------------------------------- POST /api/upload Upload a file to DeepSeek (text/image/audio/PDF/Office). Accepts base64 data or a public https URL. Returns the file id; images are also forked to the vision model (vision_file_id). Request: { "filename": "report.txt", "file_data": "data:text/plain;base64,SGVsbG8=", "mime": "text/plain" (optional) } or: { "file_url": "https://example.com/img.png" } Response: { "ok": true, "file": {"file_id": "file-xxx", "status": "SUCCESS", "file_name": "report.txt", "size": 123}, "vision_file_id": "file-yyy" (only for images) } Wait for parse to finish: POST /api/upload/status {"file_ids":["file-xxx"]} (optional "wait_ms" = how long to poll, default 8000). GET is not accepted (the route answers 405). Use the returned file_id in /api/chat as "files": ["file-xxx"] or in /v1/chat/completions as an inline content part (see above). ---------------------------------------------------------------- 7. LOGIN --------------------------------------------------------------- POST /api/login Authenticate with DeepSeek and get a token. Request: { "email": "your@email.com", "password": "your_password" } Response: { "success": true, "token": "your-auth-token" } ============================================================== USAGE EXAMPLES =============================================================== --- cURL --- # Solve PoW (low difficulty) curl -X POST https://deepseek-pow.contact-3mh.workers.dev/api/pow \ -H "Content-Type: application/json" \ -d '{"challenge":"...","salt":"...","difficulty":1000,"expire_at":1787692750574}' # Solve PoW (high difficulty, e.g. 144000): parallel chunks until found:true # chunk i: {"challenge":"...","salt":"...","difficulty":144000,"expire_at":..., # "start": i*1200, "count": 1200} -> 200 {found:true, answer:N} # or {found:false, next_start:...} # Chat (basic) curl -X POST https://deepseek-pow.contact-3mh.workers.dev/api/chat \ -H "Content-Type: application/json" \ -d '{"prompt":"Hello!","token":"YOUR_TOKEN"}' # PoW is solved by the server — no local solving needed. # Chat with controls (web search + low temperature + custom system prompt) curl -X POST https://deepseek-pow.contact-3mh.workers.dev/api/chat \ -H "Content-Type: application/json" \ -d '{"prompt":"Latest AI news?","token":"YOUR_TOKEN", "search_enabled":true,"temperature":0.2, "system_prompt":"You are a concise technical assistant."}' --- Python --- import requests # Chat r = requests.post("https://deepseek-pow.contact-3mh.workers.dev/api/chat", json={ "prompt": "What is 2+2?", "token": "YOUR_TOKEN" }) print(r.json()["response"]) # Multi-turn conversation (keep the same session, chain parent_message_id) base = "https://deepseek-pow.contact-3mh.workers.dev/api/chat" r1 = requests.post(base, json={"prompt": "Hello, call me Sam", "token": "T"}).json() print(r1["response"]) r2 = requests.post(base, json={ "prompt": "What's my name?", "token": "T", "session_id": r1["session_id"], "parent_message_id": r1["parent_message_id"], }).json() print(r2["response"]) # Solve PoW r = requests.post("https://deepseek-pow.contact-3mh.workers.dev/api/pow", json={ "challenge": "...", "salt": "...", "difficulty": 144000, "expire_at": 1787692750574 }) print(r.json()["answer"]) --- JavaScript --- const response = await fetch("https://deepseek-pow.contact-3mh.workers.dev/api/chat", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ prompt: "Hello!", token: "YOUR_TOKEN" }) }); const data = await response.json(); console.log(data.response); ================================================================ ERROR CODES ================================================================ 200 - Success 400 - Bad request (missing parameters, or PoW fallback challenge returned) 401 - Unauthorized (invalid token/credentials) 404 - Not found (solution not found or endpoint) 405 - Method not allowed 429 - Rate limit exceeded 500 - Internal server error 502 - Upstream error (DeepSeek API failure) ================================================================ FOOTER ================================================================ Built by 3MH TECHNOLOGIES | t.me/j49_c Powered by 3MH TECHNOLOGIES | https://3mh.pages.dev