Async Python client for private DeepSeek API
aiodeepseek is a high-performance async Python client for the private DeepSeek API, supporting streaming, image uploads, multi-turn conversations, and new account registration. It automatically solves proof-of-work challenges using C++ with AVX2 optimization.
Article intelligence
Key points
- Async Python client with streaming and image upload support
- Multi-turn conversation and account registration features
- Automatic proof-of-work solving with C++/AVX2 optimization
- Three model types: default, deep reasoning, and vision
Why it matters
This matters because async Python client with streaming and image upload support.
Technical impact
May affect model selection, inference cost, product capability, and evaluation benchmarks.
Notifications You must be signed in to change notification settings
Fork 0
Star 2
BranchesTags
Open more actions menu
Folders and files
NameName
Last commit message
Last commit date
Latest commit
History
23 Commits
23 Commits
.github/workflows
.github/workflows
aiodeepseek
aiodeepseek
docs
docs
inspect_api
inspect_api
.gitignore
.gitignore
LICENSE
LICENSE
MANIFEST.in
MANIFEST.in
README.md
README.md
main.py
main.py
pyproject.toml
pyproject.toml
requirements.txt
requirements.txt
setup.py
setup.py
Repository files navigation
A high-performance async Python client for the private DeepSeek API. Supports streaming, image uploads, multi-turn conversations, and new account registration.
➡️ Russian documentation: docs/ru/README.md
Installation
pip install aiodeepseek
A C++ extension build requires a compiler with AVX2 support and pybind11. More details are in docs/en/pow.md. You can also download a prebuilt release.
Quick start
Email/password authentication
import asyncio from aiodeepseek import DeepSeekClient
async def main(): async with DeepSeekClient( email="[email protected]", password="password123" ) as client: result = await client.ask("Hello!") print(result.text)
asyncio.run(main())
Token authentication
import asyncio from aiodeepseek import DeepSeekClient
async def main(): async with DeepSeekClient(token="YOUR_TOKEN") as client: result = await client.ask("Hello!") print(result.text)
asyncio.run(main())
Streaming a response
import asyncio from aiodeepseek import DeepSeekClient
async def main(): async with DeepSeekClient(token="YOUR_TOKEN") as client: async for chunk in client.ask_stream( prompt="Tell me about Python" ): print(chunk, end="", flush=True)
asyncio.run(main())
Multi-turn conversation
import asyncio from aiodeepseek import DeepSeekClient
async def main(): async with DeepSeekClient(token="YOUR_TOKEN") as client: chat = client.new_conversation() print((await chat.ask("What is your name?")).text) print((await chat.ask("What can you do?")).text)
asyncio.run(main())
Image upload
import asyncio from pathlib import Path from aiodeepseek import DeepSeekClient
async def main(): async with DeepSeekClient(token="YOUR_TOKEN") as client: img = await client.upload_image(Path("photo.jpg")) result = await client.ask("What is in the photo?", image=img) print(result.text)
asyncio.run(main())
or by passing Path | bytes directly to ask:
import asyncio from pathlib import Path from aiodeepseek import DeepSeekClient
async def main(): async with DeepSeekClient(token="YOUR_TOKEN") as client: result = await client.ask( prompt="What is in the photo?", image=Path("photo.jpg") ) print(result.text)
asyncio.run(main())
New account registration
import asyncio from aiodeepseek import DeepSeekClient
async def main(): await DeepSeekClient.send_reg_code("[email protected]") code = input("Code from the email: ") token = await DeepSeekClient.confirm_reg_code("[email protected]", "password123", code) print("Token:", token)
asyncio.run(main())
Model types
from aiodeepseek import DeepSeekClient from aiodeepseek.types.enums import ModelType
async with DeepSeekClient(token="...", model=ModelType.VISION) as client: ...
Value Description
ModelType.DEFAULT Standard language model
ModelType.EXPERT Deep reasoning model
ModelType.VISION Model with machine vision support
Error handling
import asyncio from aiodeepseek import DeepSeekClient from aiodeepseek.types.exceptions import AuthorizationError, DeepSeekError
async def main(): try: async with DeepSeekClient(token="invalid") as client: await client.ask("Hello") except AuthorizationError: print("Token is invalid") except DeepSeekError as e: print(f"API error: {e}")
asyncio.run(main())
Proof-of-Work
Before every request, the client automatically solves the PoW challenge issued by the DeepSeek server. Typical difficulty is 144,000 iterations. The calculation is implemented in C++ using AVX2, which keeps it barely noticeable in practice. More details are in docs/en/pow.md.
Documentation
DeepSeekClient - client methods
Conversation - multi-turn dialog
Types and data models
Exceptions
Proof-of-Work
Requirements
Python 3.9+
aiohttp >= 3.9
A C++17 compiler with AVX2 (to build the extension) or manually downloaded wheels.
About
High-performance async Python client for the private DeepSeek API
Topics
python
streaming
ai
async
python-library
chatbot
reverse-engineering
api-client
aiohttp
asyncio
deepseek
deepseek-api
deepseek-api-client
Resources
Readme
License
MIT license
Uh oh!
There was an error while loading. Please reload this page.
Activity
Stars
2 stars
Watchers
0 watching
Forks
0 forks
Report repository
Releases 1
v0.1.1
Latest
May 10, 2026
Packages 0
Uh oh!
There was an error while loading. Please reload this page.
Contributors
Uh oh!
There was an error while loading. Please reload this page.
Languages
Python 89.9%
C++ 10.1%