DeepAnything is a project that provides DeepSeek R1's deep thinking capabilities for various large language models (LLMs).
Project description
DeepAnything
DeepAnything is a project that provides DeepSeek R1's deep thinking capabilities for various large language models (LLMs).
Key Features
- Provides an interface similar to OpenAI
- Supports using various models compatible with the OpenAI API as response models and thinking models
- Offers a server that provides a simple configuration to obtain an API interface compatible with the OpenAI API, and can be called using the official OpenAI SDK.
- Supports using QWQ-32b as a thinking model
Installation Guide
Install via pip:
pip install deepanything
Quick Start
1. Integrate into Code
Chat Completion
from deepanything.ReasonClient import DeepseekReasonClient
from deepanything.ResponseClient import OpenaiResponseClient
from deepanything.DeepAnythingClient import DeepAnythingClient
think_client = DeepseekReasonClient(
base_url="https://api.siliconflow.cn/v1",
api_key="sk-xxxxxxxxx"
)
response_client = OpenaiResponseClient(
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
api_key="sk-xxxxxxxxxx",
)
da_client = DeepAnythingClient(
reason_client=think_client,
response_client=response_client,
reason_prompt="<Think>{}</Think>"
)
completions = da_client.chat_completion(
messages=[
{
"role": "user",
"content": "你好"
}
],
reason_model="Pro/deepseek-ai/DeepSeek-R1",
response_model="qwen-max-latest",
show_model="R1-qwen-max"
)
Streaming Call
stream = da_client.chat_completion(
messages=[
{
"role": "user",
"content": "你好"
}
],
reason_model="Pro/deepseek-ai/DeepSeek-R1",
response_model="qwen-max-latest",
show_model="R1-qwen-max",
stream=True
)
for chunk in stream:
print(chunk)
Asynchronous Usage
from deepanything.ReasonClient import AsyncDeepseekReasonClient
from deepanything.ResponseClient import AsyncOpenaiResponseClient
from deepanything.DeepAnythingClient import AsyncDeepAnythingClient
import asyncio
think_client = AsyncDeepseekReasonClient(
base_url="https://api.siliconflow.cn/v1",
api_key="sk-xxxxxxxxx"
)
response_client = AsyncOpenaiResponseClient(
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
api_key="sk-xxxxxxxxxx",
)
da_client = AsyncDeepAnythingClient(
reason_client=think_client,
response_client=response_client,
reason_prompt="<Think>{}</Think>"
)
async def main():
completions = await da_client.chat_completion(
messages=[
{
"role": "user",
"content": "你好"
}
],
reason_model="Pro/deepseek-ai/DeepSeek-R1",
response_model="qwen-max-latest",
show_model="R1-qwen-max"
)
print(completions)
asyncio.run(main())
More example can be find in examples.
2. Use as a Server
python -m deepanything --host host --port port --config config.json
| Parameter | Description |
|---|---|
| --host | Server listening address, will override the setting in config.json |
| --port | Server listening port, will override the setting in config.json |
| --config | Configuration file path |
Configuration File Format
Below is an example of a configuration file:
{
"host" : "0.0.0.0",
"port" : 8080,
"reason_clients": [
{
"name" : "siliconflow",
"type" : "deepseek",
"base_url" : "https://api.siliconflow.cn/v1",
"api_key" : "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
],
"response_clients": [
{
"name" : "qwen",
"type" : "openai",
"base_url" : "https://dashscope.aliyuncs.com/compatible-mode/v1",
"api_key" : "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
],
"models": [
{
"name": "R1-Qwen-max",
"reason_client" : "siliconflow",
"response_client" : "qwen",
"reason_model": "Pro/deepseek-ai/DeepSeek-R1",
"response_model" : "qwen-max-latest"
}
],
"api_keys": [
"sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
]
}
Detailed Explanation
- reason_clients: Configuration for thinking models, currently supports deepseek and openai types. When the type is openai, deepanything directly uses the model's output as the thinking content, and it is recommended to use qwq-32b in this case.
- response_clients: Configuration for response models, currently only supports the openai type.
- api_keys: API keys for user authentication. When left blank or an empty list, the server does not use API keys for authentication.
License
This project is licensed under the MIT License
Contact Us
Email: 1737636624@qq.com
GitHub Issues: https://github.com/junity233/deep-anything/issues
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deepanything-0.1.4.tar.gz.
File metadata
- Download URL: deepanything-0.1.4.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e46fcb8e51a8fe1005d24e824e6a57ff1799fe1f925c430b01e0f17600413a3c
|
|
| MD5 |
6f997c475ffc93c5e4daf3c45581c1bb
|
|
| BLAKE2b-256 |
84a080641e1491119d85f237d6d730b6b59a59ed3d1717adbac922ccc92478a1
|
File details
Details for the file deepanything-0.1.4-py3-none-any.whl.
File metadata
- Download URL: deepanything-0.1.4-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
594d6a56d6da27ed02a296b2bdbb8670210cd4ffd63e2f69ac0b780900fc9002
|
|
| MD5 |
bda05359ca7f595896c047be08f545a1
|
|
| BLAKE2b-256 |
d81d720e4e75cfcb6b50d26e9afe9de4328b855138fdabf68bf60b55127cdb18
|