Menu

1 / 2

dsk++ — I rewrote a forgotten DeepSeek library to be fully async (and added a bunch of stuff)

DEV Community·Fundiman·6 months ago
#Z8LniZOd
#ai#python#programming#deepseek#async
Reading 0:00
15s threshold

A while back, xtekky wrote a small library called deepseek4free for interacting with DeepSeek's chat infrastructure. It worked, but it was synchronous — meaning it blocked the event loop on every API call, making it painful to use in any async Python project.

I needed it for a Discord bot I was building, and the blocking behavior was causing real problems. So I rewrote it.

The result is dskpp (dsk++) — a drop-in async replacement that adds a few things the original never had.

What's new in dsk++

Fully async — built on curl_cffi async sessions, async for streaming, asyncio.to_thread() for WASM PoW

Concurrent file uploads — asyncio.gather() uploads multiple files simultaneously

Session deletion — await api.delete_chat_session(session_id)

Conversation history — await api.get_history(session_id)

Proper error hierarchy — AuthenticationError , RateLimitError , NetworkError , CloudflareError , UploadFilesUnavailable , APIError

Automatic Cloudflare detection and cookie refresh

Docker support via…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.