惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
Stack Overflow Blog
Stack Overflow Blog
量子位
腾讯CDC
N
Netflix TechBlog - Medium
aimingoo的专栏
aimingoo的专栏
小众软件
小众软件
S
SegmentFault 最新的问题
A
About on SuperTechFans
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tailwind CSS Blog
G
Google Developers Blog
U
Unit 42
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
雷峰网
雷峰网
罗磊的独立博客
Vercel News
Vercel News
L
LangChain Blog
V
V2EX
P
Proofpoint News Feed
M
MIT News - Artificial intelligence
博客园 - Franky
V
Visual Studio Blog
J
Java Code Geeks

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
I built DeepWrap: a Python SDK and CLI for DeepSeek Chat
Nika Kudukhashvili · 2026-05-28 · via DEV Community

DeepSeek Chat was free in the browser.
But the moment I wanted to use it like a developer, it became a different story.

That annoyed me more than it probably should have.

If something is usable in the browser, why should it suddenly feel blocked, awkward, or artificially expensive the moment you want to call it from Python, from your terminal, or from your own local tools?

That mismatch was the whole reason I built DeepWrap.

What started as “let me inspect a few requests and see how hard this is” turned into a full project: a Python SDK, a terminal CLI, and a local HTTP API wrapper for DeepSeek Chat.

Why I built it

The real motivation was simple:

DeepSeek was free in the browser, but not free in the way developers actually want to use it.

And that felt absurd.

I wanted to use it in real workflows:

  • Python scripts
  • terminal sessions
  • reusable chat sessions
  • streaming responses
  • local tools
  • local HTTP integrations

I did not want to babysit browser tabs forever just to use a model in a developer-friendly way.

So the idea behind DeepWrap was basically:

take the browser experience and make it usable from code.

How I built it

At first, I genuinely thought this was going to be easy.

I opened DevTools, went to the Network tab, started looking at the XHR requests, and my first thought was:

“Okay, this is probably just a matter of replaying the right requests with the right headers.”

That optimism did not survive very long.

1. Inspect the browser requests

The first step was just observing the flow:

  • how a chat session gets created
  • what headers are sent
  • what the prompt payload looks like
  • how the response stream comes back

At a glance, the flow looked simple:

  1. create a session
  2. send a prompt
  3. read the stream

That was enough to sketch the basic client structure.

2. Hit the first wall: PoW + WASM

Then came the first real problem: proof-of-work.

Some requests were not just normal authenticated calls. The browser had to solve a PoW challenge, and that logic was implemented with WASM.

So the project instantly got more interesting.

Instead of only replaying requests, I had to:

  • inspect how the challenge is fetched
  • understand the challenge payload
  • find where the browser solves it
  • reverse the WASM input/output behavior
  • replicate the solve step from Python

That was the point where this stopped being a “quick wrapper.”

3. Add auth that feels usable

I also didn’t want the whole thing to rely only on pasting bearer tokens manually.

Yes, that works.
No, that doesn’t feel great.

So I added browser-based auth too.

That meant building a flow that could:

  • launch a browser
  • connect through DevTools / remote debugging
  • observe authenticated traffic
  • extract the bearer token
  • normalize it
  • reuse it for the SDK and CLI

That part was messy, but necessary if I wanted the project to feel real.

4. Parse the stream properly

Once auth and PoW worked, I still had to handle the actual chat stream.

And it was not just “text in, text out.”

The stream included:

  • thinking fragments
  • response fragments
  • partial updates
  • metadata events
  • close events

So I built a parser that could:

  • preserve multi-turn state
  • keep track of parent_message_id
  • support both streaming and non-streaming
  • optionally separate thinking from final output

That let the public API stay simple even if the internals were not.

5. Turn it into a real tool

Once the Python API felt stable, I pushed it further:

  • an interactive CLI
  • a local FastAPI server

So DeepWrap gradually became three things:

  1. a Python SDK
  2. a terminal chat interface
  3. a local HTTP API wrapper

That was the point where it stopped feeling like a hack and started feeling like a product.

What using it looks like

If you just want to try it, the flow is simple.

Install

pip install deepwrap

Create a client

from deepwrap import Client

client = Client()

If you already have a token configured, that’s enough.

Create a chat session

chat = client.chats.create_session(model="expert")

Send a normal response

response = chat.respond(
    "Explain quantum computing in one short sentence.",
    thinking=True,
    search=True,
    stream=False,
)

print(response)

Stream the output

for chunk in chat.respond(
    "Write a short explanation of black holes.",
    thinking=True,
    search=True,
    stream=True,
):
    print(chunk, end="", flush=True)

print()

Keep context across turns

print(chat.respond("My name is Nika.", stream=False))
print(chat.respond("What is my name?", stream=False))

That works because the session keeps track of the conversation state internally.

CLI usage

I also wanted it to feel good in the terminal.

You can start the interactive interface with:

deepwrap

Or use one-shot terminal calls:

deepwrap chat "Explain recursion in one sentence."

That was important to me because sometimes you don’t want a script — you just want a fast terminal workflow.

God Mode

I also added an experimental feature called God Mode.

This is not some magical hidden model. It is a session-level behavior override implemented through prompt injection on the first user turn.

In practice, that means:

  • it changes how the model behaves for that session
  • it is intentionally intrusive
  • it can diverge from normal behavior in unpredictable ways

I added it mostly as a developer/testing feature, not as a normal mode for everyday use.

So I treat it as exactly what it is:
an experimental override for controlled testing, not something meant for general use.

Security notes

A few important notes:

  • Do not commit your bearer token
  • Prefer environment variables or local saved config over hardcoding secrets
  • Tokens saved by DeepWrap are stored locally in the user config directory
  • Browser auth should only be used in environments you trust
  • Experimental features like God Mode should be treated as development-only behavior modifiers

DeepWrap is an unofficial wrapper, so use it responsibly.

GitHub

The project is open source here:

GitHub: https://github.com/Kuduxaaa/deepwrap

Feedback

This whole project started from a very simple frustration:

“Why is it free in the browser, but awkward the moment I want to use it like a developer?”

Then it turned into a much bigger project than I expected:
reverse-engineering requests, dealing with PoW WASM, browser auth, session handling, streaming, CLI UX, and local API design.

If you check it out, I’d genuinely love feedback on:

  • API design
  • CLI UX
  • auth flow
  • architecture
  • docs
  • feature ideas

If something feels awkward, overbuilt, underbuilt, or just weird, tell me.

That kind of feedback is the most useful.