Github · GitHub Repository Radar
sums001 Deepseek-API
Reverse engineered Deepseek chat into an OpenAI compatible API. Access V4 and R1 models through a simple REST interface without API keys or billing.
Stars
260
Forks
63
Watchers: 260
Language
License: MIT License
Repository Radar Score
38 / 100
Growth
- 7d
- +0
- 30d
- +0
- %
- 0.0%
Not enough metric snapshots yet to chart growth for this repository.
Score breakdown
- popularity 44
- growth 0
- activity 55
- freshness 100
- community 34
Need help integrating this stack?
Our team builds with modern open-source stacks. Tell us what you are shipping.
Get a quote →Using your own DeepSeek account. No API key, no credits, no paid plan: it turns the free chat at chat.deepseek.com into an API you can call from code.
You can use it in two ways:
- 🐍 As a Python library: just call
client.chat("Hi"). Supports streaming and multi-turn conversations. - 🔌 As a local OpenAI-compatible API: runs a server at
http://localhost:8000/v1that speaks the OpenAI format, so the officialopenaiSDK (and any OpenAI-compatible app) works as a drop-in, withlocalhostin place of OpenAI.
You sign in once in a browser with your DeepSeek account; your session is saved and refreshed automatically after that.
Unofficial project. Not affiliated with or endorsed by DeepSeek. It automates the consumer DeepSeek web experience for personal use, so use it responsibly and within DeepSeek's terms.
- Why use this?
- Requirements
- Setup (2 minutes)
- Usage 1: In Python (no server)
- Usage 2: As an OpenAI-compatible server
- Command line
- Human-check & proof-of-work (automatic)
- Models, DeepThink & web search
- Concurrency
- Rate limiting
- Project layout
- Notes & limitations
- License
- Free: uses your normal signed-in DeepSeek account, no API billing.
- Drop-in OpenAI replacement: point any OpenAI client at
localhostand it just works. - Full DeepSeek toolset: pick the fast or expert model, and toggle DeepThink reasoning and web search per request.
- Streaming + conversations: token-by-token output and multi-turn threads addressed by
conversation_id.
- Python 3.9+
- A DeepSeek account (the free one you use for chat.deepseek.com is fine)
- Works on Windows, macOS, and Linux
# 1. Clone the project
git clone https://github.com/sums001/Deepseek-API.git
cd "Deepseek-API"2. Create and activate a virtual environment
On macOS / Linux:
python3 -m venv venv
source venv/bin/activateOn Windows (PowerShell):
python -m venv venv
venv\Scripts\Activate.ps1On Windows you may need to allow script execution once:
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned. Incmd.exeactivate withvenv\Scripts\activate.batinstead.
3. Install dependencies and sign in
# Install dependencies
pip install -r requirements.txt
# Install the browser Playwright needs (one-time)
playwright install chromium
# Sign in once: a browser opens, log into your DeepSeek account
python -m deepseek.authThe login window opens so you can sign in by hand and solve the human-check once. After that your session (bearer token + cookies) is saved under session/ (git-ignored, never shared) and reused on every run — the cached session is refreshed automatically, so your first request works right away.
The server can also open this window for you on demand the first time it needs a session, so this step is optional for local single-user use.
The simplest way if your code is already Python.
from deepseek import DeepSeekClient
client = DeepSeekClient() # loads your signed-in session
# Get a full reply
reply = client.chat("Say hello in one short sentence.")
print(reply.text)
# Continue the SAME conversation — pass the id back
reply2 = client.chat("And now in French?", conversation_id=reply.conversation_id)
print(reply2.text)
# Stream the answer as it's typed
for chunk in client.stream("Tell me a short joke"):
print(chunk, end="", flush=True)chat() returns the full text plus a conversation_id; pass that id back to keep the thread going, or omit it to start fresh. stream() yields the reply piece by piece.
👉 More: examples/01_direct_chat.py, 02_direct_conversation.py, 03_direct_stream.py
Start a local server that speaks the OpenAI API, so existing OpenAI tools and SDKs work unchanged.
python app.py
# -> DeepSeek OpenAI-compatible API on http://127.0.0.1:8000Then point any OpenAI client at it (the API key is required by the SDK but ignored):
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="unused")
resp = client.chat.completions.create(
model="deepseek-chat",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)Or call it with plain HTTP / curl:
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "deepseek-chat", "messages": [{"role": "user", "content": "Hello!"}]}'Endpoints
| Method | Path | Description |
|---|---|---|
POST |
/v1/chat/completions |
Chat (supports "stream": true, plus optional "conversation_id", "thinking", "search") |
GET |
/v1/models |
Lists the available models |
GET |
/healthz |
Health check (rate-limit exempt) |
Change the address with env vars:
HOST=0.0.0.0 PORT=8080 python app.py, or runuvicorn server.api:app --host 0.0.0.0 --port 8080.
👉 More: examples/04_server_http.py, examples/05_server_stream.py, examples/06_server_openai_sdk.py
python -m deepseek.auth # sign in and save the sessionDeepSeek's chat sits behind two gates, both handled for you:
- AWS WAF human-check: access needs a signed-in browser session that has
cleared the "verify you're human" check.
python -m deepseek.authopens a real browser so you can sign in and solve it once; the resulting token + cookies are cached undersession/and reused on every request. - Proof-of-work: every completion is gated by a PoW challenge. The bridge
solves it by running DeepSeek's own
sha3_wasm_bg.wasmmodule — the same one the browser loads — inside awasmtimesandbox, so there's nothing to do on your end.
A cached session is reused for ~6 hours and refreshed headlessly from your saved Chrome profile when possible; only a full expiry sends you back to the browser.
The model name selects which model answers. DeepThink and web search are
not models — they're orthogonal toggles you pass per request.
| Model | DeepSeek mode | Notes |
|---|---|---|
deepseek-chat |
Instant | Fast default model |
deepseek-expert |
Expert | Stronger, slower |
Pass thinking: true (DeepThink reasoning) and/or search: true (web search) in
the request body — or via the OpenAI SDK's extra_body:
resp = client.chat.completions.create(
model="deepseek-expert",
messages=[{"role": "user", "content": "What changed in the news today?"}],
extra_body={"thinking": True, "search": True},
)conversation_id, thinking, and search are non-OpenAI extras. A thread's
model is fixed at creation, so model can't be combined with conversation_id
on resume. Unknown model names return a 404 (no silent fallback). See
server/config.py.
The server bridges a single signed-in DeepSeek account behind one shared
client. The PoW solver's wasmtime store isn't reentrant, so upstream calls are
serialized: parallel HTTP requests queue behind a lock and run one at a time
(see server/api.py). This is intentional — throughput is
sequential, not parallel. Keep concurrent in-flight requests low, and please
don't hammer your account.
On top of serialization, the bridge enforces a self-imposed rate limit with a
dependency-free sliding-window limiter (server/ratelimit.py):
it caps accepted requests per client IP and returns a standard 429 +
Retry-After when you exceed it. /healthz is exempt.
| Env var | Default | Meaning |
|---|---|---|
RATE_LIMIT_PER_MINUTE |
30 |
Requests/minute accepted per client IP |
RATE_LIMIT_PER_MINUTE=60 python app.py # raise itOn the client side, use exponential backoff. Transient 429s clear if you
retry with growing delays (e.g. 1s, 2s, 4s). The official openai SDK does this
automatically and honours Retry-After; with plain HTTP, add a few retries
yourself.
| Path | What it does |
|---|---|
| deepseek/ | The core library: DeepSeekClient, auth/browser sign-in (auth.py), the HTTP driver (client.py), and the PoW solver (pow.py) |
| server/ | The FastAPI OpenAI-compatible server |
| examples/ | Runnable examples for every feature (examples/README.md) |
| app.py | Starts the server |
- Sign in once, then reuse. The cached session refreshes automatically; you only re-sign-in if it fully expires.
- Be reasonable. Please use it in moderation, and don't spam or hammer it with automated bulk requests.
- No real token counts.
usagein responses is a rough ~4-chars/token estimate. - Most OpenAI params are accepted but ignored (
temperature,top_p,max_tokens); onlymodel,messages,stream,conversation_id,thinking, andsearchdo anything. - Vision is deferred. It needs image-upload plumbing that isn't built yet.
- Your session is private. Everything in
session/(cookies + token) stays on your machine and is git-ignored.
Released under the MIT License. As this is an unofficial project, you remain responsible for complying with DeepSeek's terms of service.
Repository Radar analysis
Deterministic insights derived from public metadata and our observations — not personal testing or reviews.
Why this repository is interesting
- Listed in our discovery index with public GitHub metadata for analysis.
Who should use it
- Developers working primarily with Python
- Teams exploring AI tooling, agents, or ML infrastructure
- Backend engineers shipping APIs and product backends
- Early adopters evaluating emerging projects
Potential use cases
- Reference or evaluate Python open-source approaches in this domain
- Prototype AI/agent workflows or study reference architectures
Strengths
- README present in our index
- Declared license: MIT License
Limitations / considerations
- Insights are derived from public metadata and our observations — not a substitute for code review
What to watch
- Radar Score is modest — dig into activity and docs before committing
- Young repository — popularity and maintenance patterns can change quickly
Source: GitHub (public metadata) + Repository Radar analysis. We do not claim ownership of third-party repositories.
Similar repositories
browser-use/browser-use
★ 112,172 · Python · radar 67
vllm-project/vllm
★ 90,898 · Python · radar 67
microsoft/markitdown
★ 178,137 · Python · radar 66
huggingface/transformers
★ 164,744 · Python · radar 66
harry0703/MoneyPrinterTurbo
★ 120,187 · Python · radar 66
bytedance/deer-flow
★ 81,316 · Python · radar 66