# DeepSeek API Library
![Github release](https://img.shields.io/badge/release-v1.0.0-red) ![License](https://img.shields.io/badge/License-Apache--2.0-red)
![Deepseek](https://raw.githubusercontent.com/deskpai/deepseek/main/img/logo.png)
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](https://platform.deepseek.com/api_keys) 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)
```Python
r = api_client.chat_completion(prompt='Hi')
print(r)
```
- Chat (with streaming on)
```Python
for chunk in api_client.chat_completion(prompt='Hi', stream=True):
print(chunk, end='', flush=True)
```
- Fill-In-the-Middle (with streaming off)
```Python
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](https://deskpai.com) 2025, Contact: [dev@deskpai.com](mailto:dev@deskpai.com)
Raw data
{
"_id": null,
"home_page": "https://github.com/deskpai/deepseek",
"name": "deepseek",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "deepseek",
"author": "Deskpai.com",
"author_email": "dev@deskpai.com",
"download_url": null,
"platform": null,
"description": "# DeepSeek API Library\n\n![Github release](https://img.shields.io/badge/release-v1.0.0-red) ![License](https://img.shields.io/badge/License-Apache--2.0-red)\n\n![Deepseek](https://raw.githubusercontent.com/deskpai/deepseek/main/img/logo.png)\n\nDeepSeek-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.\n\nThis library is a thin client to communicate with the deepseek server.\n\n## \ud83d\udce5 Installation\n\n```\npip install deepseek\n```\n\n## \ud83e\udd54 Preparation\n\n- You need to have Deepseek API Key. If not, go [here](https://platform.deepseek.com/api_keys) to get one.\n- Set your api key as an environment variable.\n\nExport an environment variable on macOS or Linux systems:\n```\nexport DEEPSEEK_API_KEY=<YOUR_API_KEY>\n```\n\nExport an environment variable in PowerShell in Windows\n```\nsetx DEEPSEEK_API_KEY <YOUR_API_KEY>\n```\n\n## \ud83d\udc8e Usage\n\n```\nfrom deepseek import DeepSeekAPI\napi_client = DeepSeekAPI()\n```\n\n- Get your account balance\n\n```\napi_client.user_balance()\n```\n\n- Chat (with streaming off)\n\n```Python\nr = api_client.chat_completion(prompt='Hi')\nprint(r)\n```\n\n- Chat (with streaming on)\n\n```Python\nfor chunk in api_client.chat_completion(prompt='Hi', stream=True):\n print(chunk, end='', flush=True)\n```\n\n- Fill-In-the-Middle (with streaming off)\n\n```Python\nr = api_client.fim_completion(prompt='Hi', max_tokens=64)\nprint(r)\n```\n\n- Fill-In-the-Middle (with streaming on)\n\n```\nfor chunk in api_client.fim_completion(prompt='Once upon a time, ', stream=True):\n print(chunk, end='', flush=True)\n```\n\n\n> Maintained by [deskpai.com](https://deskpai.com) 2025, Contact: [dev@deskpai.com](mailto:dev@deskpai.com)\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Deepseek API Library",
"version": "0.0.1.dev2",
"project_urls": {
"Homepage": "https://github.com/deskpai/deepseek"
},
"split_keywords": [
"deepseek"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "14f5b1e0dd461ade2747d4d19436df2bffac09bd151e279bc8d8c7978a1d2bd6",
"md5": "a69f311999247154a3a66b1a93c7c676",
"sha256": "8a512022ac8b97a6aff7d0f2920bd8f73c42130498b902f1f352c3e3a4c6b4d1"
},
"downloads": -1,
"filename": "deepseek-0.0.1.dev2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a69f311999247154a3a66b1a93c7c676",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4086,
"upload_time": "2025-01-03T01:28:59",
"upload_time_iso_8601": "2025-01-03T01:28:59.030115Z",
"url": "https://files.pythonhosted.org/packages/14/f5/b1e0dd461ade2747d4d19436df2bffac09bd151e279bc8d8c7978a1d2bd6/deepseek-0.0.1.dev2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-03 01:28:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "deskpai",
"github_project": "deepseek",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "requests",
"specs": []
}
],
"lcname": "deepseek"
}