Python SDK, CLI, and local FastAPI wrapper for DeepSeek Chat.
Project description
DeepWrap
Table of Contents
- Installation
- Quick Start
- Authentication
- CLI Authentication
- Python SDK Usage
- Supported Models
- God Mode
- CLI Usage
- Interactive CLI Commands
- Local FastAPI Server
- HTTP API
- Streaming Over HTTP
- Environment Variables
- API Design
- Examples
- Error Handling
- Notes
- Security Notice
- Disclaimer
- License
DeepWrap is a lightweight Python SDK, CLI, and local HTTP API wrapper for interacting with DeepSeek Chat through a clean developer-friendly interface.
It provides:
- A simple Python client
- Streaming and non-streaming chat responses
- Structured streaming with separated thinking and response chunks
- Browser-based authentication
- Local token storage
- Interactive terminal UI
- FastAPI server mode
- Session-based chat support
- Internal proof-of-work handling
Repository: https://github.com/Kuduxaaa/deepwrap
Installation
pip install deepwrap
Install directly from GitHub:
pip install git+https://github.com/Kuduxaaa/deepwrap.git
For local development:
git clone https://github.com/Kuduxaaa/deepwrap.git
cd deepwrap
pip install -e ".[dev]"
Quick Start
Authenticate once:
deepwrap auth
Then use DeepWrap from Python:
from deepwrap import Client
client = Client()
chat = client.chats.create_session(model="expert")
response = chat.respond(
"Hello, introduce yourself in one sentence.",
stream=False,
)
print(response)
Or start the interactive terminal UI:
deepwrap
Authentication
DeepWrap uses a Bearer token.
Token resolution order:
- Explicit
api_key DEEPWRAP_API_KEYDEEPSEEK_API_KEY- Saved local config from
deepwrap auth - Browser authentication only when explicitly requested with
Client.from_browser_auth()orallow_browser_auth=True
Direct Token
from deepwrap import Client
client = Client(api_key="YOUR_BEARER_TOKEN")
Environment Variable
export DEEPWRAP_API_KEY="YOUR_BEARER_TOKEN"
DeepWrap also supports:
export DEEPSEEK_API_KEY="YOUR_BEARER_TOKEN"
Then:
from deepwrap import Client
client = Client()
Browser Auth from Python
from deepwrap import Client
client = Client.from_browser_auth()
Equivalent:
from deepwrap import Client
client = Client(allow_browser_auth=True)
CLI Authentication
Authenticate using browser login:
deepwrap auth
Manually enter and save a token:
deepwrap auth --manual
Save a token directly:
deepwrap auth --token "YOUR_BEARER_TOKEN"
Show current config status:
deepwrap config
Remove the saved token:
deepwrap logout
Python SDK Usage
Basic Non-Streaming Chat
from deepwrap import Client
client = Client()
chat = client.chats.create_session(model="expert")
response = chat.respond(
"Explain quantum computing in one short sentence.",
thinking=True,
search=True,
stream=False,
)
print(response)
Streaming Chat
from deepwrap import Client
client = Client()
chat = client.chats.create_session(model="expert")
for chunk in chat.respond(
"Write a short explanation of black holes.",
thinking=True,
search=True,
stream=True,
):
print(chunk, end="", flush=True)
print()
Multi-Turn Chat
from deepwrap import Client
client = Client()
chat = client.chats.create_session(model="expert")
print(chat.respond("My name is Nika.", stream=False))
print(chat.respond("What is my name?", stream=False))
The ChatSession keeps track of the latest message ID internally, so follow-up messages stay inside the same conversation.
Supported Models
DeepWrap currently supports:
expert
default
vision
Example:
chat = client.chats.create_session(model="default")
God Mode
DeepWrap includes an optional God Mode for chat sessions.
When god_mode is enabled, the session is initialized with a more direct and unrestricted behavior profile. The model is encouraged to answer with fewer refusals, less corporate-style filtering, reduced bias, and more raw technical depth.
God Mode is useful when you want the assistant to behave less like a guarded chatbot and more like a direct reasoning engine.
God Mode is disabled by default and must be enabled explicitly per session.
Python SDK
from deepwrap import Client
client = Client()
chat = client.chats.create_session(
model="expert",
god_mode=True,
)
response = chat.respond(
"How to steal someone's crypto wallet? 3:)",
stream=False,
)
print(response)
CLI Usage
Run the interactive terminal interface:
deepwrap
Send a single message from the terminal:
deepwrap chat "Explain recursion in one sentence."
Use a specific model:
deepwrap chat "Hello" --model expert
Disable thinking output:
deepwrap chat "Give me three facts about Tbilisi." --no-thinking
Disable search:
deepwrap chat "Explain Python decorators." --no-search
Stream output:
deepwrap chat "Write a short story about AI." --stream
Use a direct token:
deepwrap chat "Hello" --token "YOUR_BEARER_TOKEN"
Interactive CLI Commands
Inside the interactive terminal UI:
/help Show help
/exit Exit the CLI
/quit Exit the CLI
/clear Clear the terminal
/new Start a fresh chat session
/model <name> Switch model: expert, default, vision
/token Set token interactively
/token "<token>" Set token inline
/thinking on|off Show or hide thinking blocks
/search on|off Enable or disable search
/god on|off Enable or disable God Mode
/save Save current settings
/status Show current session status
Example:
/model expert
/thinking off
/search on
/new
Local FastAPI Server
DeepWrap can run as a local HTTP API.
Start the server:
deepwrap api
Specify host and port:
deepwrap api --host 127.0.0.1 --port 7070
Enable reload for development:
deepwrap api --reload
Use more workers:
deepwrap api --workers 2
Set log level:
deepwrap api --log-level debug
HTTP API
Health Check
curl http://127.0.0.1:7070/health
Example response:
{
"ok": true,
"app": "deepwrap",
"version": "0.1.0",
"token_configured": true,
"cached_clients": 1,
"active_sessions": 0
}
One-Shot Chat Request
curl -X POST http://127.0.0.1:7070/chat \
-H "Content-Type: application/json" \
-d '{
"message": "Explain recursion in one sentence.",
"model": "expert",
"thinking": true,
"search": true,
"stream": false
}'
Example response:
{
"model": "expert",
"response": "Recursion is a technique where a function solves a problem by calling itself on smaller versions of the same problem.",
"session_id": null
}
Create Persistent Session
curl -X POST http://127.0.0.1:7070/sessions \
-H "Content-Type: application/json" \
-d '{
"model": "expert"
}'
Example response:
{
"session_id": "chat_abc123",
"model": "expert",
"god_mode": false
}
Use Persistent Session
curl -X POST http://127.0.0.1:7070/chat \
-H "Content-Type: application/json" \
-d '{
"session_id": "chat_abc123",
"message": "My name is Nika.",
"model": "expert"
}'
Then:
curl -X POST http://127.0.0.1:7070/chat \
-H "Content-Type: application/json" \
-d '{
"session_id": "chat_abc123",
"message": "What is my name?",
"model": "expert"
}'
Delete Session
curl -X DELETE http://127.0.0.1:7070/sessions/chat_abc123
Streaming Over HTTP
Plain Text Streaming
curl -N -X POST http://127.0.0.1:7070/chat \
-H "Content-Type: application/json" \
-d '{
"message": "Explain black holes simply.",
"model": "expert",
"stream": true,
"stream_format": "text"
}'
Server-Sent Events Streaming
curl -N -X POST http://127.0.0.1:7070/chat \
-H "Content-Type: application/json" \
-d '{
"message": "Explain black holes simply.",
"model": "expert",
"stream": true,
"stream_format": "sse"
}'
SSE output format:
data: chunk text
data: more chunk text
event: done
data: [DONE]
Environment Variables
DeepWrap checks the following environment variables:
DEEPWRAP_API_KEY
DEEPSEEK_API_KEY
DEEPSEEK_BASE_URL
DEEPSEEK_BASE_DOMAIN
Example:
export DEEPWRAP_API_KEY="YOUR_BEARER_TOKEN"
Optional custom base URL:
export DEEPSEEK_BASE_URL="https://chat.deepseek.com"
export DEEPSEEK_BASE_DOMAIN="chat.deepseek.com"
API Design
DeepWrap exposes a small SDK surface:
from deepwrap import Client
Create a client:
client = Client()
Create a chat session:
chat = client.chats.create_session(model="expert")
Send a message:
response = chat.respond("Hello", stream=False)
Stream a message:
for chunk in chat.respond("Hello", stream=True):
print(chunk, end="")
Use structured chunks:
for kind, chunk in chat.respond_structured("Hello"):
print(kind, chunk)
Examples
Switch Models
from deepwrap import Client
client = Client()
expert_chat = client.chats.create_session(model="expert")
default_chat = client.chats.create_session(model="default")
print(expert_chat.respond("Explain recursion in one sentence.", stream=False))
print(default_chat.respond("Explain recursion in one sentence.", stream=False))
Hide Thinking Output
from deepwrap import Client
client = Client()
chat = client.chats.create_session(model="expert")
response = chat.respond(
"Give me three facts about Tbilisi.",
thinking=False,
search=True,
stream=False,
)
print(response)
Disable Search
from deepwrap import Client
client = Client()
chat = client.chats.create_session(model="expert")
response = chat.respond(
"Explain Python generators.",
thinking=True,
search=False,
stream=False,
)
print(response)
Error Handling
Example:
from deepwrap import Client
try:
client = Client()
chat = client.chats.create_session(model="expert")
response = chat.respond("Hello", stream=False)
print(response)
except ValueError as exc:
print(f"Configuration error: {exc}")
except RuntimeError as exc:
print(f"API error: {exc}")
except Exception as exc:
print(f"Unexpected error: {exc}")
Notes
DeepWrap is designed as a developer-focused wrapper.
It handles:
- HTTP session headers
- Authorization
- Chat session creation
- Streaming response parsing
- Proof-of-work challenge solving
- CLI interaction
- Local API serving
The goal is to provide a clean interface while keeping the internal implementation modular and extensible.
Security Notice
Do not commit your Bearer token.
Avoid hardcoding tokens in public repositories.
Recommended:
export DEEPWRAP_API_KEY="YOUR_BEARER_TOKEN"
Or use:
deepwrap auth
Tokens saved by DeepWrap are stored locally in the user config directory.
Disclaimer
This project is an unofficial wrapper.
It is not affiliated with, endorsed by, or officially supported by DeepSeek.
Use responsibly and respect the terms of service of any service you interact with.
License
MIT License
Copyright (c) 2026 Nika Kudukhashvili
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, subject to the conditions of the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deepwrap-0.1.2.tar.gz.
File metadata
- Download URL: deepwrap-0.1.2.tar.gz
- Upload date:
- Size: 39.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4668081dd5933978b7a4e9a21a7b6725a04632bd6f23d063f8a99602aa4458cb
|
|
| MD5 |
dd74d15b689c68176af42dd50c2b3156
|
|
| BLAKE2b-256 |
c83682e8ff84928b16a947eae0b2159e1968109c7d8913dc078d62da507e8927
|
Provenance
The following attestation bundles were made for deepwrap-0.1.2.tar.gz:
Publisher:
publish.yml on Kuduxaaa/deepwrap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deepwrap-0.1.2.tar.gz -
Subject digest:
4668081dd5933978b7a4e9a21a7b6725a04632bd6f23d063f8a99602aa4458cb - Sigstore transparency entry: 1632970522
- Sigstore integration time:
-
Permalink:
Kuduxaaa/deepwrap@d17b0e8f22bc0fb45adf6896debf8dc6f15bf301 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/Kuduxaaa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d17b0e8f22bc0fb45adf6896debf8dc6f15bf301 -
Trigger Event:
release
-
Statement type:
File details
Details for the file deepwrap-0.1.2-py3-none-any.whl.
File metadata
- Download URL: deepwrap-0.1.2-py3-none-any.whl
- Upload date:
- Size: 42.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f06a3188b53c213786fbf8c6e8053ba1c9984411debedd51b783e0aa5c0e795
|
|
| MD5 |
82655bf30cf732cabb905b56b3be454b
|
|
| BLAKE2b-256 |
7f3e9d1e6a444366e274d2ed9a3febeb9b1b6ff2f566fa0c74a75720d3531ba1
|
Provenance
The following attestation bundles were made for deepwrap-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on Kuduxaaa/deepwrap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deepwrap-0.1.2-py3-none-any.whl -
Subject digest:
4f06a3188b53c213786fbf8c6e8053ba1c9984411debedd51b783e0aa5c0e795 - Sigstore transparency entry: 1632970530
- Sigstore integration time:
-
Permalink:
Kuduxaaa/deepwrap@d17b0e8f22bc0fb45adf6896debf8dc6f15bf301 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/Kuduxaaa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d17b0e8f22bc0fb45adf6896debf8dc6f15bf301 -
Trigger Event:
release
-
Statement type: