Skip to main content

Deepseek API Library

Project description

DeepSeek API Library

Github release License

Deepseek

DeepSeek-V3 achieves a significant breakthrough in inference speed over previous models. It tops the leaderboard among open-source models and rivals the most advanced closed-source models globally at the time of this writing.

This library is a thin client to communicate with the deepseek server.

📥 Installation

pip install deepseek

🥔 Preparation

  • You need to have Deepseek API Key. If not, go here to get one.
  • Set your api key as an environment variable.

Export an environment variable on macOS or Linux systems:

export DEEPSEEK_API_KEY=<YOUR_API_KEY>

Export an environment variable in PowerShell in Windows

setx DEEPSEEK_API_KEY <YOUR_API_KEY>

💎 Usage

from deepseek import DeepSeekAPI
api_client = DeepSeekAPI()
  • Get your account balance
api_client.user_balance()
  • Chat (with streaming off)
r = api_client.chat_completion(prompt='Hi')
print(r)
  • Chat (with streaming on)
for chunk in api_client.chat_completion(prompt='Hi', stream=True):
    print(chunk, end='', flush=True)
  • Fill-In-the-Middle (with streaming off)
r = api_client.fim_completion(prompt='Hi', max_tokens=64)
print(r)
  • Fill-In-the-Middle (with streaming on)
for chunk in api_client.fim_completion(prompt='Once upon a time, ', stream=True):
    print(chunk, end='', flush=True)

Maintained by deskpai.com 2025, Contact: dev@deskpai.com

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

deepseek-0.0.1.dev2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file deepseek-0.0.1.dev2-py3-none-any.whl.

File metadata

  • Download URL: deepseek-0.0.1.dev2-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.31.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.66.5 CPython/3.8.10

File hashes

Hashes for deepseek-0.0.1.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 8a512022ac8b97a6aff7d0f2920bd8f73c42130498b902f1f352c3e3a4c6b4d1
MD5 a69f311999247154a3a66b1a93c7c676
BLAKE2b-256 14f5b1e0dd461ade2747d4d19436df2bffac09bd151e279bc8d8c7978a1d2bd6

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