Skip to main content

High-performance async Python client for the private DeepSeek API

Project description

aiodeepseek

Python Platform Async DeepSeek

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="myname@example.com", 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("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("myname@example.com")
    code = input("Code from the email: ")
    token = await DeepSeekClient.confirm_reg_code("myname@example.com", "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


Requirements

  • Python 3.9+
  • aiohttp >= 3.9
  • A C++17 compiler with AVX2 (to build the extension) or manually downloaded wheels.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiodeepseek-0.1.1.tar.gz (59.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

aiodeepseek-0.1.1-cp313-cp313-win_amd64.whl (138.7 kB view details)

Uploaded CPython 3.13Windows x86-64

aiodeepseek-0.1.1-cp313-cp313-musllinux_1_2_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

aiodeepseek-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

aiodeepseek-0.1.1-cp312-cp312-win_amd64.whl (138.6 kB view details)

Uploaded CPython 3.12Windows x86-64

aiodeepseek-0.1.1-cp312-cp312-musllinux_1_2_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

aiodeepseek-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

aiodeepseek-0.1.1-cp311-cp311-win_amd64.whl (138.1 kB view details)

Uploaded CPython 3.11Windows x86-64

aiodeepseek-0.1.1-cp311-cp311-musllinux_1_2_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

aiodeepseek-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

aiodeepseek-0.1.1-cp310-cp310-win_amd64.whl (137.0 kB view details)

Uploaded CPython 3.10Windows x86-64

aiodeepseek-0.1.1-cp310-cp310-musllinux_1_2_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

aiodeepseek-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

aiodeepseek-0.1.1-cp39-cp39-win_amd64.whl (136.7 kB view details)

Uploaded CPython 3.9Windows x86-64

aiodeepseek-0.1.1-cp39-cp39-musllinux_1_2_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.9musllinux: musl 1.2+ x86-64

aiodeepseek-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

Details for the file aiodeepseek-0.1.1.tar.gz.

File metadata

  • Download URL: aiodeepseek-0.1.1.tar.gz
  • Upload date:
  • Size: 59.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for aiodeepseek-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2f83fea318dc3925b671e32b93b3dfdfc705916de661d140074d028761b85c47
MD5 ad771011319159f88402f4f99e17c602
BLAKE2b-256 3dc750d8f6c356aed1156b5715d7bdf7a250f6fe06501466d7a633a8bb855df6

See more details on using hashes here.

File details

Details for the file aiodeepseek-0.1.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: aiodeepseek-0.1.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 138.7 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for aiodeepseek-0.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ffcfc7a07bd9450ac33942a908ced747eb314a56e97e5df2a37fbf6f011feb6c
MD5 e84fab74c1d4d5cb66ef4a8215ea603e
BLAKE2b-256 55c562409d9e6a0c2bbe75f19b92ef6ed0e1b54ad656d8a6159bfbd76030e059

See more details on using hashes here.

File details

Details for the file aiodeepseek-0.1.1-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for aiodeepseek-0.1.1-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 524a0b9abfb3674b34f0edcd11c0d45e0e77fbb0fc5bfc36f2b82dd41814b2f7
MD5 ae82cacb1b610e45eb59704b39140f36
BLAKE2b-256 2818c947652281fb50675da7d9c640d7121483ca509e00c745f10e4162415a12

See more details on using hashes here.

File details

Details for the file aiodeepseek-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for aiodeepseek-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 47de68718f16c1aae18f5f172197d77929ad1a228171439e382f2c4d3bd0168f
MD5 a05e643dba6131651511b9180a59e393
BLAKE2b-256 282faed1c9fc79763a22fa72a4112bd82728b9d9fd316a8ac7cceaf5bcd56b0c

See more details on using hashes here.

File details

Details for the file aiodeepseek-0.1.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: aiodeepseek-0.1.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 138.6 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for aiodeepseek-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 361f13f0162532fca3417b1c4b8e774f00599bb8cb9a11fff30c9a8c202f7a89
MD5 4283eb85a828dfceb6ccf31a00453004
BLAKE2b-256 ce7e3b8487f73fd2113bfbdc4cf9d3de9b0c0e2c1eb484282d53c72354a46b99

See more details on using hashes here.

File details

Details for the file aiodeepseek-0.1.1-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for aiodeepseek-0.1.1-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 bde22f9929d7efaf3c9c20c97ffb01a960a5cc464ba31b5e9c6151fa68a9ba28
MD5 7b9810ef7979c08eb927c9c131d7a128
BLAKE2b-256 a19f208e36c61380472c967669538266f8f759cc9b224737150a759c74fbfe9c

See more details on using hashes here.

File details

Details for the file aiodeepseek-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for aiodeepseek-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f4d43c41e354ab46fa97f8b9bee28d1f6fe011019598c878cc682ef6f1a96ee
MD5 fbe55a8050be388892200343b0ae6bb5
BLAKE2b-256 73cc4e499738d0982245916b34062de8c224b47cd733cc32a0e41a98e46a2426

See more details on using hashes here.

File details

Details for the file aiodeepseek-0.1.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: aiodeepseek-0.1.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 138.1 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for aiodeepseek-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fde31fbc344fe31366706e58317b2fd1236d1b9a66dd5222129e72ddc82d35e2
MD5 80e09b0f0aa035057731df3ef0848800
BLAKE2b-256 729fa41266e83a813e834b91122a826041317d4b3e9e61d32dbe32ee8025e29f

See more details on using hashes here.

File details

Details for the file aiodeepseek-0.1.1-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for aiodeepseek-0.1.1-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b8bbe94a54900e7d3ce94fb66337e73566de59c54ad2742f5c6a4a8f30d69e4c
MD5 aa537e6989ff170629ef74e1f2fc533c
BLAKE2b-256 29669222a953965fd1a3d14954fb149e6bd7e111d1ce88cbce625b043d3b6087

See more details on using hashes here.

File details

Details for the file aiodeepseek-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for aiodeepseek-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fe2916400b919670c355c2030d8b29114b0a93f51f32f62416ef2a06ce208327
MD5 d5529676030d7c1ad488edc88b2f93ab
BLAKE2b-256 dcb16efa3f3c899c327c2bb47bdf6096eac5446f1ea8a3fea301b4110b337a53

See more details on using hashes here.

File details

Details for the file aiodeepseek-0.1.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: aiodeepseek-0.1.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 137.0 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for aiodeepseek-0.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1412bfd0da1f7486790100bcee5601e6e12977d43814a304b9afd5db04a09ced
MD5 3a476b7075cc8ba1e0e80ef62d7e6f20
BLAKE2b-256 968da4895eab5cf78597e994ba1997223804491cf764d99421b3b4ca3c68da73

See more details on using hashes here.

File details

Details for the file aiodeepseek-0.1.1-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for aiodeepseek-0.1.1-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0e995bca8698938804aabe6fec0f5b64b32251b25b3e483db97af5065adf4f8b
MD5 661e5bb89509f7959eaf47dadaa8ada3
BLAKE2b-256 da92817f7e67cd92aa6e9f8f1a299536e59daf9a2993feab9393888efe909e9f

See more details on using hashes here.

File details

Details for the file aiodeepseek-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for aiodeepseek-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c552c80ef85a14098e3d4507be3712b57f799b6c118065add3d6ee391ddb9695
MD5 6f340c4678e04ab43fb10cdf4421a8a1
BLAKE2b-256 2ea9ff11529f42914dc0f1651bbe76259836729f53873c5fcc653d91c0ea4f45

See more details on using hashes here.

File details

Details for the file aiodeepseek-0.1.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: aiodeepseek-0.1.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 136.7 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for aiodeepseek-0.1.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 412afdc3dcc2342d6e2bb0087f929a7ed3f966cfdda464675349dcbb500217d0
MD5 947d543adcc478b358eae01a1f8dd37e
BLAKE2b-256 1c555ff283c5a2d994132172ea01019d8a775a43801e59d96d286f841ed09d77

See more details on using hashes here.

File details

Details for the file aiodeepseek-0.1.1-cp39-cp39-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for aiodeepseek-0.1.1-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 70160e5e9688c1d2fb0a952eb73be7e94ce035a3856d557ea9747edd72a624e5
MD5 96bec905ddace2e794861a4427191d69
BLAKE2b-256 c83dac36dbd7d4b161b80744046c3a8a58cd52abea9cc91279f92e5325fa397c

See more details on using hashes here.

File details

Details for the file aiodeepseek-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for aiodeepseek-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2e122dfd130276640a61607491e3566f3eb010fc2016b6c1eb3d91ad280ceb60
MD5 05119427d701a334a28606a30b9de878
BLAKE2b-256 3b6bee938bd2188164653939baa73e93ac43a48fa509850766d38e1780cde316

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page